Ejemplo n.º 1
0
 async def approve_p_m(event):
     if event.fwd_from:
         return
     approved_users = pmpermit_sql.get_all_approved()
     APPROVED_PMs = "[TeleBot] Currently 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}\n"
             else:
                 APPROVED_PMs += f"👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id})\n"
     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="[TeleBot]Current Approved PMs",
                 reply_to=event
             )
             await event.delete()
     else:
         await event.edit(APPROVED_PMs)
Ejemplo n.º 2
0
 async def lightning_approved_pm(event):
     if event.fwd_from:
         return
     approved_users = lightning_sql.get_all_approved()
     PM_VIA_LIGHT = f"♥‿♥ {LIGHTNINGUSER} Approved PMs\n"
     if len(approved_users) > 0:
         for a_user in approved_users:
             if a_user.reason:
                 PM_VIA_LIGHT += f"♥‿♥ [{a_user.chat_id}](tg://user?id={a_user.chat_id}) for {a_user.reason}\n"
             else:
                 PM_VIA_LIGHT += (
                     f"♥‿♥ [{a_user.chat_id}](tg://user?id={a_user.chat_id})\n"
                 )
     else:
         PM_VIA_LIGHT = "no Approved PMs (yet)"
     if len(PM_VIA_LIGHT) > 4095:
         with io.BytesIO(str.encode(PM_VIA_LIGHT)) 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(PM_VIA_LIGHT)
Ejemplo n.º 3
0
 async def approve_p_m(event):
     if event.fwd_from:
         return
     approved_users = pmpermit_sql.get_all_approved()
     APPROVED_PMs = "───────────────▄▄───▐█\n───▄▄▄───▄██▄──█▀───█─▄\n─▄██▀█▌─██▄▄──▐█▀▄─▐█▀\n▐█▀▀▌───▄▀▌─▌─█─▌──▌─▌\n▌▀▄─▐──▀▄─▐▄─▐▄▐▄─▐▄─▐▄ \n\nCurrent 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}\n"
             else:
                 APPROVED_PMs += f"👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id})\n"
     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)
Ejemplo n.º 4
0
 async def approve_p_m(event):
     if event.fwd_from:
         return
     chat_id = event.from_id
     approved_users = pmpermit_sql.get_all_approved()
     APPROVED_PMs = "Lista degli autorizzati a scrivermi\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={chat_id}) per {a_user.reason}.\n"
             else:
                 APPROVED_PMs += f"👉 [{a_user.chat_id}](tg://user?id={chat_id})\n"
     else:
         APPROVED_PMs = "Nessuno autorizzato, per ora"
     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="**Autorizzato a scrivermi**",
                 reply_to=event)
             await event.delete()
     else:
         await event.edit(APPROVED_PMs)
Ejemplo n.º 5
0
 async def approve_p_m(event):
     if event.fwd_from:
         return
     approved_users = pmpermit_sql.get_all_approved()
     APPROVED_PMs = "Daftar pengguna yang dibolehkan untuk PM ke @SamRamadhan\n\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})\n**Karena** `{a_user.reason}`\n\n"
             else:
                 APPROVED_PMs += f"➡ [{a_user.chat_id}](tg://user?id={a_user.chat_id})\n"
     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)
Ejemplo n.º 6
0
 async def approve_p_m(event):
     if event.fwd_from:
         return
     approved_users = pmpermit_sql.get_all_approved()
     if len(approved_users) > 0:
         for a_user in approved_users:
             pmpermit_sql.disapprove(a_user.chat_id)
         await event.edit("Disapproved All")
     else:
         await event.edit("no Approved PMs (yet)")
Ejemplo n.º 7
0
 async def approve_p_m(event):
     approved_users = pmpermit_sql.get_all_approved()
     i = 0
     if len(approved_users) > 0:
         for a_user in approved_users:
             if a_user.reason == "tempo" or a_user.reason == "":
                 pmpermit_sql.disapprove(a_user.chat_id)
                 i = i + 1
         await event.edit(
             "Disapproved {} temporary approved users".format(i))
     else:
         await event.edit("no Approved PMs (yet)")
Ejemplo n.º 8
0
async def approve_p_m(event):
    if event.fwd_from:
        return
    approved_users = get_all_approved()
    APPROVED_PMs = "Current Approved PMs\n"
    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}\n"
        else:
            APPROVED_PMs += f"👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id})\n"
    if len(APPROVED_PMs) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(APPROVED_PMs)) as out_file:
            out_file.name = "approved.pms.text"
            await borg.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)
Ejemplo n.º 9
0
 async def approve_p_m(event):
     if event.fwd_from:
         return
     approved_users = pmpermit_sql.get_all_approved()