From bff5fd02dd17932e63e3def4b08f177a450f2d3a Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Thu, 27 Feb 2020 21:16:11 +0000 Subject: [PATCH] sed: only allow outgoing commands in groups This plugin was originally intended for using in PM only. Leaving it wide open in groups might create unwanted spam in case another bot is present but not blacklisted. It may also violate "no bots" policies in some groups. By only allowing self to use the plugin in groups, we can still use its features when no bot is present, while avoiding the above problems. --- stdplugins/sed.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stdplugins/sed.py b/stdplugins/sed.py index b3410b0..bf55990 100644 --- a/stdplugins/sed.py +++ b/stdplugins/sed.py @@ -97,9 +97,11 @@ async def on_edit(event): async def on_regex(event): if event.fwd_from: return - if not event.is_private and\ - await group_has_sedbot(await event.get_input_chat()): - return + if not event.is_private: + if not event.out: + return + if await group_has_sedbot(await event.get_input_chat()): + return chat_id = utils.get_peer_id(await event.get_input_chat())