We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd3dafc commit c9abea2Copy full SHA for c9abea2
src/extras/bot_token_test.py
@@ -0,0 +1,22 @@
1
+# test to see if your TG bot token is available in the environment
2
+
3
+import os
4
+import logging
5
6
+# Set up basic logging
7
+logging.basicConfig(level=logging.INFO)
8
9
+def get_bot_token():
10
+ bot_token = os.getenv('TELEGRAM_BOT_TOKEN')
11
+ if not bot_token:
12
+ logging.error("Failed to retrieve TELEGRAM_BOT_TOKEN from environment.")
13
+ return None
14
+ return bot_token
15
16
+if __name__ == "__main__":
17
+ token = get_bot_token()
18
+ if token:
19
+ logging.info(f"Successfully retrieved bot token: {token[:4]}... (masked for security)")
20
+ else:
21
+ logging.critical("No bot token found. Exiting.")
22
+ exit(1)
0 commit comments