Answer the question
In order to leave comments, you need to log in
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})
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