The problem is that on a paid account the function does not work from the first entry of the message. Sometimes you have to enter the message several times.
I found a similar problem on the Toaster forum, but there was no answer: link
from flask import Flask
from flask_sslify import SSLify
import telebot
token = 'your_token'
bot = telebot.TeleBot(token, threaded=False)
bot.remove_webhook()
bot.set_webhook(url="https://yourName.pythonanywhere.com/{}".format(token))
app = Flask(__name__)
sslify = SSLify(app)
@app.route('/{}'.format(token), methods=["POST"])
def webhook():
bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
return "ok", 200
@bot.message_handler(content_types=['text'])
def text(message):
if (message.text == 'test'):
msg = bot.send_message(message.chat.id, '<b>Enter any message</b>', parse_mode="HTML")
bot.register_next_step_handler(msg , test)
def test(message):
try:
bot.reply_to(message, 'It's working')
except Exception as e:
bot.reply_to(message, 'oooops')
if __name__ == '__main__':
app.run()