Skip to content

Module nonebot_plugin_marshoai.plugins.twisuki_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 = msg.replace('_', '-')
    msg_arr = msg.split(' ')
    for element in msg_arr:
        if element in MorseDecode:
            result += MorseDecode[element]
        else:
            result += '?'
    return result

The document is being improved. Suggestions are welcome.