refactor: 完成MessageSource适配器解耦

This commit is contained in:
Rock Chin
2023-04-21 17:51:58 +08:00
parent 016391c976
commit 160086feb9
7 changed files with 185 additions and 150 deletions

View File

@@ -11,6 +11,7 @@ import traceback
import pkg.utils.context as context
import pkg.plugin.switch as switch
import pkg.plugin.settings as settings
import pkg.qqbot.adapter as msadapter
from mirai import Mirai
@@ -276,6 +277,10 @@ class PluginHost:
"""获取机器人对象"""
return context.get_qqbot_manager().bot
def get_bot_adapter(self) -> msadapter.MessageSourceAdapter:
"""获取消息源适配器"""
return context.get_qqbot_manager().adapter
def send_person_message(self, person, message):
"""发送私聊消息"""
asyncio.run(self.get_bot().send_friend_message(person, message))