Good afternoon.
Clambered all sites, but the feeling that the Chukchi fool has become so as much as possible, I decided to ask.
The problem of trifling turned to me almost a problem of the century.
The bottom line:
write a bot for Telegram in Python with subsequent placement on pythonanywhere (because it is convenient, not the point)
I have a problem with WebHook'om
itself hang webhook is:
https://api.telegram.org/bot<token>/setWebhook?url=http://username.pythonanywhere.com/</token>
BUT... I have troubles with the Flask.
How to fix the code? I do not understand how flask to make friends (so to speak) with telebot to hang webhook. Watched the documentation PyTelegramBotApi as it is too tricky, you can also easier. Or am I mistaken?
import telebot
from flask import Flask
import config
token = config.token
bot = telebot.TeleBot(token)
app = Flask(__name__)
@app.route('/')
#I KNOW THAT'S NOT ENOUGH, BUT HOW IS IT TO FINISH??
@bot.message_handler(commands=['start'])
def handle_start(message):
bot.send_message(message.from_user.id, 'HELLO!')
if __name__ == '__main__':
app.run()