@borg.on(admin_cmd('brm ?(.*)', allow_sudo=True))
async def remove_ch(event):
    if event.fwd_from:
        return
    chat_id = event.pattern_match.group(1)
    if (chat_id == 'all'):
        (await event.edit('Removing...'))
        channels = get_all_channels()
        for channel in channels:
            rm_channel(channel.chat_id)
        (await event.edit('Database cleared.'))
        return
    if in_channels(chat_id):
        rm_channel(chat_id)
        (await event.edit('Removed from database'))
        (await asyncio.sleep(3))
        (await event.delete())
    elif in_channels(event.chat_id):
        rm_channel(event.chat_id)
        (await event.edit('Removed from database'))
        (await asyncio.sleep(3))
        (await event.delete())
    elif (not in_channels(event.chat_id)):
        (await event.edit('Channel is already removed from database. '))
        (await asyncio.sleep(3))
        (await event.delete())
@borg.on(admin_cmd('brm ?(.*)', allow_sudo=True))
async def remove_ch(event):
    if event.fwd_from:
        return
    chat_id = event.pattern_match.group(1)
    if (chat_id == 'all'):
        (await event.edit('Removing...'))
        channels = get_all_channels()
        for channel in channels:
            rm_channel(channel.chat_id)
        (await event.edit('Database cleared.'))
        return
    if in_channels(chat_id):
        rm_channel(chat_id)
        (await event.edit('Removed from database'))
        (await asyncio.sleep(3))
        (await event.delete())
    elif in_channels(event.chat_id):
        rm_channel(event.chat_id)
        (await event.edit('Removed from database'))
        (await asyncio.sleep(3))
        (await event.delete())
    elif (not in_channels(event.chat_id)):
        (await event.edit('Channel is already removed from database. '))
        (await asyncio.sleep(3))
        (await event.delete())