Skip to content

Module nonebot_plugin_marshoai.tools.marshoai_megakits.mk_common


async func random_turntable(upper: int, lower: int)

Description: Random Turntable

Arguments:

  • upper (int): description
  • lower (int): description

Return: type: description

Source code or View on GitHub
python
async def random_turntable(upper: int, lower: int):
    return random.randint(lower, upper)

async func number_calc(a: str, b: str, op: str) -> str

Description: Number Calc

Arguments:

  • a (str): description
  • b (str): description
  • op (str): description

Return: str: description

Source code or View on GitHub
python
async def number_calc(a: str, b: str, op: str) -> 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 '未知运算符'

The document is being improved. Suggestions are welcome.