示例#1
0
文件: snip.py 项目: vinay-690/SudoBot
async def on_snip_list(event):
    all_snips = get_all_snips()
    OUT_STR = "Available Snips:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 #{a_snip.snip} \n"
    else:
        OUT_STR = "No Snips. Start Saving using `.snips`"
    if len(OUT_STR) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "snips.text"
            await borg.send_file(event.chat_id,
                                 out_file,
                                 force_document=True,
                                 allow_cache=False,
                                 caption="Available Snips",
                                 reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
示例#2
0
async def on_snip_list(event):
    all_snips = get_all_snips()
    OUT_STR = "**Comandi disponibili:**\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"- #{a_snip.snip} \n"
    else:
        OUT_STR = "Non ci sono comandi. Salvane con `.comando`"
    if len(OUT_STR) > 4095:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "comandi.text"
            await bot.send_file(event.chat_id,
                                out_file,
                                force_document=True,
                                allow_cache=False,
                                caption="Comandi disponibili:",
                                reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
示例#3
0
async def on_snip_list(event):
    all_snips = get_all_snips()
    OUT_STR = "Mevcut Snips:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 #{a_snip.snip} \n"
    else:
        OUT_STR = "Snips yok. `.Snips` kullanarak Kaydetmeye başlayın"
    if len(OUT_STR) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "snips.text"
            await borg.send_file(event.chat_id,
                                 out_file,
                                 force_document=True,
                                 allow_cache=False,
                                 caption="Mevcut Snips",
                                 reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
示例#4
0
async def on_snip_list(event):
    all_snips = get_all_snips()
    OUT_STR = "Tagli Disponibili:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 #{a_snip.snip} \n"
    else:
        OUT_STR = "Nessun Taglio. Incomincia a salvarli con `.snips`"
    if len(OUT_STR) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "snips.text"
            await borg.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Tagli Disponibili",
                reply_to=event
            )
            await event.delete()
    else:
        await event.edit(OUT_STR)