uniborg/stdplugins/all.py

19 lines
636 B
Python
Raw Permalink Normal View History

2018-05-18 16:45:09 +00:00
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
2018-06-24 12:49:45 +00:00
2018-05-18 16:48:44 +00:00
@borg.on(events.NewMessage(pattern=r"\.all", outgoing=True))
2018-05-18 16:45:09 +00:00
async def _(event):
2018-06-14 21:09:25 +00:00
if event.fwd_from:
2018-05-18 16:48:44 +00:00
return
2018-05-18 16:45:09 +00:00
await event.delete()
mentions = "@all"
2018-06-24 12:49:45 +00:00
chat = await event.get_input_chat()
async for x in borg.iter_participants(chat, 100):
2018-05-18 16:45:09 +00:00
mentions += f"[\u2063](tg://user?id={x.id})"
2018-06-24 12:49:45 +00:00
await borg.send_message(
chat, mentions, reply_to=event.message.reply_to_msg_id)