🎨 支持部分情况的前缀去除

This commit is contained in:
KimigaiiWuyi 2023-11-29 02:45:41 +08:00
parent b358fc374e
commit 3ea613fb97
2 changed files with 6 additions and 5 deletions

View File

@ -150,7 +150,7 @@ async def get_all_message(bot: Bot, ev: Event):
elif isinstance(ev, GroupAtMessageCreateEvent): elif isinstance(ev, GroupAtMessageCreateEvent):
sp_bot_id = 'qqgroup' sp_bot_id = 'qqgroup'
user_type = 'group' user_type = 'group'
group_id = str(ev.group_id) group_id = str(ev.group_openid)
msg_id = ev.id msg_id = ev.id
sender = ev.author.dict() sender = ev.author.dict()
elif isinstance(ev, C2CMessageCreateEvent): elif isinstance(ev, C2CMessageCreateEvent):
@ -542,10 +542,11 @@ def convert_message(_msg: Any, message: List[Message], index: int):
_msg.data['text'] if 'text' in _msg.data else _msg.data['content'] _msg.data['text'] if 'text' in _msg.data else _msg.data['content']
) )
if index == 0: if index == 0 or index == 1:
for word in command_start: for word in command_start:
if data.startswith(word): _data = data.strip()
data = data[len(word) :] # noqa:E203 if _data.startswith(word):
data = _data[len(word) :] # noqa:E203
break break
message.append(Message('text', data)) message.append(Message('text', data))
elif _msg.type == 'image': elif _msg.type == '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.2" version = "4.4.3"
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"