mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-24 16:15:03 +08:00
🐛 satori.Adapter TypeError: 'HeartbeatMetaEvent' object is not subscriptable
This commit is contained in:
parent
06a109d2b5
commit
ab9d3d3d3e
@ -9,7 +9,7 @@ from liteyuki.utils.base.ly_typing import v11, satori
|
||||
from liteyuki.utils.base.ly_typing import T_Bot, T_MessageEvent
|
||||
|
||||
from .common import MessageEventModel, msg_db
|
||||
from ...utils import satori_utils
|
||||
from liteyuki.utils import satori_utils
|
||||
|
||||
require("nonebot_plugin_alconna")
|
||||
|
||||
@ -18,7 +18,7 @@ require("nonebot_plugin_alconna")
|
||||
async def general_event_monitor(bot: T_Bot, event: T_MessageEvent):
|
||||
if isinstance(bot, satori.Bot):
|
||||
return await satori_event_monitor(bot, event)
|
||||
else:
|
||||
elif isinstance(bot, v11.Bot):
|
||||
return await onebot_v11_event_monitor(bot, event)
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ async def onebot_v11_event_monitor(bot: v11.Bot, event: v11.MessageEvent):
|
||||
group_id = str(event.group_id)
|
||||
else:
|
||||
group_id = ""
|
||||
|
||||
mem = MessageEventModel(
|
||||
time=int(time.time()),
|
||||
bot_id=bot.self_id,
|
||||
@ -58,9 +57,7 @@ async def satori_event_monitor(bot: satori.Bot, event: satori.MessageEvent):
|
||||
adapter="satori",
|
||||
group_id=group_id,
|
||||
user_id=str(event.user.id),
|
||||
|
||||
message_id=str(event.message.id),
|
||||
|
||||
message=event.message,
|
||||
message_text=event.message.content,
|
||||
message_type=satori_utils.get_message_type(event),
|
||||
|
@ -2,7 +2,7 @@ from nonebot.adapters.onebot import v11, v12
|
||||
from nonebot.adapters import satori
|
||||
|
||||
T_Bot = v11.Bot | v12.Bot | satori.Bot
|
||||
T_GroupMessageEvent = v11.GroupMessageEvent | v12.GroupMessageEvent | satori.MessageEvent
|
||||
T_PrivateMessageEvent = v11.PrivateMessageEvent | v12.PrivateMessageEvent | satori.MessageEvent
|
||||
T_MessageEvent = v11.MessageEvent | v12.MessageEvent | satori.MessageEvent
|
||||
T_GroupMessageEvent = v11.GroupMessageEvent | v12.GroupMessageEvent
|
||||
T_PrivateMessageEvent = v11.PrivateMessageEvent | v12.PrivateMessageEvent
|
||||
T_MessageEvent = v11.MessageEvent | v12.MessageEvent # | satori.MessageEvent
|
||||
T_Message = v11.Message | v12.Message | satori.Message
|
||||
|
4
main.py
4
main.py
@ -12,7 +12,8 @@ if __name__ == "__mp_main__":
|
||||
static_config = load_from_yaml("config.yml")
|
||||
store_config.update(static_config)
|
||||
nonebot.init(**store_config)
|
||||
if not store_config['enable_satori']:
|
||||
|
||||
if not store_config.get("enable_satori", False):
|
||||
adapters = [v11.Adapter, v12.Adapter]
|
||||
else:
|
||||
adapters = [v11.Adapter, v12.Adapter, satori.Adapter]
|
||||
@ -20,6 +21,7 @@ if __name__ == "__mp_main__":
|
||||
|
||||
for adapter in adapters:
|
||||
driver.register_adapter(adapter)
|
||||
|
||||
try:
|
||||
nonebot.load_plugin("liteyuki.liteyuki_main")
|
||||
nonebot.load_from_toml("pyproject.toml")
|
||||
|
Loading…
Reference in New Issue
Block a user