Answer the question
In order to leave comments, you need to log in
How to send processes to VK in one message?
Hello, I want to make it so that I would be sent through the bot to VK, the name of all the processes that occur on my computer.
I made such a miracle Yudo, which in principle fulfills my requirements, but it sends 1 process - 1 message. Because of what, VK makes a restriction on messages and the bot crashes.
import vk_api, json, subprocess
from vk_api import VkUpload
from vk_api.longpoll import VkEventType, VkLongPoll
vk_session = vk_api.VkApi(token=mytoken)
vk = vk_session.get_api()
longpol = VkLongPoll(vk_session)
upload = VkUpload(vk_session)
def proc(user_id):
cmd = 'WMIC PROCESS get Caption,Processid'
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
for text in proc.stdout:
vk_session.method('messages.send', {"user_id": user_id, "message": text, "random_id": 0})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question