Answer the question
In order to leave comments, you need to log in
Why does the error appear: AttributeError: 'VkBotMessageEvent' object has no attribute 'text'?
def random_id():
Random = 0
random += random.randint(0, 1000000000)
return Random
while True:
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.text.lower() == 'привет':
vk.message.send(
user_id = event.user_id,
message = "привет",
random_id = random_id()
)
elif event.text.lower() == 'Как дела?':
vk.message.send(
user_id = event.user_id,
message = "Отлично, Вы как?",
random_id = random_id()
)
else:
vk.message.send(
user_id = event.user_id,
message = "Не понимаю вас",
random_id = random_id()
)
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