Пример #1
0
async def notes(svd):
    if svd.fwd_from:
        return
    notes = get_notes(svd.chat_id)
    message = "**There are no saved notes in this chat.**"
    if notes:
        message = "**Notes saved in this chat:** \n\n"
        for note in notes:
            message = message + "**~** " + note.keyword + "\n"
    await svd.edit(message)
Пример #2
0
async def notes(event):
    if event.fwd_from:
        return
    notes = get_notes(event.chat_id)
    message = "**There are no saved notes in this chat.**"
    if notes:
        message = "**Notes saved in this chat:** \n\n"
        for note in notes:
            message += "**~** `" + note.keyword + "`\n"
    await event.edit(message)
Пример #3
0
async def get(getnt):
    if getnt.fwd_from:
        return
    notename = getnt.pattern_match.group(1)
    notes = get_notes(getnt.chat_id)
    for note in notes:
        if notename == note.keyword:
            await getnt.reply(note.reply)
            await getnt.delete()
        else:
            await getnt.edit(f"**Note** ```{notename}``` **not found!**")
Пример #4
0
async def clear(clr):
    if clr.fwd_from:
        return
    notes = get_notes(clr.chat_id)
    notelist = ""
    for note in notes:
        notelist = notelist + note.keyword
    notename = clr.pattern_match.group(1)
    status = f"**Note {notename} not found.**"
    if notename in notelist:
        rm_note(clr.chat_id, notename)
        status = f"**Note** ```{notename}``` **cleared successfully**"
    await clr.edit(status)
Пример #5
0
async def clearall(event):
    if event.fwd_from:
        return
    await event.edit("**Purging all notes.**")
    for note in get_notes(event.chat_id):
        if note.file:
            file = await client.get_messages(ENV.LOGGER_GROUP,
                                             ids=int(note.file))
            await file.delete()
    rm_all_notes(str(event.chat_id))
    await event.edit("**All notes have been purged successfully.**")
    time.sleep(2)
    await event.delete()
    status = f"**Successfully purged all notes at** `{event.chat_id}`"
    await log(status)
Пример #6
0
async def clear(event):
    if event.fwd_from:
        return
    if event.text.split()[0][1:] != "clear":
        return
    notes = get_notes(event.chat_id)
    notename = (event.pattern_match.group(1)).lower()
    status = f"**Note {notename} not found.**"
    for note in notes:
        if notename == note.keyword:
            if note.file:
                file = await client.get_messages(ENV.LOGGER_GROUP,
                                                 ids=int(note.file))
                await file.delete()
            rm_note(event.chat_id, notename)
            status = f"**Note** `{notename}` **cleared successfully**"
    await event.edit(status)
Пример #7
0
async def get(event):
    if event.fwd_from:
        return
    notename = (event.pattern_match.group(1)).lower()
    reply = await event.get_reply_message()
    notes = get_notes(event.chat_id)
    for note in notes:
        if notename == note.keyword:
            file = await client.get_messages(
                ENV.LOGGER_GROUP, ids=int(note.file)) if note.file else None
            await client.send_message(event.chat_id,
                                      note.content,
                                      file=file,
                                      reply_to=reply,
                                      silent=True)
            return await event.delete()
    await event.edit(f"**Note** `{notename}` **not found!**")