def set_webhook(): if request.method == "POST": bot.remove_webhook() bot.set_webhook(url=config.url) return "Webhook set successful", 200 else: return f"Get to the main page. <a href=\"/\">Main page</a>", 400
def webhook(): bot.remove_webhook() bot.set_webhook( url= f'https://catch-wildfire-telegram-bot.herokuapp.com/{TELEGRAM_BOT_TOKEN}' ) return "!", 200
def set_webhook(): bot.remove_webhook() s = bot.set_webhook(WEBHOOK_URL) if s: print(s) return "webhook setup ok" else: return "webhook setup failed"
def remove_webhook(): if request.method == "POST": passwd = bytes(request.form["password"], encoding="utf-8") hashwd = hashlib.md5(passwd).hexdigest() if hashwd == "5b4ae01462b2930e129e31636e2fdb68": bot.remove_webhook() return "Webhook removed successful", 200 else: return "Bad password", 401 else: return "Get to the main page and enter password " \ "in the appropriate form. <a href=\"/\">Main page</a>", 400
def index(): bot.remove_webhook() bot.set_webhook(url="https://{}.herokuapp.com/{}".format( config.APP_NAME, config.API_TOKEN)) return "Hello from Heroku!", 200
def webhook(): bot.remove_webhook() bot.set_webhook(url=config.boturi + config.token) return "!", 200
def webhook(): bot.remove_webhook() bot.set_webhook(url=os.environ["APP_URL"] + TTOKEN) return "!", 200
import os import telebot from flask import Flask, request from bot import bot from bot.static import TTOKEN if "webhooks" in list(os.environ.keys()): server = Flask(__name__) @server.route(f"/{TTOKEN}", methods=['POST']) def getMessage(): bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))]) return "!", 200 @server.route("/") def webhook(): bot.remove_webhook() bot.set_webhook(url=os.environ["APP_URL"] + TTOKEN) return "!", 200 server.run(host="0.0.0.0", port=os.environ.get('PORT', 5000)) else: bot.remove_webhook() bot.polling()
def st_webhook(): bot.remove_webhook() bot.set_webhook(CONFIG.SERVER_URL + CONFIG.TOKEN) return "!",
def webhook(): bot.remove_webhook() bot.set_webhook(url="https://{}.glitch.me/{}".format( environ['PROJECT_NAME'], environ['TELEGRAM_TOKEN'])) return "!", 200
def remove_web_hook(): bot.remove_webhook() return "!", 200
def webhook(): bot.remove_webhook() bot.set_webhook(url=constants.heroku_url + constants.token) return "Hello from Heroku!", 200
def webhook(): url = f'https://mmozgov-python-weather-bot.herokuapp.com/weather_bot{BOT_TOKEN}' bot.remove_webhook() bot.set_webhook(url=url) return 'OK', 200
def webhook(): bot.remove_webhook() bot.set_webhook(url='https://cuba-weather.herokuapp.com/' + config.token) return "!", 200
def rm_webhook(): bot.remove_webhook() return "!",
def web_hook(): bot.remove_webhook() bot.set_webhook(url='https://lit-eyrie-94912.herokuapp.com/web_hook/' + Config.TELEGRAM_TOKEN) return "!", 200
def index(): bot.remove_webhook() bot.set_webhook(url="https://{}.herokuapp.com/{}".format(app_name, token)) return "Hello from bot!", 200
def web_hook(): vk_bot.remove_webhook() vk_bot.set_webhook(url='https://vkfilebot.herokuapp.com/' + constants.TOKEN_TELEGRAM) return "CONNECTED" + "\n Contact " + "<a href=" + "https://t.me/daniel_nikulin" + ">" + "Daniel" + "<a>", 200
import cherrypy import config from bot import bot from server import WebhookServer bot.remove_webhook() bot.set_webhook(url="https://{}:{}/{}/".format(config.SERVER_IP, config.WEBHOOK_PORT, config.TOKEN, ), certificate=open(config.WEBHOOK_SSL_CERT, 'r')) cherrypy.config.update({ 'server.socket_host': config.WEBHOOK_LISTEN, 'server.socket_port': config.WEBHOOK_PORT, 'server.ssl_module': 'builtin', 'server.ssl_certificate': config.WEBHOOK_SSL_CERT, 'server.ssl_private_key': config.WEBHOOK_SSL_PRIV }) cherrypy.quickstart(WebhookServer(bot), "/{}/".format(config.TOKEN), {'/': {}})
def webhook(): """Set telebot webhook.""" bot.remove_webhook() bot.set_webhook(url="{}{}".format(APP_URL, TOKEN)) return "Succsess! Webhook is thrown"
def reset_webhook(): bot.remove_webhook() bot.set_webhook(url=webhook_url_base + webhook_url_path) return "OK", 200