Answer the question
In order to leave comments, you need to log in
Why is complaining about the attribute?
actually for the bot I want to make it so that when I wrote the kill command (any process), it cut down this process. I actually did this, but when I write the kill command (and some process), an error occurs
text = event.text
AttributeError: 'Event' object has no attribute 'text'
actually why does this happen and how could it be fixed?
#библиотека
import vk_api, os
from vk_api import VkUpload
from vk_api.longpoll import VkLongPoll
# ключ бота
token = "mytoken"
vk_session = vk_api.VkApi(token=token)
vk = vk_session.get_api()
longpol = VkLongPoll(vk_session)
upload = VkUpload(vk_session)
while True:
for event in longpol.listen():
text = event.text
words = text.split(" ")
if words[0] == "kill":
os.system(f"taskkill /IM {words[1]} /F")
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