Answer the question
In order to leave comments, you need to log in
How to remove an error in the VK log?
import vk_api.vk_api
import random
import requests
import re
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
# Настройки
group_id = id
admins = [1, 2, 3]
mytoken = ""
vk = vk_api.VkApi(token = mytoken)
vkapi = vk.get_api()
lp = VkBotLongPoll(vk, group_id, wait = 5)
for event in lp.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
username = event.object.from_id
help = vk.method("users.get", {"user_ids": username})
fullname = help[0]['first_name'] + ' ' + help[0]['last_name']
msg = event.object.text
print("Пользователь: " + fullname + "\nСообщение: " + msg)
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