import vk_api
from vk_api.utils import get_random_id
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
def write_message (sender, message):
authorize.method ('messages.send', {'chat_id' : sender, 'message':message, 'random_id':get_random_id ()})
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW and event.from_chat and event.message.get('text') !="":
reseived_message = event.message.get('text')
sender = event.chat_id
InfoEvent = event.object['message']
from_id = InfoEvent['from_id']
peer_id = InfoEvent['peer_id']
chat_id = event.chat_id
user_id = event.obj.from_id
if reseived_message == "Привет" :
write_message ( sender,"Добрый день!")
Как именно сюда добавить данную функцию ??
-
Вопрос задан
-
186 просмотров