mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-02 14:49:51 +00:00
✨ 添加开发文档和 API 文档的初始结构;更新 .gitignore 以排除生成的文档目录
This commit is contained in:
110
docs/zh/dev/api/tools/marshoai_megakits/index.md
Normal file
110
docs/zh/dev/api/tools/marshoai_megakits/index.md
Normal file
@ -0,0 +1,110 @@
|
||||
---
|
||||
title: index
|
||||
collapsed: true
|
||||
---
|
||||
# **模块** `nonebot_plugin_marshoai.tools.marshoai_megakits`
|
||||
|
||||
---
|
||||
### ***async func*** `twisuki()`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L5' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def twisuki():
|
||||
return str(await mk_info.twisuki())
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `megakits()`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L10' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def megakits():
|
||||
return str(await mk_info.megakits())
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `random_turntable(upper: int, lower: int = 0)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L15' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def random_turntable(upper: int, lower: int=0):
|
||||
return str(await mk_common.random_turntable(upper, lower))
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `number_calc(a: str, b: str, op: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L20' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def number_calc(a: str, b: str, op: str):
|
||||
return str(await mk_common.number_calc(a, b, op))
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `morse_encrypt(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L25' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def morse_encrypt(msg: str):
|
||||
return str(await mk_morse_code.morse_encrypt(msg))
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `morse_decrypt(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L30' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def morse_decrypt(msg: str):
|
||||
return str(await mk_morse_code.morse_decrypt(msg))
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `nya_encode(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L35' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def nya_encode(msg: str):
|
||||
return str(await mk_nya_code.nya_encode(msg))
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `nya_decode(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py#L40' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def nya_decode(msg: str):
|
||||
return str(await mk_nya_code.nya_decode(msg))
|
||||
```
|
||||
</details>
|
||||
|
65
docs/zh/dev/api/tools/marshoai_megakits/mk_common.md
Normal file
65
docs/zh/dev/api/tools/marshoai_megakits/mk_common.md
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
title: mk_common
|
||||
---
|
||||
# **模块** `nonebot_plugin_marshoai.tools.marshoai_megakits.mk_common`
|
||||
|
||||
---
|
||||
### ***async func*** `random_turntable(upper: int, lower: int)`
|
||||
|
||||
**说明**: Random Turntable
|
||||
|
||||
|
||||
**参数**:
|
||||
> - upper (int): _description_
|
||||
> - lower (int): _description_
|
||||
|
||||
**返回**: _type_: _description_
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py#L4' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def random_turntable(upper: int, lower: int):
|
||||
return random.randint(lower, upper)
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `number_calc(a: str, b: str, op: str) -> str`
|
||||
|
||||
**说明**: Number Calc
|
||||
|
||||
|
||||
**参数**:
|
||||
> - a (str): _description_
|
||||
> - b (str): _description_
|
||||
> - op (str): _description_
|
||||
|
||||
**返回**: str: _description_
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py#L17' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```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 '未知运算符'
|
||||
```
|
||||
</details>
|
||||
|
31
docs/zh/dev/api/tools/marshoai_megakits/mk_info.md
Normal file
31
docs/zh/dev/api/tools/marshoai_megakits/mk_info.md
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
title: mk_info
|
||||
---
|
||||
# **模块** `nonebot_plugin_marshoai.tools.marshoai_megakits.mk_info`
|
||||
|
||||
---
|
||||
### ***async func*** `twisuki()`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_info.py#L2' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def twisuki():
|
||||
return 'Twiuski(苏阳)是megakits插件作者, Github : "https://github.com/Twisuki"'
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `megakits()`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_info.py#L7' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def megakits():
|
||||
return 'MegaKits插件是一个功能混杂的MarshoAI插件, 由Twisuki(Github : "https://github.com/Twisuki")开发, 插件仓库 : "https://github.com/LiteyukiStudio/marsho-toolsets/tree/main/Twisuki/marshoai-megakits"'
|
||||
```
|
||||
</details>
|
||||
|
46
docs/zh/dev/api/tools/marshoai_megakits/mk_morse_code.md
Normal file
46
docs/zh/dev/api/tools/marshoai_megakits/mk_morse_code.md
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
title: mk_morse_code
|
||||
---
|
||||
# **模块** `nonebot_plugin_marshoai.tools.marshoai_megakits.mk_morse_code`
|
||||
|
||||
---
|
||||
### ***async func*** `morse_encrypt(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_morse_code.py#L62' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def morse_encrypt(msg: str):
|
||||
result = ''
|
||||
msg = msg.upper()
|
||||
for char in msg:
|
||||
if char in MorseEncode:
|
||||
result += MorseEncode[char]
|
||||
else:
|
||||
result += '..--..'
|
||||
result += ' '
|
||||
return result
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `morse_decrypt(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_morse_code.py#L76' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def morse_decrypt(msg: str):
|
||||
result = ''
|
||||
msg_arr = msg.split()
|
||||
for char in msg_arr:
|
||||
if char in MorseDecode:
|
||||
result += MorseDecode[char]
|
||||
else:
|
||||
result += '?'
|
||||
return result
|
||||
```
|
||||
</details>
|
||||
|
60
docs/zh/dev/api/tools/marshoai_megakits/mk_nya_code.md
Normal file
60
docs/zh/dev/api/tools/marshoai_megakits/mk_nya_code.md
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
title: mk_nya_code
|
||||
---
|
||||
# **模块** `nonebot_plugin_marshoai.tools.marshoai_megakits.mk_nya_code`
|
||||
|
||||
---
|
||||
### ***async func*** `nya_encode(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_nya_code.py#L25' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def nya_encode(msg: str):
|
||||
msg_b64str = base64.b64encode(msg.encode()).decode().replace('=', '')
|
||||
msg_nyastr = ''.join((NyaCodeEncode[base64_char] for base64_char in msg_b64str))
|
||||
result = ''
|
||||
for char in msg_nyastr:
|
||||
if char == '呜' and random.random() < 0.5:
|
||||
result += '!'
|
||||
if random.random() < 0.25:
|
||||
result += random.choice(NyaCodeSpecialCharset) + char
|
||||
else:
|
||||
result += char
|
||||
return result
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
### ***async func*** `nya_decode(msg: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>源代码</b> 或 <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_nya_code.py#L41' target='_blank'>在GitHub上查看</a></summary>
|
||||
|
||||
```python
|
||||
async def nya_decode(msg: str):
|
||||
msg = msg.replace('唔', '').replace('!', '').replace('.', '')
|
||||
msg_nyastr = []
|
||||
i = 0
|
||||
if len(msg) % 3 != 0:
|
||||
return '这句话不是正确的猫语'
|
||||
while i < len(msg):
|
||||
nyachar = msg[i:i + 3]
|
||||
try:
|
||||
if all((char in NyaCodeCharset for char in nyachar)):
|
||||
msg_nyastr.append(nyachar)
|
||||
i += 3
|
||||
except Exception:
|
||||
return '这句话不是正确的猫语'
|
||||
msg_b64str = ''.join((NyaCodeDecode[nya_char] for nya_char in msg_nyastr))
|
||||
msg_b64str += '=' * (4 - len(msg_b64str) % 4)
|
||||
try:
|
||||
result = base64.b64decode(msg_b64str.encode()).decode()
|
||||
except Exception:
|
||||
return '翻译失败'
|
||||
return result
|
||||
```
|
||||
</details>
|
||||
|
Reference in New Issue
Block a user