Skip to content

Module nonebot_plugin_marshoai.tools.marshoai_megakits.mk_morse_code


async func morse_encrypt(msg: str)

Source code or View on 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)

Source code or View on GitHub
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

The document is being improved. Suggestions are welcome.