From 485c2d6444ab4d18c0d01fea359ee08d07c952d0 Mon Sep 17 00:00:00 2001 From: Xtao_dada Date: Sat, 31 Jul 2021 21:21:03 +0800 Subject: [PATCH] =?UTF-8?q?square=20=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E8=A2=AB=E5=90=9E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- square.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/square.py b/square.py index 080cbe1..27ed440 100644 --- a/square.py +++ b/square.py @@ -3,13 +3,14 @@ from pagermaid.utils import alias_command @listener(is_plugin=True, outgoing=True, command=alias_command("square"), description="生成文本矩形", - parameters="<行> <列> <文本>") + parameters="<文本> <行> <列>") async def square(context): - if not len(context.parameter): + if not len(context.parameter) > 2: await context.edit('出错了呜呜呜 ~ 参数错误。') return - hang = context.parameter[0] - lie = context.parameter[1] + parameters = context.parameter[-2:] + hang = parameters[0] + lie = parameters[1] try: hang = int(hang) lie = int(lie) @@ -19,9 +20,7 @@ async def square(context): if hang < 1 or lie < 1: await context.edit('出错了呜呜呜 ~ 参数错误。') return - parameters = context.parameter - del parameters[0] - del parameters[0] + parameters = [i for i in context.parameter if i not in parameters] text = " ".join(parameters) text *= lie text = text.strip()