Answer the question
In order to leave comments, you need to log in
Bot in VK sends one message and then an error?
I made a simple bot, the essence of it is that when messages are written to him in a PM or in a conversation with him, he must write messages to the cf I prepared, it works, but the problem is that it works for one message, when they write the second message, it just throws vk_api.exceptions.ApiError [10] Internal server error. I read what this error means, catching it, I thought that messages would be sent every other time, but this is not so. Here is the code:
while True:
try:
for i in longpoll.listen():
if i.type == VkBotEventType.MESSAGE_NEW:
vk.messages.send(peer_id=2000000005, message=f"Сообщение из чата (ID: {i.chat_id})\nID Пользователя: @id{i.obj.from_id}\nТекст: {i.obj.text}", random_id=rand)
except vk_api.exceptions.ApiError:
time.sleep(2)
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