-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 添加 mk_common.py 和 mk_info.py 文件,提供随机转盘和数字计算功能
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import random | ||
|
||
|
||
async def random_turntable(upper: int, lower: int): | ||
"""Random Turntable | ||
Args: | ||
upper (int): _description_ | ||
lower (int): _description_ | ||
Returns: | ||
_type_: _description_ | ||
""" | ||
return random.randint(lower, upper) | ||
|
||
|
||
|
||
async def number_calc(a: str, b: str, op: str) -> str: | ||
"""Number Calc | ||
Args: | ||
a (str): _description_ | ||
b (str): _description_ | ||
op (str): _description_ | ||
Returns: | ||
str: _description_ | ||
""" | ||
a, b = float(a), float(b) # type: ignore | ||
match op: | ||
case "+": | ||
return str(a + b) # type: ignore | ||
case "-": | ||
return str(a - b) # type: ignore | ||
case "*": | ||
return str(a * b) # type: ignore | ||
case "/": | ||
return str(a / b) # type: ignore | ||
case "**": | ||
return str(a**b) # type: ignore | ||
case "%": | ||
return str(a % b) | ||
case _: | ||
return "未知运算符" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Twisuki | ||
async def twisuki(): | ||
return 'Twiuski(苏阳)是megakits插件作者, Github : "https://github.com/Twisuki"' | ||
|
||
|
||
# MegaKits | ||
async def megakits(): | ||
return 'MegaKits插件是一个功能混杂的MarshoAI插件, 由Twisuki(Github : "https://github.com/Twisuki")开发, 插件仓库 : "https://github.com/LiteyukiStudio/marsho-toolsets/tree/main/Twisuki/marshoai-megakits"' |