Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
vk_session = vk_api.VkApi(token = 'цензура')
longpoll = VkBotLongPoll(vk_session, цензура)
def sender(id, text):
vk_session.method('messages.send', {'chat_id' : id, 'message' : text, 'random_id' : 0})
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.from_chat:
id = event.chat_id
msg = event.object.message['text'].lower()
elif msg == 'айди':
sender(id, f'{event.obj.from_id}')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question