mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-12 06:55:49 +08:00
🐛 修复报错后无法正确响应命令
This commit is contained in:
parent
bbcb739ba9
commit
0579aadc7b
@ -7,14 +7,11 @@ from typing import List, Union, Literal
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from gsuid_core.models import Message
|
from gsuid_core.models import Message
|
||||||
from gsuid_core.config import core_config
|
|
||||||
from gsuid_core.data_store import image_res
|
from gsuid_core.data_store import image_res
|
||||||
from gsuid_core.utils.plugins_config.gs_config import core_plugins_config
|
from gsuid_core.utils.plugins_config.gs_config import core_plugins_config
|
||||||
|
|
||||||
pic_srv = core_plugins_config.get_config('EnablePicSrv').data
|
enable_pic_srv = core_plugins_config.get_config('EnablePicSrv').data
|
||||||
HOST = core_config.get_config('HOST')
|
pic_srv = core_plugins_config.get_config('PicSrv').data
|
||||||
PORT = int(core_config.get_config('PORT'))
|
|
||||||
_HOST = '127.0.0.1' if HOST == 'localhost' else HOST
|
|
||||||
|
|
||||||
|
|
||||||
class MessageSegment:
|
class MessageSegment:
|
||||||
@ -41,11 +38,11 @@ class MessageSegment:
|
|||||||
with open(img, 'rb') as fp:
|
with open(img, 'rb') as fp:
|
||||||
img = fp.read()
|
img = fp.read()
|
||||||
|
|
||||||
if pic_srv:
|
if enable_pic_srv:
|
||||||
name = f'{uuid.uuid1()}.jpg'
|
name = f'{uuid.uuid1()}.jpg'
|
||||||
path = image_res / name
|
path = image_res / name
|
||||||
path.write_bytes(img)
|
path.write_bytes(img)
|
||||||
data = f'{_HOST}:{PORT}/genshinuid/image/{name}'
|
data = f'{pic_srv}/genshinuid/image/{name}'
|
||||||
else:
|
else:
|
||||||
data = f'base64://{b64encode(img).decode()}'
|
data = f'base64://{b64encode(img).decode()}'
|
||||||
|
|
||||||
|
@ -29,10 +29,12 @@ config_sv = core_config.get_config('sv')
|
|||||||
def modify_func(func):
|
def modify_func(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
async def wrapper(bot: Bot, event: Event):
|
async def wrapper(bot: Bot, event: Event):
|
||||||
result = await func(bot, event)
|
try:
|
||||||
instancess = Bot.get_instances()
|
result = await func(bot, event)
|
||||||
if bot.uuid in instancess:
|
finally:
|
||||||
instancess.pop(bot.uuid)
|
instancess = Bot.get_instances()
|
||||||
|
if bot.uuid in instancess:
|
||||||
|
instancess.pop(bot.uuid)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
@ -60,4 +60,5 @@ CONIFG_DEFAULT: Dict[str, GSC] = {
|
|||||||
'SpecificMsgId': GsStrConfig('特殊返回消息ID', '如不知道请勿填写', ''),
|
'SpecificMsgId': GsStrConfig('特殊返回消息ID', '如不知道请勿填写', ''),
|
||||||
'AutoUpdateDep': GsBoolConfig('自动更新依赖', '更新插件时将会自动更新依赖', False),
|
'AutoUpdateDep': GsBoolConfig('自动更新依赖', '更新插件时将会自动更新依赖', False),
|
||||||
'EnablePicSrv': GsBoolConfig('将图片转链接发送(需公网)', '发送图片转链接', False),
|
'EnablePicSrv': GsBoolConfig('将图片转链接发送(需公网)', '发送图片转链接', False),
|
||||||
|
'PicSrv': GsStrConfig('将图片转链接发送(需公网)', '发送图片转链接', ''),
|
||||||
}
|
}
|
||||||
|
41
poetry.lock
generated
41
poetry.lock
generated
@ -941,18 +941,21 @@ reference = "mirrors"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gitpython"
|
name = "gitpython"
|
||||||
version = "3.1.35"
|
version = "3.1.36"
|
||||||
description = "GitPython is a Python library used to interact with Git repositories"
|
description = "GitPython is a Python library used to interact with Git repositories"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "GitPython-3.1.35-py3-none-any.whl", hash = "sha256:c19b4292d7a1d3c0f653858db273ff8a6614100d1eb1528b014ec97286193c09"},
|
{file = "GitPython-3.1.36-py3-none-any.whl", hash = "sha256:8d22b5cfefd17c79914226982bb7851d6ade47545b1735a9d010a2a4c26d8388"},
|
||||||
{file = "GitPython-3.1.35.tar.gz", hash = "sha256:9cbefbd1789a5fe9bcf621bb34d3f441f3a90c8461d377f84eda73e721d9b06b"},
|
{file = "GitPython-3.1.36.tar.gz", hash = "sha256:4bb0c2a6995e85064140d31a33289aa5dce80133a23d36fcd372d716c54d3ebf"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
gitdb = ">=4.0.1,<5"
|
gitdb = ">=4.0.1,<5"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mypy", "pre-commit", "pytest", "pytest-cov", "pytest-sugar", "virtualenv"]
|
||||||
|
|
||||||
[package.source]
|
[package.source]
|
||||||
type = "legacy"
|
type = "legacy"
|
||||||
url = "https://mirrors.bfsu.edu.cn/pypi/web/simple"
|
url = "https://mirrors.bfsu.edu.cn/pypi/web/simple"
|
||||||
@ -1058,13 +1061,13 @@ reference = "mirrors"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httpcore"
|
name = "httpcore"
|
||||||
version = "0.17.3"
|
version = "0.18.0"
|
||||||
description = "A minimal low-level HTTP client."
|
description = "A minimal low-level HTTP client."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "httpcore-0.17.3-py3-none-any.whl", hash = "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87"},
|
{file = "httpcore-0.18.0-py3-none-any.whl", hash = "sha256:adc5398ee0a476567bf87467063ee63584a8bce86078bf748e48754f60202ced"},
|
||||||
{file = "httpcore-0.17.3.tar.gz", hash = "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888"},
|
{file = "httpcore-0.18.0.tar.gz", hash = "sha256:13b5e5cd1dca1a6636a6aaea212b19f4f85cd88c366a2b82304181b769aab3c9"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -1084,18 +1087,18 @@ reference = "mirrors"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httpx"
|
name = "httpx"
|
||||||
version = "0.24.1"
|
version = "0.25.0"
|
||||||
description = "The next generation HTTP client."
|
description = "The next generation HTTP client."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "httpx-0.24.1-py3-none-any.whl", hash = "sha256:06781eb9ac53cde990577af654bd990a4949de37a28bdb4a230d434f3a30b9bd"},
|
{file = "httpx-0.25.0-py3-none-any.whl", hash = "sha256:181ea7f8ba3a82578be86ef4171554dd45fec26a02556a744db029a0a27b7100"},
|
||||||
{file = "httpx-0.24.1.tar.gz", hash = "sha256:5853a43053df830c20f8110c5e69fe44d035d850b2dfe795e196f00fdb774bdd"},
|
{file = "httpx-0.25.0.tar.gz", hash = "sha256:47ecda285389cb32bb2691cc6e069e3ab0205956f681c5b2ad2325719751d875"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
certifi = "*"
|
certifi = "*"
|
||||||
httpcore = ">=0.15.0,<0.18.0"
|
httpcore = ">=0.18.0,<0.19.0"
|
||||||
idna = "*"
|
idna = "*"
|
||||||
sniffio = "*"
|
sniffio = "*"
|
||||||
|
|
||||||
@ -1112,13 +1115,13 @@ reference = "mirrors"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "identify"
|
name = "identify"
|
||||||
version = "2.5.27"
|
version = "2.5.28"
|
||||||
description = "File identification library for Python"
|
description = "File identification library for Python"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "identify-2.5.27-py2.py3-none-any.whl", hash = "sha256:fdb527b2dfe24602809b2201e033c2a113d7bdf716db3ca8e3243f735dcecaba"},
|
{file = "identify-2.5.28-py2.py3-none-any.whl", hash = "sha256:87816de144bf46d161bd5b3e8f5596b16cade3b80be537087334b26bc5c177f3"},
|
||||||
{file = "identify-2.5.27.tar.gz", hash = "sha256:287b75b04a0e22d727bc9a41f0d4f3c1bcada97490fa6eabb5b28f0e9097e733"},
|
{file = "identify-2.5.28.tar.gz", hash = "sha256:94bb59643083ebd60dc996d043497479ee554381fbc5307763915cda49b0e78f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@ -2013,19 +2016,19 @@ reference = "mirrors"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "setuptools"
|
name = "setuptools"
|
||||||
version = "68.2.0"
|
version = "68.2.2"
|
||||||
description = "Easily download, build, install, upgrade, and uninstall Python packages"
|
description = "Easily download, build, install, upgrade, and uninstall Python packages"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "setuptools-68.2.0-py3-none-any.whl", hash = "sha256:af3d5949030c3f493f550876b2fd1dd5ec66689c4ee5d5344f009746f71fd5a8"},
|
{file = "setuptools-68.2.2-py3-none-any.whl", hash = "sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a"},
|
||||||
{file = "setuptools-68.2.0.tar.gz", hash = "sha256:00478ca80aeebeecb2f288d3206b0de568df5cd2b8fada1209843cc9a8d88a48"},
|
{file = "setuptools-68.2.2.tar.gz", hash = "sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"]
|
docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"]
|
||||||
testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
|
testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
|
||||||
testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"]
|
testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"]
|
||||||
|
|
||||||
[package.source]
|
[package.source]
|
||||||
type = "legacy"
|
type = "legacy"
|
||||||
|
@ -24,11 +24,11 @@ fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_versio
|
|||||||
fastapi==0.97.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
fastapi==0.97.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
gitpython==3.1.35 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
gitpython==3.1.36 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
greenlet==2.0.2 ; python_full_version >= "3.8.1" and (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") and python_full_version < "4.0.0"
|
greenlet==2.0.2 ; python_full_version >= "3.8.1" and (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") and python_full_version < "4.0.0"
|
||||||
h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
httpcore==0.17.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
httpcore==0.18.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
httpx==0.24.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
httpx==0.25.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
idna==3.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
idna==3.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
loguru==0.6.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
loguru==0.6.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
lxml==4.9.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
lxml==4.9.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user