Advertisement
l1von

aleg

Jul 22nd, 2021
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. @bot.on.message(lower=True, text=['рассылка <txt>'])
  2. async def ls(ans: Message, txt):
  3.         start_time = time.time()
  4.         conversations = await bot.api.messages.get_conversations(count=200)
  5.         for i in range(conversations.count):
  6.             if conversations.items[i].conversation.peer.type == 'user' and conversations.items[i].conversation.can_write.allowed:
  7.                 await bot.api.messages.send(peer_id=conversations.items[i].conversation.peer.id, random_id=0, message=txt)
  8.         end_time = time.time()
  9.         await ans(f'Рассылка завершена за {round(end_time-start_time, 1)} сек.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement