measmonysuon commited on
Commit
72ca871
·
verified ·
1 Parent(s): 1a43463

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py CHANGED
@@ -1,19 +1,9 @@
1
  from flask import Flask, request
2
  import telebot
3
- import logging
4
 
5
- # Configuration
6
  BOT_TOKEN = '7484321656:AAFaswxTqaSHu_s4jd_pk2Q2OJJWYcWHwAM'
7
- WEBHOOK_URL = 'https://measmonysuon-flyingbird.hf.space/bot' + BOT_TOKEN
8
-
9
- # Initialize the bot
10
  bot = telebot.TeleBot(BOT_TOKEN)
11
 
12
- # Configure logging
13
- logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
14
- logger = logging.getLogger(__name__)
15
-
16
- # Flask app setup
17
  app = Flask(__name__)
18
 
19
  @app.route(f'/bot{BOT_TOKEN}', methods=['POST'])
@@ -23,16 +13,5 @@ def webhook():
23
  bot.process_new_updates([update])
24
  return 'ok', 200
25
 
26
- def set_webhook():
27
- try:
28
- # Remove any previous webhook
29
- bot.remove_webhook()
30
- # Set the new webhook
31
- bot.set_webhook(url=WEBHOOK_URL)
32
- logger.info("Webhook set successfully.")
33
- except Exception as e:
34
- logger.error(f"Failed to set webhook: {e}")
35
-
36
  if __name__ == "__main__":
37
- set_webhook()
38
  app.run(host='0.0.0.0', port=5000)
 
1
  from flask import Flask, request
2
  import telebot
 
3
 
 
4
  BOT_TOKEN = '7484321656:AAFaswxTqaSHu_s4jd_pk2Q2OJJWYcWHwAM'
 
 
 
5
  bot = telebot.TeleBot(BOT_TOKEN)
6
 
 
 
 
 
 
7
  app = Flask(__name__)
8
 
9
  @app.route(f'/bot{BOT_TOKEN}', methods=['POST'])
 
13
  bot.process_new_updates([update])
14
  return 'ok', 200
15
 
 
 
 
 
 
 
 
 
 
 
16
  if __name__ == "__main__":
 
17
  app.run(host='0.0.0.0', port=5000)