# -*- coding: utf8 -*-
import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
token = 'token tyteq'
vk_session = vk_api.VkApi(token=token)
vk = vk_session.get_api()
longpoll = VkBotLongPoll(vk_session, 'ид группы')
def send_msg(peer_id: int, message: str, attachment: str = ""):
return vk.messages.send( **locals(), random_id=0)
while True: #бесконечный цикл
for event in longpoll.listen(): #прослушиваем все сообщения
if event.type == VkBotEventType.MESSAGE_NEW:
responce = event.object.text.lower()
id = event.obj.peer_id
uids = event.obj.from_id
if responce == "id":
send_msg(id,f"твой ид {id}")
# -*- coding: utf8 -*-
import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
token = 'token tyteq'
vk_session = vk_api.VkApi(token=token)
vk = vk_session.get_api()
longpoll = VkBotLongPoll(vk_session, 'ид группы')
def send_msg(peer_id: int, message: str, attachment: str = ""):
return vk.messages.send( **locals(), random_id=0)
while True: #бесконечный цикл
for event in longpoll.listen(): #прослушиваем все сообщения
if event.type == VkBotEventType.MESSAGE_NEW:
responce = event.object.text.lower()
id = event.obj.peer_id
uids = event.obj.from_id
if responce == "id":
send_msg(id,f"твой ид {uids}")