Skip to content

Instantly share code, notes, and snippets.

@alages97
Created April 17, 2020 17:00
Show Gist options
  • Save alages97/af6b92f6d54192ffb79ad3658576aa38 to your computer and use it in GitHub Desktop.
Save alages97/af6b92f6d54192ffb79ad3658576aa38 to your computer and use it in GitHub Desktop.
@server.route('/' + TOKEN, 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='https://<insert heroku app name here>.herokuapp.com/' + TOKEN)
return "!", 200
if __name__ == "__main__":
server.run(host="0.0.0.0", port=int(os.environ.get('PORT', 5000)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment