mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-12 06:55:49 +08:00
✨ 新增msg_id
字段
This commit is contained in:
parent
5bd62d52c4
commit
e4033cb82b
@ -24,6 +24,7 @@ class _Bot:
|
|||||||
target_type: Literal['group', 'direct', 'channel', 'sub_channel'],
|
target_type: Literal['group', 'direct', 'channel', 'sub_channel'],
|
||||||
target_id: Optional[str],
|
target_id: Optional[str],
|
||||||
bot_id: str,
|
bot_id: str,
|
||||||
|
msg_id: str,
|
||||||
):
|
):
|
||||||
if isinstance(message, Message):
|
if isinstance(message, Message):
|
||||||
message = [message]
|
message = [message]
|
||||||
@ -39,6 +40,7 @@ class _Bot:
|
|||||||
bot_id=bot_id,
|
bot_id=bot_id,
|
||||||
target_type=target_type,
|
target_type=target_type,
|
||||||
target_id=target_id,
|
target_id=target_id,
|
||||||
|
msg_id=msg_id,
|
||||||
)
|
)
|
||||||
logger.info(f'[发送消息to] {bot_id} - {target_type} - {target_id}')
|
logger.info(f'[发送消息to] {bot_id} - {target_type} - {target_id}')
|
||||||
await self.bot.send_bytes(msgjson.encode(send))
|
await self.bot.send_bytes(msgjson.encode(send))
|
||||||
@ -67,6 +69,7 @@ class Bot:
|
|||||||
self.ev.user_type,
|
self.ev.user_type,
|
||||||
self.ev.group_id if self.ev.group_id else self.ev.user_id,
|
self.ev.group_id if self.ev.group_id else self.ev.user_id,
|
||||||
self.ev.bot_id,
|
self.ev.bot_id,
|
||||||
|
self.ev.msg_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def target_send(
|
async def target_send(
|
||||||
@ -76,5 +79,9 @@ class Bot:
|
|||||||
target_id: Optional[str],
|
target_id: Optional[str],
|
||||||
):
|
):
|
||||||
return await self.bot.target_send(
|
return await self.bot.target_send(
|
||||||
message, target_type, target_id, self.ev.bot_id
|
message,
|
||||||
|
target_type,
|
||||||
|
target_id,
|
||||||
|
self.ev.bot_id,
|
||||||
|
self.ev.msg_id,
|
||||||
)
|
)
|
||||||
|
@ -24,6 +24,7 @@ async def get_user_pml(msg: MessageReceive) -> int:
|
|||||||
async def msg_process(msg: MessageReceive) -> Event:
|
async def msg_process(msg: MessageReceive) -> Event:
|
||||||
event = Event(
|
event = Event(
|
||||||
msg.bot_id,
|
msg.bot_id,
|
||||||
|
msg.msg_id,
|
||||||
msg.user_type,
|
msg.user_type,
|
||||||
msg.group_id,
|
msg.group_id,
|
||||||
msg.user_id,
|
msg.user_id,
|
||||||
|
@ -10,6 +10,7 @@ class Message(Struct):
|
|||||||
|
|
||||||
class MessageReceive(Struct):
|
class MessageReceive(Struct):
|
||||||
bot_id: str = 'Bot'
|
bot_id: str = 'Bot'
|
||||||
|
msg_id: str = ''
|
||||||
user_type: Literal['group', 'direct', 'channel', 'sub_channel'] = 'group'
|
user_type: Literal['group', 'direct', 'channel', 'sub_channel'] = 'group'
|
||||||
group_id: Optional[str] = None
|
group_id: Optional[str] = None
|
||||||
user_id: str = ''
|
user_id: str = ''
|
||||||
@ -29,6 +30,7 @@ class Event(MessageReceive):
|
|||||||
|
|
||||||
class MessageSend(Struct):
|
class MessageSend(Struct):
|
||||||
bot_id: str = 'Bot'
|
bot_id: str = 'Bot'
|
||||||
|
msg_id: str = ''
|
||||||
target_type: Optional[str] = None
|
target_type: Optional[str] = None
|
||||||
target_id: Optional[str] = None
|
target_id: Optional[str] = None
|
||||||
content: Optional[List[Message]] = None
|
content: Optional[List[Message]] = None
|
||||||
|
22
poetry.lock
generated
22
poetry.lock
generated
@ -548,25 +548,25 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastapi"
|
name = "fastapi"
|
||||||
version = "0.93.0"
|
version = "0.94.0"
|
||||||
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
|
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "fastapi-0.93.0-py3-none-any.whl", hash = "sha256:d6e6db5f096d67b475e2a09e1124983554f634fad50297de85fc3de0583df13a"},
|
{file = "fastapi-0.94.0-py3-none-any.whl", hash = "sha256:898d7f6616dea49e78fa00e34401f9ace238fc670aafe4e30a16a384e3a671e1"},
|
||||||
{file = "fastapi-0.93.0.tar.gz", hash = "sha256:c2944febec6da706f4c82cdfa0de48afda960c8fbde29dec88697d55a67d7718"},
|
{file = "fastapi-0.94.0.tar.gz", hash = "sha256:08ce0bc6f381ef1b6431e84a31d26eca0b60d6e1ac575adba4af95cc5a36cb62"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
pydantic = ">=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0"
|
pydantic = ">=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0"
|
||||||
starlette = ">=0.25.0,<0.26.0"
|
starlette = ">=0.26.0,<0.27.0"
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"]
|
all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"]
|
||||||
dev = ["pre-commit (>=2.17.0,<3.0.0)", "ruff (==0.0.138)", "uvicorn[standard] (>=0.12.0,<0.21.0)"]
|
dev = ["pre-commit (>=2.17.0,<3.0.0)", "ruff (==0.0.138)", "uvicorn[standard] (>=0.12.0,<0.21.0)"]
|
||||||
doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer-cli (>=0.0.13,<0.0.14)", "typer[all] (>=0.6.1,<0.8.0)"]
|
doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer-cli (>=0.0.13,<0.0.14)", "typer[all] (>=0.6.1,<0.8.0)"]
|
||||||
test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==22.10.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.6)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.6.0.0)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"]
|
test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.7)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.7.0.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastapi-amis-admin"
|
name = "fastapi-amis-admin"
|
||||||
@ -2011,14 +2011,14 @@ test = ["pytest (>=7.1.3)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "starlette"
|
name = "starlette"
|
||||||
version = "0.25.0"
|
version = "0.26.0.post1"
|
||||||
description = "The little ASGI library that shines."
|
description = "The little ASGI library that shines."
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "starlette-0.25.0-py3-none-any.whl", hash = "sha256:774f1df1983fd594b9b6fb3ded39c2aa1979d10ac45caac0f4255cbe2acb8628"},
|
{file = "starlette-0.26.0.post1-py3-none-any.whl", hash = "sha256:5b80b546ed60d43da45f80113c05ff9f4c44fae95ee884945958eba685c56253"},
|
||||||
{file = "starlette-0.25.0.tar.gz", hash = "sha256:854c71e73736c429c2bdb07801f2c76c9cba497e7c3cf4988fde5e95fe4cdb3c"},
|
{file = "starlette-0.26.0.post1.tar.gz", hash = "sha256:af0e54d08afed70fcbc53ae01e71c9c62c8ab038ff8cfd3f7477bf0f086b5ab4"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -2136,14 +2136,14 @@ test = ["pytest (>=4.3)", "pytest-mock (>=3.3)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "urllib3"
|
name = "urllib3"
|
||||||
version = "1.26.14"
|
version = "1.26.15"
|
||||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
||||||
files = [
|
files = [
|
||||||
{file = "urllib3-1.26.14-py2.py3-none-any.whl", hash = "sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1"},
|
{file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"},
|
||||||
{file = "urllib3-1.26.14.tar.gz", hash = "sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72"},
|
{file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
|
@ -18,7 +18,7 @@ email-validator==1.3.1 ; python_full_version >= "3.8.1" and python_full_version
|
|||||||
et-xmlfile==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
et-xmlfile==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
fastapi-amis-admin==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
fastapi-amis-admin==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
fastapi==0.93.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
fastapi==0.94.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
frozenlist==1.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
frozenlist==1.3.3 ; 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.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
gitpython==3.1.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
@ -58,12 +58,12 @@ sqlalchemy2-stubs==0.0.2a32 ; python_full_version >= "3.8.1" and python_full_ver
|
|||||||
sqlalchemy==1.4.41 ; 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"
|
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.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
starlette==0.25.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
starlette==0.26.0.post1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
tomlkit==0.11.6 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
tomlkit==0.11.6 ; 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"
|
typing-extensions==4.5.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||||
tzdata==2022.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
tzdata==2022.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||||
tzlocal==4.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
tzlocal==4.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||||
urllib3==1.26.14 ; python_full_version >= "3.8.1" and python_version < "4"
|
urllib3==1.26.15 ; python_full_version >= "3.8.1" and python_version < "4"
|
||||||
uvicorn==0.21.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
uvicorn==0.21.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
websockets==10.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
websockets==10.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||||
win32-setctime==1.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0" and sys_platform == "win32"
|
win32-setctime==1.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0" and sys_platform == "win32"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user