mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-07 21:46:10 +08:00
new file: nonebot_plugin_marshoai/tools/marshoai-megakits/mk_Common.py new file: nonebot_plugin_marshoai/tools/marshoai-megakits/mk_Info.py new file: nonebot_plugin_marshoai/tools/marshoai-megakits/mk_MorseCode.py new file: nonebot_plugin_marshoai/tools/marshoai-megakits/mk_NyaCode.py nonebot_plugin_marshoai/tools/marshoai-megakits/__init__.py nonebot_plugin_marshoai/tools/marshoai-megakits/tools.json
24 lines
575 B
Python
24 lines
575 B
Python
import random
|
|
|
|
# Random Turntable
|
|
async def random_turntable(upper: int, lower: int = "0"):
|
|
return random.randint(lower, upper)
|
|
|
|
# Number Calc
|
|
def number_calc(a: str, b: str, op: str):
|
|
a, b = float(a), float(b)
|
|
match op:
|
|
case "+":
|
|
return str(a + b)
|
|
case "-":
|
|
return str(a - b)
|
|
case "*":
|
|
return str(a * b)
|
|
case "/":
|
|
return str(a / b)
|
|
case "**":
|
|
return str(a ** b)
|
|
case "%":
|
|
return str(a % b)
|
|
case _:
|
|
return "未知运算符" |