From a9eff425ccbf7590b02901012650d5143004f6a5 Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Thu, 1 Sep 2022 16:56:57 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=A2=9E=E5=8A=A0`=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=88=AB=E5=90=8D`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LittlePaimon/plugins/Paimon_Info/__init__.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/LittlePaimon/plugins/Paimon_Info/__init__.py b/LittlePaimon/plugins/Paimon_Info/__init__.py index a9c8edf..00e0bbb 100644 --- a/LittlePaimon/plugins/Paimon_Info/__init__.py +++ b/LittlePaimon/plugins/Paimon_Info/__init__.py @@ -78,6 +78,12 @@ delete_alias = on_command('删除别名', priority=10, block=True, state={ 'pm_usage': '删除别名<别名>', 'pm_priority': 8 }) +show_alias = on_command('查看别名', priority=10, block=True, state={ + 'pm_name': '角色别名查看', + 'pm_description': '查看你已设置的角色别名', + 'pm_usage': '查看别名', + 'pm_priority': 9 +}) @ys.handle() @@ -266,6 +272,14 @@ async def _(event: MessageEvent, msg: Message = CommandArg()): msg = msg.extract_plain_text().strip() if alias := await PlayerAlias.get_or_none(user_id=str(event.user_id), alias=msg): await alias.delete() - await delete_alias.finish(f'别名{msg}删除成功!') + await delete_alias.finish(f'别名{msg}删除成功!', at_sender=True) else: - await delete_alias.finish(f'你并没有将{msg}设置为某个角色的别名') + await delete_alias.finish(f'你并没有将{msg}设置为某个角色的别名', at_sender=True) + + +@show_alias.handle() +async def _(event: MessageEvent): + if aliases := await PlayerAlias.filter(user_id=str(event.user_id)).all(): + await show_alias.finish('你已设以下别名:' + '\n'.join(f'{alias.alias}->{alias.character}' for alias in aliases), at_sender=True) + else: + await show_alias.finish('你还没有设置过角色别名哦', at_sender=True) \ No newline at end of file