1
0
forked from bot/app

🐛 在使用 satori 时部分指令无响应

🐛 使用 onebot 时部分事件在 postprocessor 阶段报错
This commit is contained in:
Expliyh 2024-05-17 14:18:55 +08:00
parent ab9d3d3d3e
commit 322ad19889
No known key found for this signature in database
GPG Key ID: F30DE0CFF6157916
2 changed files with 10 additions and 6 deletions

View File

@ -14,14 +14,17 @@ from liteyuki.utils import satori_utils
require("nonebot_plugin_alconna")
@event_postprocessor
async def general_event_monitor(bot: T_Bot, event: T_MessageEvent):
if isinstance(bot, satori.Bot):
return await satori_event_monitor(bot, event)
elif isinstance(bot, v11.Bot):
return await onebot_v11_event_monitor(bot, event)
print("POST PROCESS")
# if isinstance(bot, satori.Bot):
# print("POST PROCESS SATORI EVENT")
# return await satori_event_monitor(bot, event)
# elif isinstance(bot, v11.Bot):
# print("POST PROCESS V11 EVENT")
# return await onebot_v11_event_monitor(bot, event)
@event_postprocessor
async def onebot_v11_event_monitor(bot: v11.Bot, event: v11.MessageEvent):
if event.message_type == "group":
event: v11.GroupMessageEvent
@ -44,6 +47,7 @@ async def onebot_v11_event_monitor(bot: v11.Bot, event: v11.MessageEvent):
msg_db.save(mem)
@event_postprocessor
async def satori_event_monitor(bot: satori.Bot, event: satori.MessageEvent):
if event.guild is not None:
event: satori.MessageEvent

View File

@ -4,5 +4,5 @@ from nonebot.adapters import satori
T_Bot = v11.Bot | v12.Bot | satori.Bot
T_GroupMessageEvent = v11.GroupMessageEvent | v12.GroupMessageEvent
T_PrivateMessageEvent = v11.PrivateMessageEvent | v12.PrivateMessageEvent
T_MessageEvent = v11.MessageEvent | v12.MessageEvent # | satori.MessageEvent
T_MessageEvent = v11.MessageEvent | v12.MessageEvent | satori.MessageEvent
T_Message = v11.Message | v12.Message | satori.Message