@borg.on(admin_cmd('listchannels', allow_sudo=True))
async def list(event):
    if event.fwd_from:
        return
    channels = get_all_channels()
    msg = 'Channels in database:\n'
    for channel in channels:
        msg += f'''=> `{channel.chat_id}`
'''
    msg += f'''
Total {len(channels)} channels.'''
    if (len(msg) > Config.MAX_MESSAGE_SIZE_LIMIT):
        with io.BytesIO(str.encode(msg)) as out_file:
            out_file.name = 'channels.text'
            (await borg.send_file(event.chat_id, out_file, force_document=True, allow_cache=False, caption='Channels in database', reply_to=event))
            (await event.delete())
    else:
        (await event.edit(msg))
@borg.on(admin_cmd('listchannels', allow_sudo=True))
async def list(event):
    if event.fwd_from:
        return
    channels = get_all_channels()
    msg = 'Channels in database:\n'
    for channel in channels:
        msg += f'=> `{channel.chat_id}`
'
    msg += f'
Total {len(channels)} channels.'
    if (len(msg) > Config.MAX_MESSAGE_SIZE_LIMIT):
        with io.BytesIO(str.encode(msg)) as out_file:
            out_file.name = 'channels.text'
            (await borg.send_file(event.chat_id, out_file, force_document=True, allow_cache=False, caption='Channels in database', reply_to=event))
            (await event.delete())
    else:
        (await event.edit(msg))