from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest


@ultroid_cmd(pattern="morsecode(?: |$)(.*)")
async def imback(ult):
    args = ult.pattern_match.group(1)
    if not args:
        get = await ult.get_reply_message()
        args = get.text
    if not args:
        await edit_or_reply(
            ult, "What am I Supposed to do with this stupid, Give me a text. "
        )
    chat = "@MorseCodeGeneratorBot"
    await ult.edit("**Generating Morse Code...**")
    async with ult.client.conversation(chat) as conv:
        try:
            response = conv.wait_event(events.NewMessage(incoming=True, from_users=1063207765))
            await ult.client.send_message(chat, args)
            response = await response
            await response.forward_to(ult.chat_id)
        except YouBlockedUserError:
            await ult.reply("Boss! Please Unblock @MorseCodeGeneratorBot")
            return