Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vk_api
- import asyncio
- import random
- import threading
- from vk_api.longpoll import VkLongPoll, VkEventType
- vk_session = vk_api.VkApi(token="HERE OUR TOKEN")
- vk = vk_session.get_api()
- longpoll = VkLongPoll(vk_session)
- def send(id):
- msg = 5
- while msg != 0:
- vk.messages.send(
- user_id=event.user_id, random_id = random.randint(1, 2147483647),
- message="Я календарь")
- msg -= 1
- async def session(id):
- asyncio.create_task(send(id))
- async def main(id):
- task = asyncio.create_task(send(id))
- await task
- for event in longpoll.listen():
- if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
- for i in range(10):
- threading.Thread(target=send(event.user_id),).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement