Skip to content

Commit

Permalink
fix: fix bot to work with supergroups
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuhanming committed May 4, 2021
1 parent a1dbd98 commit cb65bc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/pair_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/stats_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,31 +162,31 @@ 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)


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)


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)


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)
Expand All @@ -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)
Expand Down

0 comments on commit cb65bc5

Please sign in to comment.