Example #1
0
async def add_filter(e):
    if not e.text[0].isalpha():
        from userbot.modules.sql_helper.notes_sql import add_note
        message = e.text
        kek = message.split()
        string = ""
        for i in range(2, len(kek)):
            string = string + " " + str(kek[i])
        add_note(str(e.chat_id), kek[1], string)
        await e.edit(
            "```Note added successfully. Use # followed by note name, to get it```"
        )
Example #2
0
async def add_filter(e):
    if not e.text[0].isalpha():
        try:
            from userbot.modules.sql_helper.notes_sql import add_note
        except:
            await e.edit("`Running on Non-SQL mode!`")
            return
        notename = e.pattern_match.group(1)
        string = e.text.partition(notename)[2]
        if e.reply_to_msg_id:
            rep_msg = await e.get_reply_message()
            string = rep_msg.text
        add_note(str(e.chat_id), notename, string)
        await e.edit("`Note added successfully. Use` #{} `to get it`".format(notename))
Example #3
0
async def add_note(fltr):
    """For .save command, saves notes in a chat."""
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        return await fltr.edit("**Running on Non-SQL mode!**")
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#NOTE\nCHAT ID: {fltr.chat_id}\nKEYWORD: {keyword}"
                "\n\nThe following message is saved as the note's reply data for the chat, please do NOT delete it !!",
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            return await fltr.edit(
                "**Saving media as data for the note requires BOTLOG_CHATID to be set.**"
            )
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "**Note {} successfully. Use** `#{}` **to get it.**"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format("updated", keyword))
    return await fltr.edit(success.format("added", keyword))
Example #4
0
async def add_note(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("`Running on Non-SQL mode!`")
        return
    notename = fltr.pattern_match.group(1)
    msg = await fltr.get_reply_message()
    if not msg:
        await fltr.edit("`I need something to save as a note.`")
    elif BOTLOG_CHATID:
        await fltr.client.send_message(
            BOTLOG_CHATID, f"#NOTE\
        \nCHAT: {fltr.chat.title}\
        \nKEYWORD: {notename}\
        \nThe following message is saved as the note's reply data for the chat, please do NOT delete it !!"
        )
        msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                   messages=msg,
                                                   from_peer=fltr.chat_id,
                                                   silent=True)
    else:
        await fltr.edit("`This feature requires the BOTLOG_CHATID to be set.`")
        return
    success = "`Note {} successfully. Use` #{} `to get it`"
    if add_note(str(fltr.chat_id), notename, msg_o.id) is False:
        return await fltr.edit(success.format('updated', notename))
    else:
        return await fltr.edit(success.format('added', notename))
Example #5
0
async def add_filter(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("`Running on Non-SQL mode!`")
        return

    notename = fltr.pattern_match.group(1)
    msg = await fltr.get_reply_message()
    if not msg:
        await fltr.edit("`I need something to save as a note.`")
    else:
        snip = {'type': TYPE_TEXT, 'text': msg.message or ''}
        if msg.media:
            media = None
            if isinstance(msg.media, types.MessageMediaPhoto):
                media = utils.get_input_photo(msg.media.photo)
                snip['type'] = TYPE_PHOTO
            elif isinstance(msg.media, types.MessageMediaDocument):
                media = utils.get_input_document(msg.media.document)
                snip['type'] = TYPE_DOCUMENT
            if media:
                snip['id'] = media.id
                snip['hash'] = media.access_hash
                snip['fr'] = media.file_reference

    success = "`Note {} successfully. Use` #{} `to get it`"

    if add_note(str(fltr.chat_id), notename, snip['text'], snip['type'],
                snip.get('id'), snip.get('hash'), snip.get('fr')) is False:
        return await fltr.edit(success.format('updated', notename))
    else:
        return await fltr.edit(success.format('added', notename))
Example #6
0
async def add_note(fltr):
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        return await fltr.edit("**Running on Non-SQL mode!**")
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#NOTE\nCHAT ID: {fltr.chat_id}\nKEYWORD: {keyword}"
                "\n\nPesan berikut disimpan sebagai data balasan catatan untuk obrolan, mohon JANGAN dihapus !!",
            )
            msg_o = await fltr.client.forward_messages(
                entity=BOTLOG_CHATID, messages=msg, from_peer=fltr.chat_id, silent=True
            )
            msg_id = msg_o.id
        else:
            return await fltr.edit(
                "**Menyimpan media sebagai data untuk catatan memerlukan BOTLOG_CHATID untuk disetel.**"
            )
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "**Catatan {} disimpan. Gunakan** `#{}` **untuk mengambilnya**"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format("Berhasil", keyword))
    return await fltr.edit(success.format("Berhasil", keyword))
