from flask import Flask, request
import telebot
from telebot import types
import time
#secret = "token"
secret = "token"
bot = telebot.TeleBot('token', threaded=False)
#bot = telebot.TeleBot('token', threaded=False)
bot.remove_webhook()
time.sleep(1)
bot.set_webhook(url="
https://ZigZagER.pythonanywhere.com/{}".format(secret))
#bot.set_webhook(url="
https://204a10e8.ngrok.io/{}".format(secret))
app = Flask(
name)
@app.route('/{}'.format(secret), methods=['POST'])
def webhook():
bot.process_new_updates([telebot.types.Update.de_json(
request.stream.read().decode("utf-8"))])
print("Message")
return "ok", 200
@app.route('/', methods=['GET'])
def index():
return '<h1>Ты как блять это нашел? Пес ебаный</h1>'
@bot.message_handler(commands=['start'])
def startCommand(message):
bot.send_message(
message.chat.id, 'Привет *' + message.chat.first_name + '*\nЭто будет мой новый бот' , parse_mode='Markdown', reply_markup=types.ReplyKeyboardRemove())
'''Всякие элементы'''
keys = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=1)
key1 = types.KeyboardButton('id')
key2 = types.KeyboardButton('test')
key3 = types.KeyboardButton('/start')
keys.add(key1, key2, key3)
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
if message.text == 'id':
ids =
message.chat.id msg = 'Ваш TG id = ' + str(ids)
bot.send_message(
message.chat.id, msg)
elif message.text == 'test':
if
message.chat.id == 690950700:
bot.send_message(
message.chat.id, text='Вы слишком крут')
else:
bot.send_message(
message.chat.id, text='Атсаси чмошник')
elif message.text == 'key':
bot.send_message(
message.chat.id, text='Вот', reply_markup=keys)
if
name == '
main':
app.run()