From 6d67ebad0685c55d87a1cbc8222f1f8db96f89d2 Mon Sep 17 00:00:00 2001 From: Lonami Date: Sat, 8 Jun 2019 10:15:51 +0200 Subject: [PATCH] Dab *has* to be a standard plugin --- stdplugins/randomsticker.py | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 stdplugins/randomsticker.py diff --git a/stdplugins/randomsticker.py b/stdplugins/randomsticker.py new file mode 100644 index 0000000..2aa47e5 --- /dev/null +++ b/stdplugins/randomsticker.py @@ -0,0 +1,39 @@ +import random + +from telethon import events, types, functions, utils + + +def choser(cmd, pack, blacklist={}): + docs = None + @borg.on(events.NewMessage(pattern=rf'\.{cmd}', outgoing=True)) + async def handler(event): + await event.delete() + + nonlocal docs + if docs is None: + docs = [ + utils.get_input_document(x) + for x in (await borg(functions.messages.GetStickerSetRequest(types.InputStickerSetShortName(pack)))).documents + if x.id not in blacklist + ] + + await event.respond(file=random.choice(docs)) + + +choser('brain', 'supermind') +choser('dab', 'DabOnHaters', { + 1653974154589768377, + 1653974154589768312, + 1653974154589767857, + 1653974154589768311, + 1653974154589767816, + 1653974154589767939, + 1653974154589767944, + 1653974154589767912, + 1653974154589767911, + 1653974154589767910, + 1653974154589767909, + 1653974154589767863, + 1653974154589767852, + 1653974154589768677 +}) \ No newline at end of file