import flask
from flask import Flask, request
import telebot
from telebot import types
bot = telebot.TeleBot('***')
app = Flask(__name__)
bot.set_webhook('https://***.ngrok.io')
@app.route('/', methods=['POST'])
def webhook():
if flask.request.headers.get('content-type') == 'application/json':
json_string = flask.request.get_data().decode('utf-8')
update = telebot.types.Update.de_json(json_string)
bot.process_new_updates([update])
return ''
else:
flask.abort(403)
@bot.message_handler(commands=['start'])
def start(message):
buy = types.InlineKeyboardMarkup()
buyButton = types.InlineKeyboardButton(text='ответ')
buy.add(buyButton)
bot.send_message(message.chat.id, 'Привет!', reply_markup=buyButton)
if __name__ == "__main__":
app.run()