-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Twisuki/main
新增了一些功能
- Loading branch information
Showing
2 changed files
with
197 additions
and
161 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,64 +1,74 @@ | ||
import random | ||
|
||
# Twisuki | ||
async def twisuki () : | ||
return "Twiuski(苏阳)是megakits插件作者, Github : 'https://github.com/Twisuki'" | ||
|
||
# Random Turntable | ||
async def random_turntable (upper : int, lower : int = "0") : | ||
return str(random.randint(lower, upper)) | ||
|
||
# Number Calc | ||
async 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 "未知运算符" | ||
|
||
# MorseCode | ||
DICT = { | ||
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', | ||
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', | ||
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', | ||
'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', | ||
'Y': '-.--', 'Z': '--..', | ||
'1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', | ||
'6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----', | ||
'.': '.-.-.-', ':': '---...', ',': '--..--', ';': '-.-.-.', | ||
'?': '..--..', '=': '-...-', '\'': '.----.', '/': '-..-.', | ||
'!': '-.-.--', '-': '-....-', '_': '..--.-', '\"': '.-..-.', | ||
'(': '-.--.', ')': '-.--.-', '$': '...-..-', '&': '....', | ||
'@': '.--.-.', ' ': ' ' | ||
} | ||
|
||
# MorseCode Encrypt | ||
async def morse_encrypt (msg : str) : | ||
result = "" | ||
msg = msg.upper() | ||
for char in msg : | ||
if char in DICT : | ||
result += DICT[char] | ||
else : | ||
result += '..--..' | ||
result += ' ' | ||
|
||
return result | ||
|
||
# MorseCode Decrypt | ||
async def morse_decrypt (msg : str) : | ||
result = "" | ||
|
||
msg_arr = msg.split() | ||
for char in msg_arr : | ||
tmp = [key for key, value in DICT.items() if value == char] | ||
if not tmp : | ||
tmp = '?' | ||
result += tmp | ||
|
||
return result | ||
|
||
import random | ||
|
||
# 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/Twisuki/marsho-toolsets/tree/main/Twisuki/marshoai-megakits'" | ||
|
||
# Random Turntable | ||
async def random_turntable (upper : int, lower : int = "0") : | ||
return str(random.randint(lower, upper)) | ||
|
||
# Number Calc | ||
async 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 "未知运算符" | ||
|
||
# MorseCode | ||
MorseCodeDICT = { | ||
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', | ||
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', | ||
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', | ||
'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', | ||
'Y': '-.--', 'Z': '--..', | ||
'1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', | ||
'6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----', | ||
'.': '.-.-.-', ':': '---...', ',': '--..--', ';': '-.-.-.', | ||
'?': '..--..', '=': '-...-', '\'': '.----.', '/': '-..-.', | ||
'!': '-.-.--', '-': '-....-', '_': '..--.-', '\"': '.-..-.', | ||
'(': '-.--.', ')': '-.--.-', '$': '...-..-', '&': '....', | ||
'@': '.--.-.', ' ': ' ' | ||
} | ||
MorseDecodeDICT = {value: key for key, value in MorseCodeDICT.items()} | ||
|
||
# MorseCode Encrypt | ||
async def morse_encrypt (msg : str) : | ||
result = "" | ||
msg = msg.upper() | ||
for char in msg : | ||
if char in MorseCodeDICT : | ||
result += MorseCodeDICT[char] | ||
else : | ||
result += '..--..' | ||
result += ' ' | ||
|
||
return result | ||
|
||
# MorseCode Decrypt | ||
async def morse_decrypt (msg : str) : | ||
result = "" | ||
|
||
msg_arr = msg.split() | ||
for char in msg_arr : | ||
if char in MorseDecodeDICT : | ||
result += MorseDecodeDICT[char] | ||
else : | ||
result += '?' | ||
|
||
return result | ||
|
||
# Latex | ||
async def latex (msg : str) : | ||
return "https://latex.codecogs.com/png.image?" + msg | ||
|
||
# |
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 |
---|---|---|
@@ -1,97 +1,123 @@ | ||
[ | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__twisuki", | ||
"description" : "介绍插件作者Twisuki" | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__random_turntable", | ||
"description" : "随机转盘, 玩家输入上下限(均为整数), 返回一个随机整数", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"upper" : { | ||
"type" : "integer", | ||
"description" : "随机数上限" | ||
}, | ||
"lower" : { | ||
"type" : "integer", | ||
"description" : "随机数下限" | ||
} | ||
} | ||
}, | ||
"require" : [ | ||
"upper" | ||
] | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__number_calc", | ||
"description" : "数字计算器, 可对整数 小数做加减乘除, 乘方 取余运算", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"a" : { | ||
"type" : "string", | ||
"description" : "第一个运算数" | ||
}, | ||
"b" : { | ||
"type" : "string", | ||
"description" : "第二个运算数" | ||
}, | ||
"op" : { | ||
"type" : "string", | ||
"description" : "运算符, 目前仅支持 + - * / %(取余) **(乘方)" | ||
} | ||
} | ||
}, | ||
"require" : [ | ||
"a", "b", "op" | ||
] | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__morse_encrypt", | ||
"description" : "摩尔斯电码加密, 输入一个字符串, 返回由.- 组成的摩尔斯电码", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"msg" : { | ||
"type" : "string", | ||
"description" : "录入的字符串(包含字母, 数字, 部分标点符号(.:,;?='/!-_\"()$&@))" | ||
} | ||
}, | ||
"require" : [ | ||
"msg" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__morse_decrypt", | ||
"description" : "摩尔斯电码解码, 输入一个字符串(由.- 组成), 返回由解码", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"msg" : { | ||
"type" : "string", | ||
"description" : "录入的字符串(.- )" | ||
} | ||
}, | ||
"require" : [ | ||
"msg" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
[ | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__twisuki", | ||
"description" : "介绍插件作者Twisuki(苏阳)" | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__megakits", | ||
"description" : "介绍本插件MegaKits" | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__random_turntable", | ||
"description" : "随机转盘, 玩家输入上下限(均为整数), 返回一个随机整数", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"upper" : { | ||
"type" : "integer", | ||
"description" : "随机数上限" | ||
}, | ||
"lower" : { | ||
"type" : "integer", | ||
"description" : "随机数下限" | ||
} | ||
} | ||
}, | ||
"require" : [ | ||
"upper" | ||
] | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__number_calc", | ||
"description" : "数字计算器, 可对整数 小数做加减乘除, 乘方 取余运算", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"a" : { | ||
"type" : "string", | ||
"description" : "第一个运算数" | ||
}, | ||
"b" : { | ||
"type" : "string", | ||
"description" : "第二个运算数" | ||
}, | ||
"op" : { | ||
"type" : "string", | ||
"description" : "运算符, 目前仅支持 + - * / %(取余) **(乘方)" | ||
} | ||
} | ||
}, | ||
"require" : [ | ||
"a", "b", "op" | ||
] | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__morse_encrypt", | ||
"description" : "摩尔斯电码加密, 输入一个字符串, 返回由.- 组成的摩尔斯电码", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"msg" : { | ||
"type" : "string", | ||
"description" : "录入的字符串(包含字母, 数字, 部分标点符号(.:,;?='/!-_\"()$&@))" | ||
} | ||
}, | ||
"require" : [ | ||
"msg" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__morse_decrypt", | ||
"description" : "摩尔斯电码解码, 输入一个字符串(由.- 组成), 返回由解码", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"msg" : { | ||
"type" : "string", | ||
"description" : "录入的字符串(.- )" | ||
} | ||
}, | ||
"require" : [ | ||
"msg" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"type" : "function", | ||
"function" : { | ||
"name" : "marshoai-megakits__latex", | ||
"description" : "在线Latex渲染, 输入Latex公式, 返回一个链接(png图片)", | ||
"parameters" : { | ||
"type" : "object", | ||
"properties" : { | ||
"msg" : { | ||
"type" : "string", | ||
"description" : "录入的Latex公式(字符串)" | ||
} | ||
}, | ||
"require" : [ | ||
"msg" | ||
] | ||
} | ||
} | ||
} | ||
] |