@command(pattern='^.listapproved')
async def approve_p_m(event):
    if event.fwd_from:
        return
    approved_users = pmpermit_sql.get_all_approved()
    APPROVED_PMs = 'Current Approved PMs\n'
    if (len(approved_users) > 0):
        for a_user in approved_users:
            if a_user.reason:
                APPROVED_PMs += f'''👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id}) for {a_user.reason}
'''
            else:
                APPROVED_PMs += f'''👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id})
'''
    else:
        APPROVED_PMs = 'no Approved PMs (yet)'
    if (len(APPROVED_PMs) > 4095):
        with io.BytesIO(str.encode(APPROVED_PMs)) as out_file:
            out_file.name = 'approved.pms.text'
            (await event.client.send_file(event.chat_id, out_file, force_document=True, allow_cache=False, caption='Current Approved PMs', reply_to=event))
            (await event.delete())
    else:
        (await event.edit(APPROVED_PMs))
@command(pattern='^.listapproved')
async def approve_p_m(event):
    if event.fwd_from:
        return
    approved_users = pmpermit_sql.get_all_approved()
    APPROVED_PMs = 'Current Approved PMs\n'
    if (len(approved_users) > 0):
        for a_user in approved_users:
            if a_user.reason:
                APPROVED_PMs += f'👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id}) for {a_user.reason}
'
            else:
                APPROVED_PMs += f'👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id})
'
    else:
        APPROVED_PMs = 'no Approved PMs (yet)'
    if (len(APPROVED_PMs) > 4095):
        with io.BytesIO(str.encode(APPROVED_PMs)) as out_file:
            out_file.name = 'approved.pms.text'
            (await event.client.send_file(event.chat_id, out_file, force_document=True, allow_cache=False, caption='Current Approved PMs', reply_to=event))
            (await event.delete())
    else:
        (await event.edit(APPROVED_PMs))