Skip to content

Commit

Permalink
Add debug chat configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mpellicc committed Aug 20, 2024
1 parent 4ced471 commit 9d7aa2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ BOT_USERNAME=@your_username_bot
# Channel
CHANNEL_CHAT_ID=12345678
DEVELOPER_CHAT_ID=12345678
DEBUG_CHAT_ID=12345678

# Serie A Calendar
SERIE_A_CALENDAR_URL="https://fixturedownload.com/download/serie-a-{season_year}-WEuropeStandardTime.csv"
Expand Down
2 changes: 1 addition & 1 deletion fantaformazionibot/bot/handler/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def default_error_handler(update: Update, context: ContextTypes.DEFAULT_TY

# Finally, send the message
await context.bot.send_message(
chat_id=context.bot_data["config"].developer_chat_id,
chat_id=context.bot_data["config"].debug_chat_id,
text=message,
parse_mode=ParseMode.HTML,
)
7 changes: 7 additions & 0 deletions fantaformazionibot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ def developer_chat_id(self) -> str:
raise ValueError("DEVELOPER_CHAT_ID environment variable not set.")
return developer_chat_id

@property
def debug_chat_id(self) -> str:
developer_chat_id = os.getenv("DEBUG_CHAT_ID")
if developer_chat_id is None:
raise ValueError("DEBUG_CHAT_ID environment variable not set.")
return developer_chat_id

@staticmethod
def _get_season_year() -> int:
return (
Expand Down

0 comments on commit 9d7aa2a

Please sign in to comment.