From dd05e603e079da0c53b26afd154f5515dfd92f46 Mon Sep 17 00:00:00 2001 From: Snowykami Date: Mon, 16 Dec 2024 03:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E6=95=B0=E7=94=9F=E6=88=90=E5=99=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E7=94=9F=E6=88=90=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=9A=84=E9=9A=8F=E6=9C=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/random_number_generator.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nonebot_plugin_marshoai/plugins/random_number_generator.py diff --git a/nonebot_plugin_marshoai/plugins/random_number_generator.py b/nonebot_plugin_marshoai/plugins/random_number_generator.py new file mode 100644 index 00000000..500ef04b --- /dev/null +++ b/nonebot_plugin_marshoai/plugins/random_number_generator.py @@ -0,0 +1,18 @@ +import random + +from nonebot_plugin_marshoai.plugin import Integer, PluginMetadata, on_function_call + +__marsho_meta__ = PluginMetadata( + name="随机数生成器", author="MarshoAI", description="生成指定数量的随机数" +) + + +@on_function_call(description="生成随机数").params( + count=Integer(description="随机数的数量") +) +async def generate_random_numbers(count: int) -> str: + random_numbers = [random.randint(1, 100) for _ in range(count)] + return f"生成的随机数为: {', '.join(map(str, random_numbers))}" + + +# 该插件由MarshoAI自举编写