feat: QQ支持at发送方和画画指令支持
This commit is contained in:
+5
-1
@@ -362,7 +362,11 @@ def send_message(platform, message, res, msg_ref = None, image = None, gocq_loop
|
||||
qqchannel_bot.send_qq_msg(message, res, image_mode=True, msg_ref=msg_ref)
|
||||
else:
|
||||
qqchannel_bot.send_qq_msg(message, res, msg_ref=msg_ref)
|
||||
if platform == PLATFORM_GOCQ: asyncio.run_coroutine_threadsafe(gocq_bot.send_qq_msg(message, res), gocq_loop).result()
|
||||
if platform == PLATFORM_GOCQ:
|
||||
if image != None:
|
||||
asyncio.run_coroutine_threadsafe(gocq_bot.send_qq_msg(message, image, image_mode=True), gocq_loop).result()
|
||||
else:
|
||||
asyncio.run_coroutine_threadsafe(gocq_bot.send_qq_msg(message, res), gocq_loop).result()
|
||||
|
||||
'''
|
||||
处理消息
|
||||
|
||||
+23
-10
@@ -1,18 +1,31 @@
|
||||
from nakuru.entities.components import Plain
|
||||
from nakuru.entities.components import Plain, At, Image
|
||||
|
||||
class QQ:
|
||||
def run_bot(self, gocq):
|
||||
self.client = gocq
|
||||
self.client.run()
|
||||
|
||||
async def send_qq_msg(self, source, res):
|
||||
async def send_qq_msg(self, source, res, image_mode = False):
|
||||
print("[System-Info] 回复QQ消息中..."+res)
|
||||
# 通过消息链处理
|
||||
if source.type == "GroupMessage":
|
||||
await self.client.sendGroupMessage(source.group_id, [
|
||||
Plain(text=res)
|
||||
])
|
||||
elif source.type == "FriendMessage":
|
||||
await self.client.sendFriendMessage(source.user_id, [
|
||||
Plain(text=res)
|
||||
])
|
||||
if not image_mode:
|
||||
if source.type == "GroupMessage":
|
||||
await self.client.sendGroupMessage(source.group_id, [
|
||||
At(target=source.user_id),
|
||||
Plain(text=res)
|
||||
])
|
||||
elif source.type == "FriendMessage":
|
||||
await self.client.sendFriendMessage(source.user_id, [
|
||||
Plain(text=res)
|
||||
])
|
||||
else:
|
||||
if source.type == "GroupMessage":
|
||||
await self.client.sendGroupMessage(source.group_id, [
|
||||
At(target=source.user_id),
|
||||
Plain(text="好的,我根据你的需要为你生成了一张图片😊")
|
||||
Image.fromURL(url=res)
|
||||
])
|
||||
elif source.type == "FriendMessage":
|
||||
await self.client.sendFriendMessage(source.user_id, [
|
||||
Image.fromURL(url=res)
|
||||
])
|
||||
Reference in New Issue
Block a user