Example #7
0
async def add_note(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        return await fltr.edit("**Executando em modo não SQL!**")
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#NOTE\nCHAT ID: {fltr.chat_id}\nPALAVRA-CHAVE: {keyword}"
                "\n\nA mensagem a seguir é salva como os dados de resposta da nota para o bate-papo, NÃO a exclua !!",
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            return await fltr.edit(
                "**Salvar mídia como dados para a nota requer que BOTLOG_CHATID seja definido.**"
            )
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "**Nota {} com sucesso. Use** `#{}` **para obtê-la.**"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format("atualizada", keyword))
    return await fltr.edit(success.format("adicionado", keyword))
Example #8
0
async def add_note(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        return await fltr.edit("`Running on Non-SQL mode!`")
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#NOTE\nCHAT ID: {fltr.chat_id}\nKEYWORD: {keyword}"
                "\n\n`Untuk mengikuti catatan mantan yang anda kirimkan, tolong jangan dihapus catatan ini !`"
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            return await fltr.edit(
                "`Saving media as data for the note requires the BOTLOG_CHATID to be set.`"
            )
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`Note {} successfully. Use` #{} `to get it`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format('updated', keyword))
    else:
        return await fltr.edit(success.format('added', keyword))
Example #9
0
async def add_note(fltr):
    """ Untuk perintah .save, simpan catatan dalam obrolan. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        return await fltr.edit("`Berjalan pada mode Non-SQL!`")
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#NOTE\nCHAT ID: {fltr.chat_id}\nKEYWORD: {keyword}"
                "\n\nPesan berikut disimpan sebagai data balasan catatan untuk obrolan, JANGAN hapus !!"
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            return await fltr.edit(
                "`Menyimpan media sebagai data untuk catatan membutuhkan pengaturan BOTLOG_CHATID.`"
            )
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`Note {} successfully. Use` #{} `to get it`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format('updated', keyword))
    else:
        return await fltr.edit(success.format('added', keyword))
Example #10
0
async def add_note(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        return await fltr.edit("`Berjalan di mode Non-SQL!`")
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#CATATAN\n**ID Obrolan** : {fltr.chat_id}\n**Kata Kunci** : {keyword}"
                "\n\nPesan berikut disimpan sebagai data catatan untuk obrolan.\n**Tolong jangan dihapus!**",
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            return await fltr.edit(
                "`Menyimpan media sebagai data untuk catatan membutuhkan pengaturan BOTLOG_CHATID.`"
            )
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`Catatan berhasil`  **{}**.\n`Gunakan`  **#{}**  `untuk mendapatkannya.`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format("diperbarui", keyword))
    else:
        return await fltr.edit(success.format("ditambahkan", keyword))
Example #11
0
async def add_filter(fltr):
    """ For .save command, saves notes in a chat. """
    if not fltr.text[0].isalpha() and fltr.text[0] not in ("/", "#", "@", "!"):
        try:
            from userbot.modules.sql_helper.notes_sql import add_note
        except AttributeError:
            await fltr.edit("`Running on Non-SQL mode!`")
            return

        notename = fltr.pattern_match.group(1)
        string = fltr.text.partition(notename)[2]
        if fltr.reply_to_msg_id:
            rep_msg = await fltr.get_reply_message()
            string = rep_msg.text
        add_note(str(fltr.chat_id), notename, string)

        await fltr.edit(
            "`Note added successfully. Use` #{} `to get it`".format(notename))
Example #12
0
async def add_note(fltr):
    """ .save  """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("`Bot Non-SQL modunda işləyir!!`")
        return
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID, f"#NOTE\
            \nQrup ID: {fltr.chat_id}\
            \nAçar söz: {keyword}\
            \n\nBu mesaj söhbətdə notu cavablamaq üçün qeyd edildi, xaiş bu mesajı silməyin!"
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            await fltr.edit(
                "`Bir medyanı not olaraq qeyd etmək üçün BOTLOG_CHATID dəyərini tənzimlənməsi lazımdır.`"
            )
            return
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`{} {}. ` #{} `{}`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(
            success.format(LANG['SUCCESS'], 'yeniləndi', keyword,
                           LANG['CALL']))
    else:
        return await fltr.edit(
            success.format(LANG['SUCCESS'], 'əlavə edildi', keyword,
                           LANG['CALL']))
Example #13
0
async def add_note(fltr):
    """ .save komutu bir sohbette not kaydeder. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("`Bot Non-SQL modunda çalışıyor!!`")
        return
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID, f"#NOTE\
            \nGrup ID: {fltr.chat_id}\
            \nAnahtar kelime: {keyword}\
            \n\nBu mesaj sohbette notu cevaplamak için kaydedildi, lütfen bu mesajı silmeyin!"
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            await fltr.edit(
                "`Bir medyayı not olarak kaydetmek için BOTLOG_CHATID değerinin ayarlanmış olması gereklidir.`"
            )
            return
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`{} {}. ` #{} `{}`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(
            success.format(LANG['SUCCESS'], 'güncellendi', keyword,
                           LANG['CALL']))
    else:
        return await fltr.edit(
            success.format(LANG['SUCCESS'], 'eklendi', keyword, LANG['CALL']))
