МОЙ ГОВНОКОД
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from tokens import my_tokens
vk_session = vk_api.VkApi(token = my_tokens)
session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
def sender(id, text):
vk_session.method('messages.send', {'user_id' : id, 'messages' : text, 'random_id' : 0})
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
msg = event.text.lower()
id = event.user_id
if msg =='привет':
sender(id,'и тебе привет')
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from tokens import my_tokens
vk_session = vk_api.VkApi(token = my_tokens)
session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
def sender(id, text):
vk_session.method('messages.send', {'user_id' : id, 'messages' : text, 'random_id' : 0})
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
msg = event.text.lower()
id = event.user_id
if msg =='привет':
sender(id,'и тебе привет')