mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-02 21:09:50 +00:00
deleted: nonebot_plugin_marshoai/tools/marshoai-megakits/a.py
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
This commit is contained in:
@ -0,0 +1,44 @@
|
||||
# MorseCode
|
||||
MorseEncode = {
|
||||
'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': '-----',
|
||||
'.': '.-.-.-', ':': '---...', ',': '--..--', ';': '-.-.-.',
|
||||
'?': '..--..', '=': '-...-', '\'': '.----.', '/': '-..-.',
|
||||
'!': '-.-.--', '-': '-....-', '_': '..--.-', '\"': '.-..-.',
|
||||
'(': '-.--.', ')': '-.--.-', '$': '...-..-', '&': '....',
|
||||
'@': '.--.-.', ' ': ' '
|
||||
}
|
||||
MorseDecode = {value: key for key, value in MorseEncode.items()}
|
||||
|
||||
|
||||
# MorseCode Encrypt
|
||||
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
|
||||
|
||||
|
||||
# MorseCode Decrypt
|
||||
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
|
Reference in New Issue
Block a user