From cfdb05e47616e8ecbf56009d83128ebd88e2911f Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Thu, 20 Jun 2024 01:41:40 +0800 Subject: [PATCH] add use uvloop --- common.py | 7 +++++++ requirements.txt | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common.py b/common.py index b03d889..92fa417 100644 --- a/common.py +++ b/common.py @@ -2,6 +2,13 @@ import logging import os import re +try: + import uvloop, asyncio + + asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) +except ImportError: + uvloop = None + BOT_TOKEN = os.getenv("BOT_TOKEN") ADMIN = [int(i) for i in os.getenv("BOT_ADMIN").split(",")] diff --git a/requirements.txt b/requirements.txt index 52d2bcd..5317463 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ python-telegram-bot[webhooks]~=21.3 -httpx[http2]~=0.27.0 \ No newline at end of file +httpx[http2]~=0.27.0 +uvloop~=0.19.0; sys_platform != 'win32' \ No newline at end of file