From 9959a5fdefe110c4d32d6ea58f4624f8ca3e1450 Mon Sep 17 00:00:00 2001 From: Tanuj Date: Fri, 1 Jun 2018 00:53:51 +0100 Subject: [PATCH 1/6] Add regex to requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 437350f..3cca06c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ telethon-aio - +regex From cfd6004dd92e3f9b847c8b6c07b46adf3feb2abe Mon Sep 17 00:00:00 2001 From: Tanuj Date: Fri, 1 Jun 2018 00:54:14 +0100 Subject: [PATCH 2/6] Recognise more sedbots --- stdplugins/re.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdplugins/re.py b/stdplugins/re.py index 426d82f..dc28729 100644 --- a/stdplugins/re.py +++ b/stdplugins/re.py @@ -7,7 +7,7 @@ from telethon.tl import types, functions HEADER = "[[regex]]\n" KNOWN_RE_BOTS = re.compile( - r'(regex|moku|BananaButler_)bot', + r'(regex|moku|BananaButler_|rgx|l4mR)bot', flags=re.IGNORECASE ) From 6bf457793c0d1c3d4bee711b87733dca852dfba7 Mon Sep 17 00:00:00 2001 From: Tanuj Date: Fri, 1 Jun 2018 00:54:37 +0100 Subject: [PATCH 3/6] Use event.chat_id instead of event.input_chat saving an await and a potential exception if input_chat could not be found --- stdplugins/re.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stdplugins/re.py b/stdplugins/re.py index dc28729..df3e908 100644 --- a/stdplugins/re.py +++ b/stdplugins/re.py @@ -75,8 +75,7 @@ async def group_has_regex(group): @borg.on(events.NewMessage) async def on_message(event): - chat_id = utils.get_peer_id(await event.input_chat) - last_msgs[chat_id].appendleft(event.message) + last_msgs[event.chat_id].appendleft(event.message) @borg.on(events.NewMessage( From 5c175821a05fb809896af1ecf7dd8e505c1de065 Mon Sep 17 00:00:00 2001 From: Tanuj Date: Fri, 1 Jun 2018 01:09:34 +0100 Subject: [PATCH 4/6] create stdborg requirements file --- requirements-stdborg.txt | 1 + requirements.txt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 requirements-stdborg.txt diff --git a/requirements-stdborg.txt b/requirements-stdborg.txt new file mode 100644 index 0000000..4f9256d --- /dev/null +++ b/requirements-stdborg.txt @@ -0,0 +1 @@ +regex diff --git a/requirements.txt b/requirements.txt index 3cca06c..15ef170 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ telethon-aio -regex From 34c8c2d682bacb17ed5675e3d5e586ecec0dd979 Mon Sep 17 00:00:00 2001 From: Tanuj Date: Fri, 1 Jun 2018 01:29:51 +0100 Subject: [PATCH 5/6] make snip deletion permanent --- stdplugins/snip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/stdplugins/snip.py b/stdplugins/snip.py index acaac59..dd9d905 100644 --- a/stdplugins/snip.py +++ b/stdplugins/snip.py @@ -72,6 +72,7 @@ async def on_snip_list(event): @borg.on(events.NewMessage(pattern=r'.snipd (\S+)', outgoing=True)) async def on_snip_delete(event): snips.pop(event.pattern_match.group(1), None) + storage.snips = snips await event.delete() From b6f3c4d1990fdef45569acdb13b07e243e86e112 Mon Sep 17 00:00:00 2001 From: Tanuj Date: Fri, 1 Jun 2018 02:13:09 +0100 Subject: [PATCH 6/6] fix ninja failing on replies --- stdplugins/ninja.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdplugins/ninja.py b/stdplugins/ninja.py index 1add409..edf22aa 100644 --- a/stdplugins/ninja.py +++ b/stdplugins/ninja.py @@ -12,7 +12,7 @@ from uniborg import util async def get_target_message(event): if event.is_reply and (await event.reply_message).from_id == borg.uid: - return event.reply_message + return await event.reply_message async for message in borg.iter_messages(await event.input_chat, limit=20): if message.out: return message