新增原图(回复触发词触发)

This commit is contained in:
Wuyi无疑 2023-03-31 01:12:04 +08:00
parent 6dcd226a46
commit b046ce00bd
3 changed files with 32 additions and 16 deletions

View File

@ -4,6 +4,7 @@ from typing import Tuple
from gsuid_core.sv import SV
from gsuid_core.bot import Bot
from gsuid_core.models import Event
from gsuid_core.logger import logger
from .to_data import switch_api
from .to_card import enka_to_card
@ -11,9 +12,21 @@ from ..utils.convert import get_uid
from .get_enka_img import draw_enka_img
from ..utils.error_reply import UID_HINT
from .draw_char_rank import draw_cahrcard_list
from ..utils.resource.RESOURCE_PATH import TEMP_PATH
sv_enka_config = SV('面板设置', pm=2)
sv_get_enka = SV('面板查询', priority=10)
sv_get_original_pic = SV('查看面板原图', priority=5)
@sv_get_original_pic.on_fullmatch(('原图'))
async def sned_original_pic(bot: Bot, ev: Event):
if ev.reply:
path = TEMP_PATH / f'{ev.reply}.jpg'
if path.exists():
logger.info('[原图]访问图片: {}'.format(path))
with open(path, 'rb') as f:
await bot.send(f.read())
@sv_enka_config.on_fullmatch('切换api')
@ -39,6 +52,9 @@ async def send_char_info(bot: Bot, ev: Event):
await bot.send(im)
elif isinstance(im, Tuple):
await bot.send(im[0])
if im[1]:
with open(TEMP_PATH / f'{ev.msg_id}.jpg', 'wb') as f:
f.write(im[1])
else:
await bot.send('发生未知错误')

24
poetry.lock generated
View File

@ -1789,14 +1789,14 @@ dev = ["atomicwrites (==1.2.1)", "attrs (==19.2.0)", "coverage (==6.5.0)", "hatc
[[package]]
name = "pytz"
version = "2023.2"
version = "2023.3"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
python-versions = "*"
files = [
{file = "pytz-2023.2-py2.py3-none-any.whl", hash = "sha256:8a8baaf1e237175b02f5c751eea67168043a749c843989e2b3015aa1ad9db68b"},
{file = "pytz-2023.2.tar.gz", hash = "sha256:a27dcf612c05d2ebde626f7d506555f10dfc815b3eddccfaadfc7d99b11c9a07"},
{file = "pytz-2023.3-py2.py3-none-any.whl", hash = "sha256:a151b3abb88eda1d4e34a9814df37de2a80e301e68ba0fd856fb9b46bfbbbffb"},
{file = "pytz-2023.3.tar.gz", hash = "sha256:1d8ce29db189191fb55338ee6d0387d82ab59f3d00eac103412d64e0ebd0c588"},
]
[[package]]
@ -1932,14 +1932,14 @@ idna2008 = ["idna"]
[[package]]
name = "setuptools"
version = "67.6.0"
version = "67.6.1"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "setuptools-67.6.0-py3-none-any.whl", hash = "sha256:b78aaa36f6b90a074c1fa651168723acbf45d14cb1196b6f02c0fd07f17623b2"},
{file = "setuptools-67.6.0.tar.gz", hash = "sha256:2ee892cd5f29f3373097f5a814697e397cf3ce313616df0af11231e2ad118077"},
{file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"},
{file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"},
]
[package.extras]
@ -2124,14 +2124,14 @@ sqlalchemy2-stubs = "*"
[[package]]
name = "sqlmodelx"
version = "0.0.4"
version = "0.0.5"
description = "SQLModelX is an extension of the SQLModel library."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "sqlmodelx-0.0.4-py3-none-any.whl", hash = "sha256:c4e84ac41fa8a4852b603543dfcfac752f50e46fcf50422aff4f1384369964de"},
{file = "sqlmodelx-0.0.4.tar.gz", hash = "sha256:b0f0517409ad894145fcacfc85325a634835a8098976b729fead6ccffa78bc60"},
{file = "sqlmodelx-0.0.5-py3-none-any.whl", hash = "sha256:6c5dd61cb24d754c1d21cedf1d8e25023286959c9adf5d7a07363925a94cf3e7"},
{file = "sqlmodelx-0.0.5.tar.gz", hash = "sha256:ec6df637a1df98b503df053a1db749617fdb1ead119db09ea92f7103877533b5"},
]
[package.dependencies]
@ -2234,14 +2234,14 @@ typing-extensions = ">=3.7.4"
[[package]]
name = "tzdata"
version = "2023.2"
version = "2023.3"
description = "Provider of IANA time zone data"
category = "main"
optional = false
python-versions = ">=2"
files = [
{file = "tzdata-2023.2-py2.py3-none-any.whl", hash = "sha256:905ae9e6744dd9ef5ce94d2aaa2dd00282fee38b670b2133407f23c388f110a1"},
{file = "tzdata-2023.2.tar.gz", hash = "sha256:c3b51b235b07f9f1889089c2264bcbeaaba260a63f89bea09e350ea4205eb95f"},
{file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"},
{file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"},
]
[[package]]

View File

@ -42,10 +42,10 @@ pypng==0.20220715.0 ; python_full_version >= "3.8.1" and python_full_version < "
python-dotenv==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
python-multipart==0.0.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pytz-deprecation-shim==0.1.0.post0 ; python_full_version >= "3.8.1" and python_version < "4.0"
pytz==2023.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
pytz==2023.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
qrcode[pil]==7.4.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
rfc3986[idna2008]==1.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
setuptools==67.6.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
setuptools==67.6.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
six==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
smmap==5.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
@ -54,11 +54,11 @@ sqlalchemy-database==0.1.0 ; python_full_version >= "3.8.1" and python_full_vers
sqlalchemy2-stubs==0.0.2a32 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy==1.4.41 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlmodel==0.0.8 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlmodelx==0.0.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlmodelx==0.0.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
starlette==0.26.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
tomlkit==0.11.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
typing-extensions==4.5.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
tzdata==2023.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
tzdata==2023.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
tzlocal==4.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
win32-setctime==1.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0" and sys_platform == "win32"
yarl==1.8.2 ; python_full_version >= "3.8.1" and python_version < "4.0"