SHARE
TWEET

Untitled

a guest Oct 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import vk_api
  2. import asyncio
  3. import random
  4. import threading
  5.  
  6. from vk_api.longpoll import VkLongPoll, VkEventType
  7.  
  8. vk_session = vk_api.VkApi(token="HERE OUR TOKEN")
  9. vk = vk_session.get_api()
  10. longpoll = VkLongPoll(vk_session)
  11.  
  12. def send(id):
  13.     msg = 5
  14.     while msg != 0:
  15.         vk.messages.send(
  16.                 user_id=event.user_id, random_id = random.randint(1, 2147483647),
  17.                 message="Я календарь")
  18.         msg -= 1
  19.  
  20.  
  21. async def session(id):
  22.     asyncio.create_task(send(id))
  23.  
  24. async def main(id):
  25.     task = asyncio.create_task(send(id))
  26.     await task
  27.  
  28.  
  29. for event in longpoll.listen():
  30.     if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
  31.         for i in range(10):
  32.             threading.Thread(target=send(event.user_id),).start()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top