mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-12 06:55:58 +08:00
✨ 支持链接qqgroupbot
This commit is contained in:
parent
351ba571f2
commit
7e0824d701
@ -134,6 +134,8 @@ async def get_all_message(bot: Bot, ev: Event):
|
|||||||
if bot.adapter.get_name() == 'QQ Guild':
|
if bot.adapter.get_name() == 'QQ Guild':
|
||||||
from nonebot.adapters.qqguild.event import (
|
from nonebot.adapters.qqguild.event import (
|
||||||
MessageEvent,
|
MessageEvent,
|
||||||
|
C2CMessageCreate,
|
||||||
|
GroupAtMessageCreate,
|
||||||
DirectMessageCreateEvent,
|
DirectMessageCreateEvent,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -142,6 +144,16 @@ async def get_all_message(bot: Bot, ev: Event):
|
|||||||
user_type = 'direct'
|
user_type = 'direct'
|
||||||
group_id = str(ev.guild_id)
|
group_id = str(ev.guild_id)
|
||||||
msg_id = ev.id
|
msg_id = ev.id
|
||||||
|
elif isinstance(ev, GroupAtMessageCreate):
|
||||||
|
sp_bot_id = 'qqgroup'
|
||||||
|
user_type = 'group'
|
||||||
|
group_id = str(ev.group_id)
|
||||||
|
msg_id = ev.id
|
||||||
|
elif isinstance(ev, C2CMessageCreate):
|
||||||
|
sp_bot_id = 'qqgroup'
|
||||||
|
user_type = 'direct'
|
||||||
|
group_id = None
|
||||||
|
msg_id = ev.id
|
||||||
# 群聊
|
# 群聊
|
||||||
elif isinstance(ev, MessageEvent):
|
elif isinstance(ev, MessageEvent):
|
||||||
user_type = 'group'
|
user_type = 'group'
|
||||||
|
@ -211,6 +211,17 @@ class GsClient:
|
|||||||
msg.target_id,
|
msg.target_id,
|
||||||
msg.target_type,
|
msg.target_type,
|
||||||
)
|
)
|
||||||
|
elif msg.bot_id == 'qqgroup':
|
||||||
|
await group_send(
|
||||||
|
bot,
|
||||||
|
content,
|
||||||
|
image,
|
||||||
|
node,
|
||||||
|
at_list,
|
||||||
|
msg.target_id,
|
||||||
|
msg.target_type,
|
||||||
|
msg.msg_id,
|
||||||
|
)
|
||||||
elif msg.bot_id == 'feishu':
|
elif msg.bot_id == 'feishu':
|
||||||
await feishu_send(
|
await feishu_send(
|
||||||
bot,
|
bot,
|
||||||
@ -411,6 +422,50 @@ async def guild_send(
|
|||||||
await _send(content, image)
|
await _send(content, image)
|
||||||
|
|
||||||
|
|
||||||
|
async def group_send(
|
||||||
|
bot: Bot,
|
||||||
|
content: Optional[str],
|
||||||
|
image: Optional[str],
|
||||||
|
node: Optional[List[Dict]],
|
||||||
|
at_list: Optional[List[str]],
|
||||||
|
target_id: Optional[str],
|
||||||
|
target_type: Optional[str],
|
||||||
|
msg_id: Optional[str],
|
||||||
|
):
|
||||||
|
async def _send(content: Optional[str], image: Optional[str]):
|
||||||
|
result: Dict[str, Any] = {}
|
||||||
|
if content:
|
||||||
|
result['content'] = content
|
||||||
|
if image:
|
||||||
|
result['image'] = image
|
||||||
|
if target_type == 'group':
|
||||||
|
await bot.post_group_message(
|
||||||
|
group_id=target_id,
|
||||||
|
msg_id=msg_id,
|
||||||
|
event_id=msg_id,
|
||||||
|
**result,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
await bot.post_c2c_message(
|
||||||
|
user_id=target_id,
|
||||||
|
msg_id=msg_id,
|
||||||
|
event_id=msg_id,
|
||||||
|
**result,
|
||||||
|
)
|
||||||
|
|
||||||
|
if node:
|
||||||
|
for _msg in node:
|
||||||
|
if _msg['type'] == 'image':
|
||||||
|
image = _msg['data']
|
||||||
|
content = None
|
||||||
|
else:
|
||||||
|
image = None
|
||||||
|
content = _msg['data']
|
||||||
|
await _send(content, image)
|
||||||
|
else:
|
||||||
|
await _send(content, image)
|
||||||
|
|
||||||
|
|
||||||
async def ntchat_send(
|
async def ntchat_send(
|
||||||
bot: Bot,
|
bot: Bot,
|
||||||
content: Optional[str],
|
content: Optional[str],
|
||||||
|
@ -23,7 +23,7 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "nonebot-plugin-genshinuid"
|
name = "nonebot-plugin-genshinuid"
|
||||||
version = "4.0.6"
|
version = "4.1.0"
|
||||||
description = "支持OneBot(QQ)、OneBotV12、QQ频道、微信、KOOK(开黑啦)、Telegram(电报)、FeiShu(飞书)的全功能NoneBot2原神插件"
|
description = "支持OneBot(QQ)、OneBotV12、QQ频道、微信、KOOK(开黑啦)、Telegram(电报)、FeiShu(飞书)的全功能NoneBot2原神插件"
|
||||||
authors = ["KimigaiiWuyi <444835641@qq.com>"]
|
authors = ["KimigaiiWuyi <444835641@qq.com>"]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user