模块 nonebot_plugin_marshoai.plugins.twisuki_megakits.mk_morse_code
async func morse_encrypt(msg: str)
源代码 或 在GitHub上查看
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
async func morse_decrypt(msg: str)
源代码 或 在GitHub上查看
python
async def morse_decrypt(msg: str):
result = ''
msg = msg.replace('_', '-')
msg_arr = msg.split(' ')
for element in msg_arr:
if element in MorseDecode:
result += MorseDecode[element]
else:
result += '?'
return result