Skip to content

Commit

Permalink
config: add telegram api key at the end of webhook url
Browse files Browse the repository at this point in the history
This elimates a possible mistake while configuring the bot.
  • Loading branch information
furkansimsekli committed Mar 18, 2024
1 parent 8e7971a commit 11f3d84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def validate():
exit(2)

if config.WEBHOOK_CONNECTED:
if config.WEBHOOK_URL == config.TELEGRAM_API_KEY:
print("ERROR: Please make sure you configured a WEBHOOK_URL if you are using webhook rather than polling!")
if config.WEBHOOK_URL[1:] == config.TELEGRAM_API_KEY:
print("ERROR: Please make sure you configured a WEBHOOK_URL when WEBHOOK_CONNECTED is True")
exit(2)

if not config.PORT:
print("ERROR: Please make sure you configured a valid PORT number!")
print("ERROR: Please make sure you configured a valid PORT number when WEBHOOK_CONNECTED is True")
exit(2)


Expand Down
2 changes: 1 addition & 1 deletion src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Polling or Webhook?
WEBHOOK_CONNECTED: bool = config.get("WEBHOOK_CONNECTED", False)
PORT: str = config.get("PORT", "31415")
WEBHOOK_URL: str = config.get("WEBHOOK_URL", "")
WEBHOOK_URL: str = config.get("WEBHOOK_URL", "") + "/" + TELEGRAM_API_KEY

# Conversation timeout values
FEEDBACK_TIMEOUT: int = config.get("FEEDBACK_TIMEOUT", 300)
Expand Down

0 comments on commit 11f3d84

Please sign in to comment.