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.
master
Dan Elkouby 2020-02-27 21:16:11 +00:00
parent 1988c5821d
commit bff5fd02dd
1 changed files with 5 additions and 3 deletions

View File

@ -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())