mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-13 07:50:00 +08:00
🎨 签到优化与配置修改
This commit is contained in:
@@ -5,7 +5,7 @@ from nonebot import get_driver
|
||||
from playwright.__main__ import main
|
||||
from playwright.async_api import Browser, Playwright, async_playwright
|
||||
|
||||
from zhenxun.configs.config import SYSTEM_PROXY
|
||||
from zhenxun.configs.config import BotConfig
|
||||
from zhenxun.services.log import logger
|
||||
|
||||
driver = get_driver()
|
||||
@@ -45,12 +45,12 @@ def install():
|
||||
os.environ["PLAYWRIGHT_DOWNLOAD_HOST"] = (
|
||||
"https://npmmirror.com/mirrors/playwright/"
|
||||
)
|
||||
if SYSTEM_PROXY:
|
||||
os.environ["HTTPS_PROXY"] = SYSTEM_PROXY
|
||||
if BotConfig.system_proxy:
|
||||
os.environ["HTTPS_PROXY"] = BotConfig.system_proxy
|
||||
|
||||
def restore_env_variables():
|
||||
os.environ.pop("PLAYWRIGHT_DOWNLOAD_HOST", None)
|
||||
if SYSTEM_PROXY:
|
||||
if BotConfig.system_proxy:
|
||||
os.environ.pop("HTTPS_PROXY", None)
|
||||
if original_proxy is not None:
|
||||
os.environ["HTTPS_PROXY"] = original_proxy
|
||||
|
||||
@@ -13,7 +13,7 @@ from nonebot_plugin_htmlrender import get_browser
|
||||
from playwright.async_api import Page
|
||||
from retrying import retry
|
||||
|
||||
from zhenxun.configs.config import SYSTEM_PROXY
|
||||
from zhenxun.configs.config import BotConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.user_agent import get_user_agent
|
||||
@@ -23,7 +23,7 @@ from zhenxun.utils.user_agent import get_user_agent
|
||||
|
||||
class AsyncHttpx:
|
||||
|
||||
proxy = {"http://": SYSTEM_PROXY, "https://": SYSTEM_PROXY}
|
||||
proxy = {"http://": BotConfig.system_proxy, "https://": BotConfig.system_proxy}
|
||||
|
||||
@classmethod
|
||||
@retry(stop_max_attempt_number=3)
|
||||
|
||||
@@ -5,7 +5,7 @@ import nonebot
|
||||
from nonebot.adapters.onebot.v11 import Message, MessageSegment
|
||||
from nonebot_plugin_alconna import At, Image, Text, UniMessage
|
||||
|
||||
from zhenxun.configs.config import NICKNAME
|
||||
from zhenxun.configs.config import BotConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils._build_image import BuildImage
|
||||
|
||||
@@ -81,7 +81,7 @@ class MessageUtils:
|
||||
cls,
|
||||
msg_list: list[str | Message],
|
||||
uin: str,
|
||||
name: str = f"这里是{NICKNAME}",
|
||||
name: str = f"这里是{BotConfig.nickname}",
|
||||
) -> list[dict]:
|
||||
"""生成自定义合并消息
|
||||
|
||||
|
||||
Reference in New Issue
Block a user