Example #14
0
async def add_note(fltr):
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("`Bot qeyri-SQL rejimində işləyir!!`")
        return
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID, f"#NOTE\
            \nGrup ID: {fltr.chat_id}\
            \nAçar söz: {keyword}\
            \n\nÇatdakı qeydə cavab vermək üçün bu mesaj qeyd edildi, xahiş edirəm bu mesajı silməyin!"
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            await fltr.edit(
                "`Medianı qeyd kimi saxlamaq üçün BOTLOG_CHATID dəyəri təyin olunmalıdır.`"
            )
            return
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`{} {}. ` #{} `{}`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(
            success.format(LANG['SUCCESS'], 'güncəllendi', keyword,
                           LANG['CALL']))
    else:
        return await fltr.edit(
            success.format(LANG['SUCCESS'], 'Əlavə edildi', keyword,
                           LANG['CALL']))
Example #15
0
async def add_note(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("`Berjalan pada mode Non-SQL!`")
        return
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID,
                f"#NOTE\
            \nCHAT ID: {fltr.chat_id}\
            \nKEYWORD: {keyword}\
            \n\nPesan berikut ini disimpan sebagai data balasan catatan untuk chat, JANGAN hapus!!",
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            await fltr.edit(
                "`Saving media as data for the note requires the BOTLOG_CHATID to be set.`"
            )
            return
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "`Catatan {} berhasil. Gunakan` #{} `untuk mendapatkannya`"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format("updated", keyword))
    else:
        return await fltr.edit(success.format("added", keyword))
Example #16
0
async def add_note(fltr):
    """ For .save command, saves notes in a chat. """
    try:
        from userbot.modules.sql_helper.notes_sql import add_note
    except AttributeError:
        await fltr.edit("Running on Non-SQL mode!")
        return
    keyword = fltr.pattern_match.group(1)
    string = fltr.text.partition(keyword)[2]
    msg = await fltr.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await fltr.client.send_message(
                BOTLOG_CHATID, f"#NOTE\
            \nCHAT ID: {fltr.chat_id}\
            \nKEYWORD: {keyword}"
            )
            msg_o = await fltr.client.forward_messages(entity=BOTLOG_CHATID,
                                                       messages=msg,
                                                       from_peer=fltr.chat_id,
                                                       silent=True)
            msg_id = msg_o.id
        else:
            await fltr.edit(
                "Saving media as data for the note requires the BOTLOG_CHATID to be set."
            )
            return
    elif fltr.reply_to_msg_id and not string:
        rep_msg = await fltr.get_reply_message()
        string = rep_msg.text
    success = "Saved {}. Use #{} to get it"
    if add_note(str(fltr.chat_id), keyword, string, msg_id) is False:
        return await fltr.edit(success.format('updated', keyword))
    else:
        return await fltr.edit(success.format('added', keyword))