Advertisement
Guest User

Untitled

a guest
Jul 30th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. proxy_url = "http://proxy.server:3128"
  2. telepot.api._pools = {
  3.     'default': urllib3.ProxyManager(proxy_url=proxy_url, num_pools=3, maxsize=10, retries=False, timeout=30),
  4. }
  5. telepot.api._onetime_pool_spec = (urllib3.ProxyManager, dict(proxy_url=proxy_url, num_pools=1, maxsize=1, retries=False, timeout=30))
  6.  
  7. secret = "ключ"
  8. bot = telepot.Bot('токен')
  9. bot.setWebhook("https://ganduras3.pythonanywhere.com/{}".format(secret), max_connections=100000000)
  10.  
  11. app = Flask(__name__)
  12.  
  13. @app.route('/{}'.format(secret), methods=["POST"])
  14. def telegram_webhook():
  15.     update = request.get_json()
  16.     if "message" in update:
  17.         text = update["message"]["text"]
  18.         chat_id = update["message"]["chat"]["id"]
  19.         if text == '/start':
  20.             bot.sendMessage(chat_id, 'здравствуйте...')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement