Forums

Pythonanywhere Flask pyTelegrambotapi

My code doesn't work, is there any solution? Please help, I'm a begginer...

import telebot from telebot import types from flask import Flask, request import config

token = config.TOKEN URL = 'https://api.telegram.org/bot<My TOKEN>/'

bot = telebot.TeleBot(token, threaded=False) bot.remove_webhook() bot.set_webhook(url=URL)

app = Flask(name)

@app.route('/', methods=['POST']) def webhook(): update = telebot.types.Update.de_json(request.stream.read().decode('utf-8')) bot.process_new_updates([update]) return 'ok', 200

@bot.message_handler(commands=["start"]) def main(message): markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2) but_main = types.KeyboardButton('/Main_Menu') markup.add(but_main) bot.send_message(message.chat.id, message.from_user.first_name + " " + message.from_user.last_name + "<My text>", reply_markup=markup)

How does it not work? Do you get an error? What is it?