DEV Community

Discussion on: How to Write Integration Tests for a Telegram Bot

Collapse
 
mdaizovi profile image
Mic

I can follow this up until trying to get Telethon/PyTest to use my test bot instead of my live bot. I made a test both that runs on the same code as my live bot, splitting it up by having different .env files on local versus prod and having different Bot tokens in each file. But when I try to log in to the TelegramClient with my test bot token it tells me it's not valid and only accepts my live bot token.

Collapse
 
blueset profile image
Eana Hufwe

telethon.TelegramClient is for the user account that you use to test against the bot. If you have 2 separate bots on the Production DC (data center), there is nothing to change on the Telethon side. If your test bot is on the Test DC, you need to sign in again with some Test DC-specific arguments. More details on that can be found on Telethon docs.