From d0e32bba605ab90936393ae49e50f5a62c8508fb Mon Sep 17 00:00:00 2001 From: Benny Date: Fri, 20 Jan 2023 20:22:45 +0100 Subject: [PATCH] REQUIRED_MEMBERSHIP fix banned user is still in the list fix #187 --- ytdlbot/ytdl_bot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ytdlbot/ytdl_bot.py b/ytdlbot/ytdl_bot.py index 71cb593..0adcd87 100644 --- a/ytdlbot/ytdl_bot.py +++ b/ytdlbot/ytdl_bot.py @@ -75,8 +75,10 @@ def private_use(func): # membership check if REQUIRED_MEMBERSHIP: try: - app.get_chat_member(REQUIRED_MEMBERSHIP, chat_id) - logging.info("user %s check passed for group/channel %s.", chat_id, REQUIRED_MEMBERSHIP) + if app.get_chat_member(REQUIRED_MEMBERSHIP, chat_id).status != "member": + raise UserNotParticipant() + else: + logging.info("user %s check passed for group/channel %s.", chat_id, REQUIRED_MEMBERSHIP) except UserNotParticipant: logging.warning("user %s is not a member of group/channel %s", chat_id, REQUIRED_MEMBERSHIP) message.reply_text(bot_text.membership_require, quote=True)