V
V
Viva88882021-07-13 16:51:18
Python
Viva8888, 2021-07-13 16:51:18

Why doesn't the Python bot compile?

Error Connection pool of Request object is smaller than optimal value (8)

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
from config import TG_TOKEN


def start_function(bot: Bot, update: Update):
    bot.send_message(
        chat_id = update.message.chat_id,
        text = "Привет",
    )

def show_text(bot: Bot, update: Update):
    text = update.message.text
    bot.send_message(
        chat_id = update.message.chat_id,
        text = text,
    )
def main():
    bot = Bot(token = TG_TOKEN,)
    updater = Updater(bot = bot)
    start_handler = CommandHandler('start', start_function)
    message_handler = MessageHandler(Filters.text, show_text)

    updater.dispatcher.add_handler(start_handler)
    updater.dispatcher.add_handler(message_handler)

    updater.start_polling()
    updater.idle()

if __name__ == '__main__':
    main()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question