Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

207084293 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

207084293 #4

wants to merge 1 commit into from

Conversation

Seggggggga
Copy link

import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType

vk_session = vk_api.VkApi(token = 'dda72434d647022c3a39a0a192e054e4e02d1ce7a211971263c6e4b9548bd539025459f72de84c5c19380')

session_api = vk_session.get_api()
longpool = VkLongPoll(vk_session) #Работа с событиями сообщества в реальном времени

def send_some_msg(id, some_text):
vk_session.method("messages.send", {"user_id":id, "message":some_text, "random_id":0})

for event in longpool.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
msg = event.text.lower()
id = event.user_id
print(msg)
if msg == "hi":
send_some_msg(id,"Hi friend")

import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType

vk_session = vk_api.VkApi(token = 'dda72434d647022c3a39a0a192e054e4e02d1ce7a211971263c6e4b9548bd539025459f72de84c5c19380')

session_api = vk_session.get_api()
longpool = VkLongPoll(vk_session) #Работа с событиями сообщества в реальном времени

def send_some_msg(id, some_text):
    vk_session.method("messages.send", {"user_id":id, "message":some_text, "random_id":0})

for event in longpool.listen():
    if event.type == VkEventType.MESSAGE_NEW:
        if event.to_me:
            msg = event.text.lower()
            id  = event.user_id
            print(msg)
            if msg == "hi":
                send_some_msg(id,"Hi friend")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant