from vk_api import VkApi
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
group_id = "*****"
TOKEN = "*****"
vk_session = VkApi(token=TOKEN)
longpoll = VkBotLongPoll(vk_session, group_id)
vk = vk_session.get_api()
def main():
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW and event.from_chat:
chat_id = event.chat_id
print(chat_id)
if __name__ == '__main__':
main()
from vkbottle.bot import Message
bp.labeler.vbml_ignore_case = True
@bp.on.chat_message(blocking=0)
async def newmessage(message: Message)
if "привет" in message.text:
await message.answer("привет")
chat_id = message.chat_id