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