Не работает telegram бот
Мой код:
from telegram import Bot
from telegram import Update
from telegram.ext import Updater
from telegram.ext import CommandHandler
from telegram.ext import MessageHandler
from telegram.ext import Filters
TG_TOKEN = "токен"
TG_API_URL = "https://telegg.ru/orig/bot"
def do_start(update: Update, bot):
bot.send_message(
chat_id=update.effective_chat.id,
text='Hello world',
)
def do_echo(update: Update, bot):
text = update.message.text
bot.send_message(
chat_id=update.effective_chat.id,
text=text,
)
def main():
bot = Bot(
token = TG_TOKEN,
base_url = TG_API_URL,
)
updater = Updater(
bot=bot,
)
start_handler = CommandHandler('start', do_start)
message_handler = MessageHandler(Filters.text, do_echo)
updater.dispatcher.add_handler(start_handler)
updater.dispatcher.add_handler(message_handler)
updater.start_polling()
updater.idle()
if __name__ == "__main__":
main()
При запуске не возникает никаких ошибок, но код запускается и тут за заканчивает исполнение, хотя он должен запуститься и ждать. В чем проблема?
python 3.7.5 64-bit OS: Ubuntu