mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 06:32:47 +00:00
parent
28fe2fe808
commit
3304b60d1c
10
list.json
10
list.json
@ -679,6 +679,16 @@
|
||||
"supported": true,
|
||||
"des-short": "智能聊天机器人。(支持回复)",
|
||||
"des": "使用自然语言处理 (NLP) 来帮助用户通过文本进行交互。(支持回复)。\n指令:-chatbot"
|
||||
},
|
||||
{
|
||||
"name": "square",
|
||||
"version": "1.0",
|
||||
"section": "chat",
|
||||
"maintainer": "Vesugierii",
|
||||
"size": "1.2 kb",
|
||||
"supported": true,
|
||||
"des-short": "生成文本矩形",
|
||||
"des": "指令:-square"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
35
square.py
Normal file
35
square.py
Normal file
@ -0,0 +1,35 @@
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("square"),
|
||||
description="生成文本矩形",
|
||||
parameters="<行> <列> <文本>")
|
||||
async def square(context):
|
||||
if not len(context.parameter):
|
||||
await context.edit('出错了呜呜呜 ~ 参数错误。')
|
||||
return
|
||||
hang = context.parameter[0]
|
||||
lie = context.parameter[1]
|
||||
try:
|
||||
hang = int(hang)
|
||||
lie = int(lie)
|
||||
except ValueError:
|
||||
await context.edit('出错了呜呜呜 ~ 参数错误。')
|
||||
return
|
||||
if hang < 1 or lie < 1:
|
||||
await context.edit('出错了呜呜呜 ~ 参数错误。')
|
||||
return
|
||||
parameters = context.parameter
|
||||
del parameters[0]
|
||||
del parameters[0]
|
||||
text = " ".join(parameters)
|
||||
text *= lie
|
||||
text = text.strip()
|
||||
result = []
|
||||
for i in range(hang):
|
||||
result.append(text)
|
||||
result = '\n'.join(result)
|
||||
if len(result) > 4096:
|
||||
await context.edit('出错了呜呜呜 ~ 文本过长。')
|
||||
else:
|
||||
await context.edit(result)
|
Loading…
Reference in New Issue
Block a user