From 8eef17139178995e59cc370ab1c2124f0a971e5d Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 23 Aug 2023 10:42:38 +0200 Subject: [PATCH] Fixed sender_chat not being recognized --- plugins/commands/ban_failed.py | 4 +++- plugins/commands/language_auto.py | 4 +++- plugins/commands/timeout_join.py | 4 +++- plugins/commands/timeout_verify.py | 4 +++- plugins/language.py | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/commands/ban_failed.py b/plugins/commands/ban_failed.py index 7831c7d..e6f04f6 100644 --- a/plugins/commands/ban_failed.py +++ b/plugins/commands/ban_failed.py @@ -18,7 +18,9 @@ async def command_ban_failed(app: PyroClient, message: Message): group = await app.find_group(message.chat.id) locale = group.select_locale(app, message.from_user) - if (await app.get_chat_member(group.id, message.from_user.id)).status not in [ + if (message.sender_chat is not None and (message.sender_chat.id != group.id)) or ( + await app.get_chat_member(group.id, message.from_user.id) + ).status not in [ ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER, ]: diff --git a/plugins/commands/language_auto.py b/plugins/commands/language_auto.py index 3cd340e..0496a70 100644 --- a/plugins/commands/language_auto.py +++ b/plugins/commands/language_auto.py @@ -18,7 +18,9 @@ async def command_language_auto(app: PyroClient, message: Message): group = await app.find_group(message.chat.id) locale = group.select_locale(app, message.from_user) - if (await app.get_chat_member(group.id, message.from_user.id)).status not in [ + if (message.sender_chat is not None and (message.sender_chat.id != group.id)) or ( + await app.get_chat_member(group.id, message.from_user.id) + ).status not in [ ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER, ]: diff --git a/plugins/commands/timeout_join.py b/plugins/commands/timeout_join.py index 385fab6..9d638a6 100644 --- a/plugins/commands/timeout_join.py +++ b/plugins/commands/timeout_join.py @@ -18,7 +18,9 @@ async def command_timeout_join(app: PyroClient, message: Message): group = await app.find_group(message.chat.id) locale = group.select_locale(app, message.from_user) - if (await app.get_chat_member(group.id, message.from_user.id)).status not in [ + if (message.sender_chat is not None and (message.sender_chat.id != group.id)) or ( + await app.get_chat_member(group.id, message.from_user.id) + ).status not in [ ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER, ]: diff --git a/plugins/commands/timeout_verify.py b/plugins/commands/timeout_verify.py index dac7def..a9a939f 100644 --- a/plugins/commands/timeout_verify.py +++ b/plugins/commands/timeout_verify.py @@ -18,7 +18,9 @@ async def command_timeout_verify(app: PyroClient, message: Message): group = await app.find_group(message.chat.id) locale = group.select_locale(app, message.from_user) - if (await app.get_chat_member(group.id, message.from_user.id)).status not in [ + if (message.sender_chat is not None and (message.sender_chat.id != group.id)) or ( + await app.get_chat_member(group.id, message.from_user.id) + ).status not in [ ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER, ]: diff --git a/plugins/language.py b/plugins/language.py index cac2d45..7651703 100644 --- a/plugins/language.py +++ b/plugins/language.py @@ -19,7 +19,9 @@ async def command_language(app: PyroClient, message: Message): group = await app.find_group(message.chat.id) locale = group.select_locale(app, message.from_user) - if (await app.get_chat_member(group.id, message.from_user.id)).status not in [ + if (message.sender_chat is not None and (message.sender_chat.id != group.id)) or ( + await app.get_chat_member(group.id, message.from_user.id) + ).status not in [ ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER, ]: