U
U
User12312332021-12-06 17:11:23
Python
User1231233, 2021-12-06 17:11:23

Vk_api.exceptions.ApiError: [10] Internal server error?

I have a code with a bot for a group that responds to people in PM in python3:
Everything you need is imported, and the group is authorized by token.

while True:
    for event in longpoll.listen():
        messages = vk.method("messages.getConversations", {"offset": 0, "count": 20, "filter": "unanswered"})
        if event.type == VkEventType.MESSAGE_NEW:
            if event.to_me:
                request = event.text
                randint = random.randint(0,900000000)
                request = request.lower()
                chat_id = vk.method('messages.getConversations')
                chat_id = chat_id['items']
                id = messages["items"][0]["last_message"]["from_id"]
                body = messages["items"][0]["last_message"]["text"]
                user = vk.method("users.get", {"user_ids": + id}) 
                fullname = user[0]['first_name'] 
                lastname = user[0]['last_name'] 
                full = user[0]['first_name'] +  ' ' + user[0]['last_name']
                for check in request:
                        if body.lower() == "привет":
                            vk.method("messages.send", {"user_id": id, "message": "[id" + str(id) + "|" + str(fullname) + "],  привет", "random_id": randint})


At some point it throws an error

messages = vk.method("messages.getConversations", {"offset": 0, "count": 20, "filter": "unanswered"})
File "/usr/local/lib/ python3.8/dist-packages/vk_api/vk_api.py", line 684, in method raise
error
vk_api.exceptions.ApiError: [10] Internal server error

The error is not clear why it occurs during normal use. I ask in advance not to tell in words what happened, but to show.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question