refactor, clear structure

This commit is contained in:
2024-06-23 22:06:27 +08:00
parent cade370538
commit c1c1d42892
7 changed files with 32 additions and 32 deletions
+2 -17
View File
@@ -1,9 +1,8 @@
import logging
import os
import re
try:
import uvloop, asyncio
import uvloop
import asyncio
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError:
@@ -20,17 +19,3 @@ if WEBHOOK:
WEBHOOK_KEY = os.getenv("WEBHOOK_KEY", "cert/private.key")
WEBHOOK_CERT = os.getenv("WEBHOOK_CERT", "cert/cert.pem")
WEBHOOK_SECRET_TOKEN = os.getenv("WEBHOOK_SECRET_TOKEN")
x_url_regex = re.compile(r"^(?:https?://)(?:www\.|mobile\.|)(?:x|twitter|fixvx|vxtwitter)\.com/(.+)/status/(\d+)")
x_media_regex = re.compile(r"^(?:https?://)(pbs|video)\.twimg\.com/(.*)")
x_tco_regex = re.compile(r"(?:https?://)t\.co/.+$", re.M)
message_url_regex = re.compile(r"\[.+]", re.S)
logging.basicConfig(
level=os.getenv("LOG_LEVEL", "WARNING"),
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
def get_logger(name: str) -> logging.Logger:
return logging.getLogger(name)