From fa54d641cc415154cab7a780ac9f9387dbdf720e Mon Sep 17 00:00:00 2001 From: blank X Date: Wed, 9 Mar 2022 15:06:52 +0700 Subject: [PATCH] Add auto-clear reactions --- example-config.yaml | 1 + sukuinote/plugins/auto_clear_reactions.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 sukuinote/plugins/auto_clear_reactions.py diff --git a/example-config.yaml b/example-config.yaml index a0b5971..0c9fa1b 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -20,3 +20,4 @@ config: log_reports: true log_forwards: true log_ring_maxlen: 69420 + auto_clear_reactions: false diff --git a/sukuinote/plugins/auto_clear_reactions.py b/sukuinote/plugins/auto_clear_reactions.py new file mode 100644 index 0000000..7856b7c --- /dev/null +++ b/sukuinote/plugins/auto_clear_reactions.py @@ -0,0 +1,15 @@ +import asyncio +from pyrogram import Client, filters +from pyrogram.raw.functions.messages import ReadReactions +from .. import config, log_errors + +# I fucking HATE reactions! +@Client.on_message(filters.outgoing & filters.edited) +@log_errors +async def auto_clear_reactions(client, message): + if not config['config'].get('auto_clear_reactions') or not message.reactions: + return + while True: + if (await client.send(ReadReactions(peer=await client.resolve_peer(message.chat.id)))).pts_count > 0: + break + await asyncio.sleep(1)