TeleCO2gram / backend

0 stars 0 forks source link

How do I integrate the bot into the server backend? #14

Open francescosave opened 1 week ago

francescosave commented 1 week ago

In fastAPI server add telegram add_handler manage.

With telegram bot library use a messagehandler in add_handler method.

In messagehandler add None (is equal a filters.ALL) and callback function

For documentation: https://docs.python-telegram-bot.org/en/v21.3/telegram.ext.messagehandler.html

Application = Application.builder().token('YOUR TOKEN').build()
    Application.add_handler(CommandHandler('start', start))
    Application.add_handler(MessageHandler(filters.ALL,hanle_message))
    Application.run_polling()

calback start reply when use /start command in telegram calback hanle_message reply when write any message in telegram

francescosave commented 1 week ago

how to do it in php?