mirror of
https://github.com/arkorty/B.Tech-Project-III.git
synced 2026-04-19 12:41:48 +00:00
24 lines
918 B
Python
24 lines
918 B
Python
"""Pre-check for Milestone 6: Verify bot token works before running."""
|
|
import asyncio, os, sys
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
|
|
|
async def test():
|
|
from telegram import Bot
|
|
from backend.config import TELEGRAM_BOT_TOKEN
|
|
|
|
assert TELEGRAM_BOT_TOKEN and len(TELEGRAM_BOT_TOKEN) > 10, "TELEGRAM_BOT_TOKEN not set!"
|
|
|
|
bot = Bot(token=TELEGRAM_BOT_TOKEN)
|
|
me = await bot.get_me()
|
|
print(f" ✅ Bot connected: @{me.username} ({me.first_name})")
|
|
print(f"\n IMPORTANT: Before testing in a group:")
|
|
print(f" 1. Open Telegram → Search @BotFather")
|
|
print(f" 2. Send: /setprivacy")
|
|
print(f" 3. Select @{me.username}")
|
|
print(f" 4. Choose: Disable")
|
|
print(f" 5. Create a test group, add @{me.username} to it")
|
|
print(f"\n Then run: python run_bot.py")
|
|
print(f" Send messages in the group, then try: /ask [question]")
|
|
|
|
asyncio.run(test())
|