From cb65bc524b06b53c35dfcf3390c438c2c54beb1b Mon Sep 17 00:00:00 2001 From: Hanming Zhu Date: Tue, 4 May 2021 11:37:11 +0800 Subject: [PATCH] fix: fix bot to work with supergroups --- src/pair_handlers.py | 2 +- src/stats_handlers.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pair_handlers.py b/src/pair_handlers.py index 3f1b7f5..3433d81 100644 --- a/src/pair_handlers.py +++ b/src/pair_handlers.py @@ -115,7 +115,7 @@ def generate_group_interview_summary( def interview_pairs(update: Update, _: CallbackContext) -> None: """Generates pairs for the group for members who have yet to be paired, and lists all pairs out.""" update.message = unwrap(update.message) - if update.message.chat.type != "group": + if update.message.chat.type == "private": update.message.reply_text("Please use this command in a chat group!") return chat = update.message.chat diff --git a/src/stats_handlers.py b/src/stats_handlers.py index 353c6c0..04ea6aa 100644 --- a/src/stats_handlers.py +++ b/src/stats_handlers.py @@ -162,7 +162,7 @@ def create_and_send_group_summary( def week(update: Update, context: CallbackContext) -> None: update.message = unwrap(update.message) - if update.message.chat.type == "group": + if update.message.chat.type != "private": week_chat(update, context) return create_and_send_individual_summary(update, SummaryType.WEEKLY) @@ -170,7 +170,7 @@ def week(update: Update, context: CallbackContext) -> None: def month(update: Update, context: CallbackContext) -> None: update.message = unwrap(update.message) - if update.message.chat.type == "group": + if update.message.chat.type != "private": month_chat(update, context) return create_and_send_individual_summary(update, SummaryType.MONTHLY) @@ -178,7 +178,7 @@ def month(update: Update, context: CallbackContext) -> None: def all_questions(update: Update, context: CallbackContext) -> None: update.message = unwrap(update.message) - if update.message.chat.type == "group": + if update.message.chat.type != "private": all_questions_chat(update, context) return create_and_send_individual_summary(update, SummaryType.ALL) @@ -186,7 +186,7 @@ def all_questions(update: Update, context: CallbackContext) -> None: def all_unique(update: Update, context: CallbackContext) -> None: update.message = unwrap(update.message) - if update.message.chat.type == "group": + if update.message.chat.type != "private": all_unique_chat(update, context) return create_and_send_individual_summary(update, SummaryType.ALL_UNIQUE) @@ -201,7 +201,7 @@ def week_chat(update: Update, _: CallbackContext) -> None: def week_detailed(update: Update, _: CallbackContext) -> None: update.message = unwrap(update.message) - if update.message.chat.type != "group": + if update.message.chat.type == "private": update.message.reply_text("Please use this command in a chat group!") return create_and_send_group_summary(update, SummaryType.WEEKLY, is_detailed=True)