mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
✨ 添加随机数生成器插件,支持生成指定数量的随机数
This commit is contained in:
parent
05cce4b8e8
commit
dd05e603e0
18
nonebot_plugin_marshoai/plugins/random_number_generator.py
Normal file
18
nonebot_plugin_marshoai/plugins/random_number_generator.py
Normal file
@ -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自举编写
|
Loading…
x
Reference in New Issue
Block a user