From c67fadf2ee8b52fd35ab576a54b20bef804a05c5 Mon Sep 17 00:00:00 2001 From: zhulinyv Date: Wed, 22 Nov 2023 18:26:34 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E7=A7=BB=E9=99=A4=E8=BF=87=E6=97=B6?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/Paimon_Chat/utils/auth_util.py | 36 ++++++------- bot.py | 1 - matcher_patch.py | 4 +- poetry.lock | 53 ++++++++++++------- pyproject.toml | 1 + .../src/tool_fetch_maa_copilot/data_source.py | 2 +- 6 files changed, 57 insertions(+), 40 deletions(-) diff --git a/LittlePaimon/plugins/Paimon_Chat/utils/auth_util.py b/LittlePaimon/plugins/Paimon_Chat/utils/auth_util.py index 615fda72..d7ef4925 100644 --- a/LittlePaimon/plugins/Paimon_Chat/utils/auth_util.py +++ b/LittlePaimon/plugins/Paimon_Chat/utils/auth_util.py @@ -5,7 +5,7 @@ from collections import defaultdict from time import time -from littlepaimon_utils import aiorequests +# from littlepaimon_utils import aiorequests from nonebot import logger from .db_util import get_cookie_cache, update_cookie_cache, delete_cookie_cache @@ -190,23 +190,23 @@ def get_sign_headers(cookie): return headers -# 检查cookie是否有效,通过查看个人主页来判断 -async def check_cookie(cookie): - url = 'https://bbs-api.mihoyo.com/user/wapi/getUserFullInfo?gids=2' - headers = { - 'DS': get_ds(), - 'Origin': 'https://webstatic.mihoyo.com', - 'Cookie': cookie, - 'x-rpc-app_version': "2.11.1", - 'x-rpc-client_type': '5', - 'Referer': 'https://webstatic.mihoyo.com/' - } - res = await aiorequests.get(url=url, headers=headers) - res = res.json() - if res['retcode'] != 0: - return False - else: - return True +# # 检查cookie是否有效,通过查看个人主页来判断 +# async def check_cookie(cookie): +# url = 'https://bbs-api.mihoyo.com/user/wapi/getUserFullInfo?gids=2' +# headers = { +# 'DS': get_ds(), +# 'Origin': 'https://webstatic.mihoyo.com', +# 'Cookie': cookie, +# 'x-rpc-app_version': "2.11.1", +# 'x-rpc-client_type': '5', +# 'Referer': 'https://webstatic.mihoyo.com/' +# } +# res = await aiorequests.get(url=url, headers=headers) +# res = res.json() +# if res['retcode'] != 0: +# return False +# else: +# return True diff --git a/bot.py b/bot.py index 11c60f75..aae705da 100644 --- a/bot.py +++ b/bot.py @@ -27,7 +27,6 @@ nonebot.load_builtin_plugins("echo") nonebot.load_plugin("nonebot_plugin_apscheduler") nonebot.load_plugin("nonebot_plugin_htmlrender") -nonebot.load_plugin("nonebot_plugin_imageutils") nonebot.load_plugin("nonebot_plugin_txt2img") nonebot.load_from_toml("pyproject.toml") nonebot.load_plugin("LittlePaimon") diff --git a/matcher_patch.py b/matcher_patch.py index 0b9eff16..1dad4b27 100644 --- a/matcher_patch.py +++ b/matcher_patch.py @@ -71,7 +71,7 @@ def _check_nickname(bot: Bot, event: MessageEvent) -> None: nickname = m[1] log("DEBUG", f"User is calling me {nickname}") event.to_me = True - first_msg_seg.data["text"] = first_text[m.end():] + # first_msg_seg.data["text"] = first_text[m.end():] nonebot.on_command = on_command_ @@ -79,4 +79,4 @@ def _check_nickname(bot: Bot, event: MessageEvent) -> None: nonebot.on_startswith = on_startswith_ nonebot.on_endswith = on_endswith_ nonebot.on_keyword = on_keyword_ -v11.bot._check_nickname = _check_nickname \ No newline at end of file +# v11.bot._check_nickname = _check_nickname diff --git a/poetry.lock b/poetry.lock index 4d4f79be..cdb93451 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "aiocache" @@ -1968,16 +1968,6 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -2697,7 +2687,14 @@ files = [ ] [package.dependencies] -numpy = {version = ">=1.22.0", markers = "python_version >= \"3.11\""} +numpy = [ + {version = ">=1.21.2", markers = "python_version >= \"3.10\""}, + {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\""}, + {version = ">=1.22.0", markers = "python_version >= \"3.11\""}, + {version = ">=1.19.3", markers = "python_version >= \"3.6\" and platform_system == \"Linux\" and platform_machine == \"aarch64\" or python_version >= \"3.9\""}, + {version = ">=1.17.0", markers = "python_version >= \"3.7\""}, + {version = ">=1.17.3", markers = "python_version >= \"3.8\""}, +] [[package]] name = "opencv-python-headless" @@ -2717,8 +2714,11 @@ files = [ [package.dependencies] numpy = [ - {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\" and python_version < \"3.11\""}, - {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\" and python_version < \"3.11\""}, + {version = ">=1.21.2", markers = "python_version >= \"3.10\""}, + {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\""}, + {version = ">=1.19.3", markers = "python_version >= \"3.6\" and platform_system == \"Linux\" and platform_machine == \"aarch64\" or python_version >= \"3.9\""}, + {version = ">=1.17.0", markers = "python_version >= \"3.7\""}, + {version = ">=1.17.3", markers = "python_version >= \"3.8\""}, ] [[package]] @@ -2852,8 +2852,8 @@ files = [ [package.dependencies] numpy = [ + {version = ">=1.21.0", markers = "python_version >= \"3.10\""}, {version = ">=1.23.2", markers = "python_version >= \"3.11\""}, - {version = ">=1.21.0", markers = "python_version >= \"3.10\" and python_version < \"3.11\""}, ] python-dateutil = ">=2.8.1" pytz = ">=2020.1" @@ -3005,6 +3005,20 @@ files = [ docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-removed-in", "sphinxext-opengraph"] tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] +[[package]] +name = "ping3" +version = "4.0.4" +description = "A pure python3 version of ICMP ping implementation using raw socket." +optional = false +python-versions = ">=3" +files = [ + {file = "ping3-4.0.4-py3-none-any.whl", hash = "sha256:dd8439ced69d6fec5885c8d4faefb055aacffb5a20f5e38a78459a5b18cc5e5a"}, + {file = "ping3-4.0.4.tar.gz", hash = "sha256:1ea12acf6752d4666616341fd7c6393c664cffc510c693ef06f736fb267a13ba"}, +] + +[package.extras] +dev = ["build", "pycodestyle", "wheel"] + [[package]] name = "platformdirs" version = "2.6.2" @@ -4292,8 +4306,11 @@ files = [ [package.dependencies] aiosqlite = {version = "*", optional = true, markers = "extra == \"aiosqlite\""} -greenlet = {version = "!=0.4.17", optional = true, markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\" or extra == \"aiosqlite\""} -typing-extensions = {version = ">=4.2.0", optional = true, markers = "extra == \"aiosqlite\""} +greenlet = {version = "!=0.4.17", optional = true, markers = "platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\" or extra == \"aiosqlite\""} +typing-extensions = [ + {version = ">=4.2.0"}, + {version = "!=3.10.0.1", optional = true, markers = "extra == \"aiosqlite\""}, +] [package.extras] aiomysql = ["aiomysql", "greenlet (!=0.4.17)"] @@ -5268,4 +5285,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "ae2a182700e77b415b1cd2856e596d2f23ae42c276dbafc20e09b09d6e136f43" +content-hash = "1bb6f7d886f31fb399ba8c88b058a5de13e23c2e9278d0283f6146f02802c6a3" diff --git a/pyproject.toml b/pyproject.toml index 31d2fc63..df514451 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,6 +132,7 @@ ujson = "5.5.0" urllib3 = "1.26.12" win32-setctime = "1.1.0" wordcloud = "1.8.2.2" +ping3 = "^4.0.4" [tool.nonebot] plugins = ["nonebot_plugin_gocqhttp", "nonebot_plugin_guild_patch"] diff --git a/src/plugins/nonebot_plugin_arktools/src/tool_fetch_maa_copilot/data_source.py b/src/plugins/nonebot_plugin_arktools/src/tool_fetch_maa_copilot/data_source.py index 98a61187..ab4c6aa0 100644 --- a/src/plugins/nonebot_plugin_arktools/src/tool_fetch_maa_copilot/data_source.py +++ b/src/plugins/nonebot_plugin_arktools/src/tool_fetch_maa_copilot/data_source.py @@ -6,7 +6,7 @@ import httpx from nonebot import logger -from nonebot_plugin_imageutils import text2image +from pil_utils import text2image from ..core.database.plugin_sqlite import MAACopilotSubsModel from ..exceptions import MAAFailedResponseException, MAANoResultException