Hello I provided a bot using the webhook feature and creating a flask_app.py. I ran the flask_app.py and no error message was appeared. but when I reload the flask_app.py, the bot doesn't work, Despite the fact that the bot is working in normal mode (no webhook) in vs code properly.
Can you give me some advice? I did not delete TOKEN and you can examine it.
Here is the flask_app.py I created:
from flask import Flask, request
import urllib3
import telepot
from telepot.loop import MessageLoop
import time
proxy_url = "http://proxy.server:3128"
telepot.api._pools = {
'default': urllib3.ProxyManager(proxy_url=proxy_url, num_pools=3, maxsize=10, retries=False, timeout=30),
}
telepot.api._onetime_pool_spec = (urllib3.ProxyManager, dict(proxy_url=proxy_url, num_pools=1, maxsize=1, retries=False, timeout=30))
secret = "[REDACTED]"
bot = telepot.Bot('[REDACTED]')
bot.setWebhook("https://frdgolestan.pythonanywhere.com/{}".format(secret), max_connections=1)
app = Flask(__name__)
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
if content_type == 'text':
command = msg['text']
if command == '/start':
bot.sendMessage(chat_id, 'Hello.')
I appreciate your help in advance.
[edit by admin: formatting]