Spaces:
Running
Running
Yurii Paniv
commited on
Commit
·
d2ca438
1
Parent(s):
a7a244e
Fix webhook resolve
Browse files
main.py
CHANGED
@@ -30,6 +30,9 @@ app.config['MAX_CONTENT_LENGTH'] = 120 * 1024
|
|
30 |
|
31 |
@app.route('/')
|
32 |
def index():
|
|
|
|
|
|
|
33 |
return render_template('hello.html')
|
34 |
|
35 |
|
@@ -44,21 +47,13 @@ def recognize():
|
|
44 |
return result
|
45 |
|
46 |
|
47 |
-
@app.route('/
|
48 |
def getMessage():
|
49 |
bot.process_new_updates(
|
50 |
[telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
|
51 |
return "!", 200
|
52 |
|
53 |
|
54 |
-
@app.route("/bot")
|
55 |
-
def webhook():
|
56 |
-
bot.remove_webhook()
|
57 |
-
bot.set_webhook(
|
58 |
-
url='https://voice-recognition-ua.herokuapp.com/bot/' + TOKEN)
|
59 |
-
return "!", 200
|
60 |
-
|
61 |
-
|
62 |
@bot.message_handler(commands=['start', 'help'])
|
63 |
def send_welcome(message):
|
64 |
bot.reply_to(message, START_MSG)
|
|
|
30 |
|
31 |
@app.route('/')
|
32 |
def index():
|
33 |
+
bot.remove_webhook()
|
34 |
+
bot.set_webhook(
|
35 |
+
url='https://voice-recognition-ua.herokuapp.com/' + TOKEN)
|
36 |
return render_template('hello.html')
|
37 |
|
38 |
|
|
|
47 |
return result
|
48 |
|
49 |
|
50 |
+
@app.route('/' + TOKEN, methods=['POST'])
|
51 |
def getMessage():
|
52 |
bot.process_new_updates(
|
53 |
[telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
|
54 |
return "!", 200
|
55 |
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
@bot.message_handler(commands=['start', 'help'])
|
58 |
def send_welcome(message):
|
59 |
bot.reply_to(message, START_MSG)
|