Skip to content

Commit c9abea2

Browse files
committed
Docker build files & setup
1 parent bd3dafc commit c9abea2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/extras/bot_token_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)