eternnoir / pyTelegramBotAPI

Python Telegram bot api.
GNU General Public License v2.0
8.12k stars 2.03k forks source link

Weebhook on heroku dont working #432

Closed andry-lebedev closed 6 years ago

andry-lebedev commented 6 years ago

After deploying on heroku bot don't answer. Was trying as in example with flask.

  1. What version of pyTelegramBotAPI are you using? pyTelegramBotAPI==3.2.1
  2. What OS are you using? osx
  3. What version of python are you using? last one Its looks like all is ok, but bot is't responding. My code:
    
    import os
    import telebot
    from flask import Flask, request

token = os.environ['TELEGRAM_TOKEN']

bot = telebot.TeleBot(token)

server = Flask(name)

hadlers

and in the end

@server.route("/", 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.com//somename.herokuapp.com/bot") return "!", 200

server.run(host="0.0.0.0", port=int(os.environ.get('PORT', 5000))) server = Flask(name)



In the console on heroku I have: ` Running on http://0.0.0.0:16845/ (Press CTRL+C to quit)`
ghost commented 6 years ago

@WTFisThat1 I have the same error. I'm looking for a solution. We are waiting for the answer from the developer.

eternnoir commented 6 years ago

Dose your getMessage() method receive any request?

ghost commented 6 years ago

@eternnoir

@bot.message_handler(func=lambda message: True)
def delete_massage_user(message):
        bot.delete_message(message.chat.id, message.message_id)

At me here such method. Deletes all incoming messages in the supergroup. But it's not that. And the fact that the bot does not even run on Heroku.

heyyyoyy commented 6 years ago

@WTFisThat1 you have not valid address in the set_webhook https.com//somename.herokuapp.com/bot and check getWebhookinfo