Skip to content

Commit 767bb10

Browse files
committed
💻 Code: test vercel deploy
1 parent 5143628 commit 767bb10

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

bot.py

+27-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
from config import WEB_HOOK, PORT, BOT_TOKEN, update_first_buttons_message, buttons
1616

1717
from telegram.constants import ChatAction
18-
from telegram import BotCommand, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent
18+
from telegram import BotCommand, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent, Update
1919
from telegram.ext import CommandHandler, MessageHandler, ApplicationBuilder, filters, CallbackQueryHandler, Application, AIORateLimiter, InlineQueryHandler
2020

21-
2221
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
2322
logger = logging.getLogger()
2423

@@ -578,6 +577,32 @@ async def post_init(application: Application) -> None:
578577
BotCommand('reset', 'Reset the bot'),
579578
])
580579

580+
from http.server import BaseHTTPRequestHandler
581+
import json
582+
class handler(BaseHTTPRequestHandler):
583+
def do_POST(self):
584+
content_length = int(self.headers['Content-Length'])
585+
post_data = self.rfile.read(content_length).decode('utf-8')
586+
update = Update.de_json(json.loads(post_data), application.bot)
587+
588+
async def process_update(update):
589+
await application.process_update(update)
590+
591+
application.run_async(process_update(update))
592+
593+
self.send_response(200)
594+
self.end_headers()
595+
return
596+
597+
# class handler(BaseHTTPRequestHandler):
598+
# def do_POST(self):
599+
# content_length = int(self.headers['Content-Length'])
600+
# post_data = self.rfile.read(content_length).decode('utf-8')
601+
# update = Update.de_json(json.loads(post_data), application.bot)
602+
# application.process_update(update)
603+
# self.send_response(200)
604+
# self.end_headers()
605+
# return
581606
if __name__ == '__main__':
582607
time_out = 600
583608
application = (

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ pytz
33
python-dotenv
44
md2tgmd==0.1.9
55
fake_useragent
6-
ModelMerge==0.2.9
6+
ModelMerge==0.3.0
77
oauth2client==3.0.0
88
python-telegram-bot[webhooks,rate-limiter]==21.0.1

0 commit comments

Comments
 (0)