feat: aiocqhttp和qq-botpy的主动消息发送接口

This commit is contained in:
RockChinQ
2024-03-16 15:16:46 +08:00
parent 09e72f7c5f
commit dab20e3187
2 changed files with 30 additions and 9 deletions
+7 -4
View File
@@ -224,16 +224,19 @@ class AiocqhttpAdapter(adapter.MessageSourceAdapter):
async def send_message(
self, target_type: str, target_id: str, message: mirai.MessageChain
):
# TODO 实现发送消息
return super().send_message(target_type, target_id, message)
aiocq_msg = AiocqhttpMessageConverter.yiri2target(message)[0]
if target_type == "group":
await self.bot.send_group_msg(group_id=int(target_id), message=aiocq_msg)
elif target_type == "person":
await self.bot.send_private_msg(user_id=int(target_id), message=aiocq_msg)
async def reply_message(
self,
message_source: mirai.MessageEvent,
message: mirai.MessageChain,
quote_origin: bool = False,
):
):
aiocq_event = AiocqhttpEventConverter.yiri2target(message_source, self.bot_account_id)
aiocq_msg = AiocqhttpMessageConverter.yiri2target(message)[0]
if quote_origin: