import logging from telegram.ext import Updater logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') class Bot: def __init__(self, token): self.updater = Updater(token=token, use_context=True) self.dispatcher = self.updater.dispatcher def cmd_start(self, update, context): context.bot.send_message(chat_id=update.effective_chat.id, text=f'Hi! effective_chat.id={update.effective_chat.id}') def run(self): self.updater.start_polling() if __name__ == '__main__': b = Bot('TOKEN') b.run()