🐛 修复和完善

This commit is contained in:
KimigaiiWuyi 2023-11-15 23:54:26 +08:00
parent d1a461f1b6
commit a21c25c20e
2 changed files with 16 additions and 8 deletions

View File

@ -625,11 +625,14 @@ async def guild_send(
msg_id: Optional[str], msg_id: Optional[str],
guild_id: Optional[str], guild_id: Optional[str],
): ):
from nonebot.adapters.qq.exception import ActionFailed
from nonebot.adapters.qq.bot import Bot as qqbot from nonebot.adapters.qq.bot import Bot as qqbot
from nonebot.adapters.qq.exception import ActionFailed
assert isinstance(bot, qqbot) assert isinstance(bot, qqbot)
if target_id is None:
return
async def _send(content: Optional[str], image: Optional[str]): async def _send(content: Optional[str], image: Optional[str]):
result: Dict[str, Any] = {'msg_id': msg_id} result: Dict[str, Any] = {'msg_id': msg_id}
if image: if image:
@ -650,7 +653,7 @@ async def guild_send(
if target_type == 'group': if target_type == 'group':
await bot.post_messages( await bot.post_messages(
channel_id=str(target_id) if target_id else 0, channel_id=str(target_id),
**result, **result,
) )
else: else:
@ -664,10 +667,11 @@ async def guild_send(
recipient_id=str(target_id), recipient_id=str(target_id),
source_guild_id=str(guild_id), source_guild_id=str(guild_id),
) )
await bot.post_dms_messages( if dms.guild_id:
guild_id=dms.guild_id, await bot.post_dms_messages(
**result, guild_id=dms.guild_id,
) **result,
)
if node: if node:
for _msg in node: for _msg in node:
@ -824,7 +828,11 @@ async def group_send(
async def _send(content: Optional[str], image: Optional[str]): async def _send(content: Optional[str], image: Optional[str]):
message = Message() message = Message()
if image: if image:
_image = image.replace('link://', '') if image.startswith('link://'):
_image = image.replace('link://', '')
else:
logger.warning('[gscore] qqgroup暂不支持发送本地图信息, 请转为URL发送')
return
else: else:
_image = '' _image = ''

View File

@ -23,7 +23,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "nonebot-plugin-genshinuid" name = "nonebot-plugin-genshinuid"
version = "4.4.0" version = "4.4.1"
description = "支持OneBot(QQ)、OneBotV12、QQ频道、微信、KOOK开黑啦、Telegram电报、FeiShu飞书、DoDo、Villa米游社大别野、Discord的全功能NoneBot2原神插件" description = "支持OneBot(QQ)、OneBotV12、QQ频道、微信、KOOK开黑啦、Telegram电报、FeiShu飞书、DoDo、Villa米游社大别野、Discord的全功能NoneBot2原神插件"
authors = ["KimigaiiWuyi <444835641@qq.com>"] authors = ["KimigaiiWuyi <444835641@qq.com>"]
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"