示例#1
0
async def notifon(non_event):
    """ For .notifoff command, get notifications from unapproved PMs. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except AttributeError:
        return await non_event.edit("`Running on Non-SQL mode!`")
    delgvar("NOTIF_OFF")
    await non_event.edit(
        "`Pemberitahuan dari pesan yang belum diizinkan dibunyikan!`")
async def notifon(non_event):
    """ .notifon komutu onaylanmamış kişilerden gelen PM lerden bildirim almanızı sağlar. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except:
        await non_event.edit("`Bot Non-SQL modunda çalışıyor!!`")
        return
    delgvar("NOTIF_OFF")
    await non_event.edit(LANG['NOTIFON'])
示例#3
0
async def notifon(non_event):
    """ For .notifoff command, get notifications from unapproved PMs. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except AttributeError:
        await non_event.edit("`Running on Non-SQL mode!`")
        return
    delgvar("NOTIF_OFF")
    await non_event.edit("`Notifications from unapproved PM's unmuted!`")
示例#4
0
async def add_pmsg(cust_msg):
    """Set your own Unapproved message"""
    if not PM_AUTO_BAN:
        return await cust_msg.edit("**Lord Anda Harus Menyetel** `PM_AUTO_BAN` **Ke** `True`")
    try:
        import userbot.modules.sql_helper.globals as sql
    except AttributeError:
        await cust_msg.edit("`Running on Non-SQL mode!`")
        return

    await cust_msg.edit("`Sedang Memproses...`")
    conf = cust_msg.pattern_match.group(1)

    custom_message = sql.gvarstatus("unapproved_msg")

    if conf.lower() == "set":
        message = await cust_msg.get_reply_message()
        status = "Pesan"

        # check and clear user unapproved message first
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            status = "Pesan"

        if message:
            # TODO: allow user to have a custom text formatting
            # eg: bold, underline, striketrough, link
            # for now all text are in monoscape
            msg = message.message  # get the plain text
            sql.addgvar("unapproved_msg", msg)
        else:
            return await cust_msg.edit("`Mohon Balas Ke Pesan`")

        await cust_msg.edit("`Pesan Berhasil Disimpan Ke Room Chat`")

        if BOTLOG:
            await cust_msg.client.send_message(
                BOTLOG_CHATID, f"**{status} PM Yang Tersimpan Dalam Room Chat Anda:** \n\n{msg}"
            )

    if conf.lower() == "reset":
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            await cust_msg.edit("`Anda Telah Menghapus Pesan Custom PM Ke Default`")
        else:
            await cust_msg.edit("`Pesan PM Anda Sudah Default Sejak Awal`")

    if conf.lower() == "get":
        if custom_message is not None:
            await cust_msg.edit(
                "**Ini Adalah Pesan PM Yang Sekarang Dikirimkan Ke Room Chat Anda:**" f"\n\n{custom_message}"
            )
        else:
            await cust_msg.edit(
                "*Anda Belum Menyetel Pesan PM*\n"
                f"Masih Menggunakan Pesan PM Default: \n\n`{DEF_UNAPPROVED_MSG}`"
            )
示例#5
0
async def notifon(non_event):
    """ For .notifoff command, get notifications from unapproved PMs. """
    if not non_event.text[0].isalpha() and non_event.text[0] not in ("/", "#", "@", "!"):
        try:
            from userbot.modules.sql_helper.globals import delgvar
        except AttributeError:
            return
        delgvar("NOTIF_OFF")
        await non_event.edit("`Notifications from unapproved PM's unmuted!`")
示例#6
0
async def notifon(non_event):
    """ For .notifoff command, get notifications from unapproved PMs. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except AttributeError:
        return await non_event.edit("`Running on Non-SQL mode!`")
    delgvar("NOTIF_OFF")
    await non_event.edit(
        "`Notifikasi dari PM yang tidak disetujui disuarakan!`")
示例#7
0
async def add_pmsg(cust_msg):
    """ Set your own Unapproved message. """
    if not PM_AUTO_BAN:
        return await cust_msg.edit("You need to set `PM_AUTO_BAN` to `True`")
    try:
        import userbot.modules.sql_helper.globals as sql
    except AttributeError:
        await cust_msg.edit("`Running on Non-SQL mode!`")
        return

    await cust_msg.edit("Processing...")
    conf = cust_msg.pattern_match.group(1)

    custom_message = sql.gvarstatus("unapproved_msg")

    if conf.lower() == "set":
        message = await cust_msg.get_reply_message()
        status = "Saved"

        # check and clear user unapproved message first
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            status = "Updated"

        if message:
            # TODO: allow user to have a custom text formatting
            # eg: bold, underline, striketrough, link
            # for now all text are in monoscape
            msg = message.message  # get the plain text
            sql.addgvar("unapproved_msg", msg)
        else:
            return await cust_msg.edit("`Reply to a message`")

        await cust_msg.edit("`Message saved as unapproved message`")

        if BOTLOG:
            await cust_msg.client.send_message(
                BOTLOG_CHATID, f"***{status} Unapproved message :*** \n\n{msg}"
            )

    if conf.lower() == "reset":
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            await cust_msg.edit("`Unapproved message reset to default`")
        else:
            await cust_msg.edit("`You haven't set a custom message yet`")

    if conf.lower() == "get":
        if custom_message is not None:
            await cust_msg.edit(
                "***This is your current unapproved message:***" f"\n\n{custom_message}"
            )
        else:
            await cust_msg.edit(
                "*You Have not set unapproved message yet*\n"
                f"Using default message: \n\n`{DEF_UNAPPROVED_MSG}`"
            )
示例#8
0
async def add_pmsg(cust_msg):
    """Set your own Unapproved message"""
    if not PM_AUTO_BAN:
        return await cust_msg.edit(
            "Você precisa definir `PM_AUTO_BAN` para `True`")
    try:
        import userbot.modules.sql_helper.globals as sql
    except AttributeError:
        await cust_msg.edit("**Executando em modo não SQL!**")
        return

    await cust_msg.edit("**Processando...**")
    conf = cust_msg.pattern_match.group(1)

    custom_message = sql.gvarstatus("unapproved_msg")

    if conf.lower() == "set":
        message = await cust_msg.get_reply_message()
        status = "Saved"

        # check and clear user unapproved message first
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            status = "Updated"

        if not message:
            return await cust_msg.edit("**Responda a uma mensagem.**")

        # TODO: allow user to have a custom text formatting
        # eg: bold, underline, striketrough, link
        # for now all text are in monoscape
        msg = message.message  # get the plain text
        sql.addgvar("unapproved_msg", msg)
        await cust_msg.edit("**Mensagem salva como mensagem PMPermit.**")

        if BOTLOG:
            await cust_msg.client.send_message(
                BOTLOG_CHATID, f"***{status} Mensagem PMPermit :*** \n\n{msg}")

    if conf.lower() == "reset":
        if custom_message is None:
            await cust_msg.edit(
                "**Você ainda não definiu uma mensagem PMPermit personalizada.**"
            )

        else:
            sql.delgvar("unapproved_msg")
            await cust_msg.edit(
                "**A mensagem PMPermit foi redefinida para o padrão.**")
    if conf.lower() == "get":
        if custom_message is not None:
            await cust_msg.edit("**Esta é a sua mensagem PMPermit atual:**"
                                f"\n\n{custom_message}")
        else:
            await cust_msg.edit(
                "**Você ainda não definiu uma mensagem PMPermit personalizada.**\n"
                f"Usando mensagem padrão: \n\n`{DEF_UNAPPROVED_MSG}`")
示例#9
0
async def notifon(non_event):
    """ .notifon """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except:
        await non_event.edit("`Bot Non-SQL modunda işləyir!!`")
        return
    delgvar("NOTIF_OFF")
    await non_event.edit(LANG['NOTIFON'])
示例#10
0
async def add_pmsg(cust_msg):
    """Set your own Unapproved message"""
    if not PM_AUTO_BAN:
        return await cust_msg.edit(
            "Anda harus merubah `PM_AUTO_BAN` menjadi `True`")
    try:
        import userbot.modules.sql_helper.globals as sql
    except AttributeError:
        await cust_msg.edit("`Running on Non-SQL mode!`")
        return

    await cust_msg.edit("Memproses...")
    conf = cust_msg.pattern_match.group(1)

    custom_message = sql.gvarstatus("unapproved_msg")

    if conf.lower() == "set":
        message = await cust_msg.get_reply_message()
        status = "Saved"

        # check and clear user unapproved message first
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            status = "Updated"

        if message:
            # TODO: allow user to have a custom text formatting
            # eg: bold, underline, striketrough, link
            # for now all text are in monoscape
            msg = message.message  # get the plain text
            sql.addgvar("unapproved_msg", msg)
        else:
            return await cust_msg.edit("`Balas sebuah pesan`")

        await cust_msg.edit("`Pesan disimpan sebagai pesan belum diizinkan.`")

        if BOTLOG:
            await cust_msg.client.send_message(
                BOTLOG_CHATID,
                f"**{status} Pesan belum diizinkan:** \n\n{msg}")

    if conf.lower() == "reset":
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            await cust_msg.edit(
                "`Pesan belum diizinkan disetel ulang ke default`")
        else:
            await cust_msg.edit("`Anda belum menyetel pesan khusus`")

    if conf.lower() == "get":
        if custom_message is not None:
            await cust_msg.edit("**Ini adalah pesan Anda yg belum diizinkan:**"
                                f"\n\n{custom_message}")
        else:
            await cust_msg.edit(
                "**Anda belum menyetel pesan yg belum diizinkan**\n"
                f"Menggunakan pesan default: \n\n`{DEF_UNAPPROVED_MSG}`")
示例#11
0
async def notifon(non_event):
    """ For .notifoff command, get notifications from unapproved PMs. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except AttributeError:
        return await non_event.edit("**Executando em modo não SQL!**")
    delgvar("NOTIF_OFF")
    await non_event.edit("**Notificações de PMs deixaram de ser silenciados!**"
                         )
示例#12
0
async def deploy(event, repo, ups_rem, ac_br, txt):
    if HEROKU_API_KEY is not None:
        import heroku3

        heroku = heroku3.from_key(HEROKU_API_KEY)
        heroku_app = None
        heroku_applications = heroku.apps()
        if HEROKU_APP_NAME is None:
            await event.edit(
                "**Please set up the** `HEROKU_APP_NAME` **variable"
                " to be able to deploy your userbot.**")
            repo.__del__()
            return
        for app in heroku_applications:
            if app.name == HEROKU_APP_NAME:
                heroku_app = app
                break
        if heroku_app is None:
            await event.edit(
                f"{txt}\n"
                "**Invalid Heroku credentials for deploying userbot dyno.**")
            return repo.__del__()
        try:
            from userbot.modules.sql_helper.globals import addgvar, delgvar

            delgvar("restartstatus")
            addgvar("restartstatus", f"{event.chat_id}\n{event.id}")
        except AttributeError:
            pass
        ups_rem.fetch(ac_br)
        repo.git.reset("--hard", "FETCH_HEAD")
        heroku_git_url = heroku_app.git_url.replace(
            "https://", "https://*****:*****@")
        if "heroku" in repo.remotes:
            remote = repo.remote("heroku")
            remote.set_url(heroku_git_url)
        else:
            remote = repo.create_remote("heroku", heroku_git_url)
        try:
            remote.push(refspec="HEAD:refs/heads/master", force=True)
        except Exception as error:
            await event.edit(f"{txt}\nHere is the error log:\n`{error}`")
            return repo.__del__()
        build = heroku_app.builds(order_by="created_at", sort="desc")[0]
        if build.status == "failed":
            await event.edit(
                "**Build failed!**\nCancelled or there were some errors.`")
            await asyncio.sleep(5)
            return await event.delete()
        await event.edit(
            "**Successfully updated!**\nBot is restarting, will be back up in a few seconds."
        )

    else:
        await event.edit("**Please set up** `HEROKU_API_KEY` **variable.**")
    return
示例#13
0
async def notifon(non_event):
    """ .notifon komutu onaylanmamış kişilerden gelen PM lerden bildirim almanızı sağlar. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except:
        await non_event.edit("`Bot Non-SQL modunda çalışıyor!!`")
        return
    delgvar("NOTIF_OFF")
    await non_event.edit(
        "`PM izni olmayan kullanıcıarın bildirim göndermesine izin verildi!`")
示例#14
0
async def notifon(non_event):
    """ Para o comando .notifoff, obtenha notificações de PMs não aprovados. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except AttributeError:
        await non_event.edit("`Executando em modo não-SQL!`")
        return
    delgvar("NOTIF_OFF")
    await non_event.edit(
        "`Notificações de PMs não-aprovados não estão mais silenciadas!`")
示例#15
0
async def delsql(event):
    var_ = event.pattern_match.group(1)
    xxnx = await edit_or_reply(event, f"**Deleting Variable** `{var_}`")
    if var_ == "":
        return await xxnx.edit(
            f"**Invalid Syntax !!**\n\n**Ketik** `{cmd}delsql VARIABLE_NAME`")
    try:
        delgvar(var_)
    except Exception as e:
        return await xxnx.edit(f"**ERROR !!**\n\n`{e}`")
    await xxnx.edit(f"**Deleted Variable** `{var_}`")
示例#16
0
async def killdabot(event):
    await event.edit("**Restarting...**")

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar

        delgvar("restartstatus")
        addgvar("restartstatus", f"{event.chat_id}\n{event.id}")
    except AttributeError:
        pass

    # Spin a new instance of bot
    args = [sys.executable, "-m", "userbot"]
    execle(sys.executable, *args, environ)
示例#17
0
async def killdabot(event):
    await event.edit("`*i would be back in a moment*`")
    if BOTLOG:
        await event.client.send_message(BOTLOG_CHATID, "#RESTART \n"
                                        "Restarting bot...")

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar

        delgvar("restartstatus")
        addgvar("restartstatus", f"{event.chat_id}\n{event.id}")
    except AttributeError:
        pass

    # Spin a new instance of bot
    args = [sys.executable, "-m", "userbot"]
    execle(sys.executable, *args, environ)
示例#18
0
async def update(xx, repo, ups_rem, ac_br):
    try:
        ups_rem.pull(ac_br)
    except GitCommandError:
        repo.git.reset("--hard", "FETCH_HEAD")
    await edit_or_reply(
        xx, "`Man-Userbot Berhasil Diupdate! Userbot bisa di Gunakan Lagi.`")

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar

        delgvar("restartstatus")
        addgvar("restartstatus", f"{xx.chat_id}\n{xx.id}")
    except AttributeError:
        pass

    # Spin a new instance of bot
    args = [sys.executable, "-m", "userbot"]
    execle(sys.executable, *args, environ)
示例#19
0
async def update(event, repo, ups_rem, ac_br):
    try:
        ups_rem.pull(ac_br)
    except GitCommandError:
        repo.git.reset("--hard", "FETCH_HEAD")
    await event.edit("`Successfully Updated!\n"
                     "Bot is restarting... Wait for a second!`")

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar

        delgvar("restartstatus")
        addgvar("restartstatus", f"{event.chat_id}\n{event.id}")
    except AttributeError:
        pass

    # Spin a new instance of bot
    args = [sys.executable, "-m", "userbot"]
    execle(sys.executable, *args, environ)
示例#20
0
async def lang(value):
    """For .lang command, change the default langauge of userbot scrapers."""
    util = value.pattern_match.group(1).lower()

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar, gvarstatus
    except AttributeError:
        return await lang.edit("`Berjalan di mode Non-SQL!`")

    if util == "trt":
        scraper = "Penerjemah"
        arg = value.pattern_match.group(2).lower()

        if arg not in LANGUAGES:
            return await value.edit(
                f"**Kode bahasa tidak valid!**\n**Kode bahasa yang tersedia untuk TRT :**\n\n`“{LANGUAGES}”  `"
            )

        if gvarstatus("trt_lang"):
            delgvar("trt_lang")
        addgvar("trt_lang", arg)
        LANG = LANGUAGES[arg]

    elif util == "tts":
        scraper = "Text to Speech"
        arg = value.pattern_match.group(2).lower()

        if arg not in tts_langs():
            return await value.edit(
                f"**Kode bahasa tidak valid!**\n**Kode bahasa yang tersedia untuk TTS :**\n\n`“{tts_langs()}”  `"
            )

        if gvarstatus("tts_lang"):
            delgvar("tts_lang")
        addgvar("tts_lang", arg)
        LANG = tts_langs()[arg]

    await value.edit(
        f"**Bahasa untuk {scraper} diubah menjadi {LANG.title()}.**")
    if BOTLOG:
        await value.client.send_message(
            BOTLOG_CHATID,
            f"Bahasa untuk  **{scraper}**  diubah menjadi {LANG.title()}.")
示例#21
0
async def lang(value):
    """For .lang command, change the default langauge of userbot scrapers."""
    util = value.pattern_match.group(1).lower()

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar, gvarstatus
    except AttributeError:
        return await lang.edit("**Running on Non-SQL mode!**")

    if util == "trt":
        scraper = "Translator"
        arg = value.pattern_match.group(2).lower()

        if arg not in LANGUAGES:
            return await value.edit(
                f"`Invalid Language code !!`\n`Available language codes for TRT`:\n\n`{LANGUAGES}`"
            )

        if gvarstatus("trt_lang"):
            delgvar("trt_lang")
        addgvar("trt_lang", arg)
        LANG = LANGUAGES[arg]

    elif util == "tts":
        scraper = "Text to Speech"
        arg = value.pattern_match.group(2).lower()

        if arg not in tts_langs():
            return await value.edit(
                f"`Invalid Language code !!`\n`Available language codes for TTS`:\n\n`{tts_langs()}`"
            )

        if gvarstatus("tts_lang"):
            delgvar("tts_lang")
        addgvar("tts_lang", arg)
        LANG = tts_langs()[arg]

    await value.edit(f"**Language for {scraper} changed to {LANG.title()}.**")
    if BOTLOG:
        await value.client.send_message(
            BOTLOG_CHATID,
            f"`Language for {scraper} changed to {LANG.title()}.`")
示例#22
0
async def lang(value):
    """ For .lang command, change the default langauge of userbot scrapers. """
    util = value.pattern_match.group(1).lower()

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar, gvarstatus
    except AttributeError:
        return await lang.edit("**Executando em modo não SQL!**")

    if util == "trt":
        scraper = "Translator"
        arg = value.pattern_match.group(2).lower()

        if arg not in LANGUAGES:
            return await value.edit(
                f"**Código de idioma inválido!**\nCódigos de idioma disponíveis:\n\n`{LANGUAGES}`"
            )

        if gvarstatus("trt_lang"):
            delgvar("trt_lang")
        addgvar("trt_lang", arg)
        LANG = LANGUAGES[arg]

    elif util == "tts":
        scraper = "Text to Speech"
        arg = value.pattern_match.group(2).lower()

        if arg not in tts_langs():
            return await value.edit(
                f"**Código de idioma inválido!**\nCódigos de idioma disponíveis:\n\n`{tts_langs()}`"
            )

        if gvarstatus("tts_lang"):
            delgvar("tts_lang")
        addgvar("tts_lang", arg)
        LANG = tts_langs()[arg]

    await value.edit(f"**Idioma de {scraper} mudou para {LANG.title()}.**")
    if BOTLOG:
        await value.client.send_message(
            BOTLOG_CHATID, f"`Idioma de {scraper} mudou para {LANG.title()}.`"
        )
示例#23
0
async def sedNinjaToggle(event):
    """Enables or disables the regex ninja module."""
    if event.pattern_match.group(1) == "on":
        try:
            from userbot.modules.sql_helper.globals import addgvar
        except AttributeError:
            return await event.edit("**Running on Non-SQL mode!**")
        addgvar("regexNinja", True)
        await event.edit("**Berhasil Mengaktifkan Mode Regez Ninja.**")
        await sleep(1)
        await event.delete()
    elif event.pattern_match.group(1) == "off":
        try:
            from userbot.modules.sql_helper.globals import delgvar
        except AttributeError:
            return await event.edit("**Running on Non-SQL mode!**")
        delgvar("regexNinja")
        await event.edit("**Berhasil Menonaktifkan Mode Regez Ninja.**")
        await sleep(1)
        await event.delete()
示例#24
0
async def sedNinjaToggle(event):
    """ Enables or disables the regex ninja module. """
    if event.pattern_match.group(1) == "on":
        try:
            from userbot.modules.sql_helper.globals import addgvar
        except AttributeError:
            return await event.edit("`Running on Non-SQL mode!`")
        addgvar("regexNinja", True)
        await event.edit("`Successfully enabled ninja mode for Regexbot.`")
        await sleep(1)
        await event.delete()
    elif event.pattern_match.group(1) == "off":
        try:
            from userbot.modules.sql_helper.globals import delgvar
        except AttributeError:
            return await event.edit("`Running on Non-SQL mode!`")
        delgvar("regexNinja")
        await event.edit("`Successfully disabled ninja mode for Regexbot.`")
        await sleep(1)
        await event.delete()
示例#25
0
async def update(event, repo, ups_rem, ac_br):
    try:
        ups_rem.pull(ac_br)
    except GitCommandError:
        repo.git.reset("--hard", "FETCH_HEAD")
    await event.edit(
        "**Atualizado com sucesso!**\nO bot está reiniciando, estará de volta em alguns segundos."
    )

    try:
        from userbot.modules.sql_helper.globals import addgvar, delgvar

        delgvar("restartstatus")
        addgvar("restartstatus", f"{event.chat_id}\n{event.id}")
    except AttributeError:
        pass

    # Spin a new instance of bot
    args = [sys.executable, "-m", "userbot"]
    execle(sys.executable, *args, environ)
示例#26
0
async def sedNinjaToggle(event):
    """Enables or disables the regex ninja module."""
    if event.pattern_match.group(1) == "on":
        try:
            from userbot.modules.sql_helper.globals import addgvar
        except AttributeError:
            return await event.edit("**Executando em modo não SQL!**")
        addgvar("regexNinja", True)
        await event.edit("**Modo ninja ativado com sucesso para Regexbot.**")
        await sleep(1)
        await event.delete()
    elif event.pattern_match.group(1) == "off":
        try:
            from userbot.modules.sql_helper.globals import delgvar
        except AttributeError:
            return await event.edit("**Executando em modo não SQL!**")
        delgvar("regexNinja")
        await event.edit("**Modo ninja desativado com sucesso para Regexbot.**"
                         )
        await sleep(1)
        await event.delete()
示例#27
0
async def type_afk_is_not_true(notafk):
    """ This sets your status as not afk automatically when you write something while being afk """
    ISAFK = gvarstatus("AFK_STATUS")
    global COUNT_MSG
    global USERS
    AFKREASON = gvarstatus("AFK_REASON")
    if ISAFK:
        delgvar("AFK_STATUS")
        await notafk.respond("I'm no longer AFK.")
        delgvar("AFK_REASON")
        afk_info = await notafk.respond(
            "`You recieved " + str(COUNT_MSG) +
            " messages while you were away. Check log for more details.`")
        await sleep(4)
        await afk_info.delete()
        if BOTLOG:
            await notafk.client.send_message(
                BOTLOG_CHATID,
                "You've recieved " + str(COUNT_MSG) + " messages from " +
                str(len(USERS)) + " chats while you were away",
            )
            for i in USERS:
                name = await notafk.client.get_entity(i)
                name0 = str(name.first_name)
                await notafk.client.send_message(
                    BOTLOG_CHATID,
                    "[" + name0 + "](tg://user?id=" + str(i) + ")" +
                    " sent you " + "`" + str(USERS[i]) + " messages`",
                )
        COUNT_MSG = 0
        USERS = {}
        delgvar("AFKREASON")
示例#28
0
            f"⚙️ **Telethon**     ➡️  `{version.__version__}` \n"
            f"🐍 **Python**        ➡️  `{python_version()}` \n"
            f"👤 **Usuário**       ➡️   `{DEFAULTUSER}` "
            "\n\n__Userbot iniciado__ ☑️"
        )
    await bot.edit_message(chat_id, msg_id, message)
    return True


try:
    from userbot.modules.sql_helper.globals import delgvar, gvarstatus

    chat_id, msg_id = gvarstatus("restartstatus").split("\n")
    with bot:
        try:
            bot.loop.run_until_complete(update_restart_msg(int(chat_id), int(msg_id)))
        except:
            pass
    delgvar("restartstatus")
except AttributeError:
    pass

# Global Variables
COUNT_MSG = 0
USERS = {}
COUNT_PM = {}
LASTMSG = {}
CMD_HELP = {}
ISAFK = False
AFKREASON = None
示例#29
0
async def add_pmsg(cust_msg):
    """Set your own Unapproved message"""
    if not PM_AUTO_BAN:
        return await cust_msg.edit(
            "**Anda Harus Menyetel Var** `PM_AUTO_BAN` **Ke** `True`\n\n**Bila ingin Mengaktifkan PMPERMIT Silahkan Ketik:** `.set var PM_AUTO_BAN True`"
        )
    try:
        import userbot.modules.sql_helper.globals as sql
    except AttributeError:
        await cust_msg.edit("**Running on Non-SQL mode!**")
        return

    await cust_msg.edit("`Processing...`")
    conf = cust_msg.pattern_match.group(1)

    custom_message = sql.gvarstatus("unapproved_msg")

    if conf.lower() == "set":
        message = await cust_msg.get_reply_message()
        status = "Pesan"

        # check and clear user unapproved message first
        if custom_message is not None:
            sql.delgvar("unapproved_msg")
            status = "Pesan"

        if not message:
            return await cust_msg.edit("**Mohon Reply Ke Pesan**")

        # TODO: allow user to have a custom text formatting
        # eg: bold, underline, striketrough, link
        # for now all text are in monoscape
        msg = message.message  # get the plain text
        sql.addgvar("unapproved_msg", msg)
        await cust_msg.edit("**Pesan Berhasil Disimpan Ke Room Chat**")

        if BOTLOG_CHATID:
            await cust_msg.client.send_message(
                BOTLOG_CHATID,
                f"**{status} PMPERMIT Yang Tersimpan:** \n\n{msg}",
            )

    if conf.lower() == "reset":
        if custom_message is None:
            await cust_msg.edit(
                "`Anda Telah Menghapus Pesan Custom PMPERMIT menjadi Default`"
            )

        else:
            sql.delgvar("unapproved_msg")
            await cust_msg.edit("`Pesan PMPERMIT Anda Sudah Default Sejak Awal`")
    if conf.lower() == "get":
        if custom_message is not None:
            await cust_msg.edit(
                "**Pesan PMPERMIT Yang Sekarang:**" f"\n\n{custom_message}"
            )
        else:
            await cust_msg.edit(
                "**Anda Belum Menyetel Pesan Costum PMPERMIT,**\n"
                f"**Masih Menggunakan Pesan PM Default:**\n\n{DEF_UNAPPROVED_MSG}"
            )
示例#30
0
    except AttributeError:
        await noff_event.edit("`Running on Non-SQL mode!`")
        return
    addgvar("NOTIF_OFF", True)
    await noff_event.edit("`Notifications from unapproved PM's are silenced!`")


@register(outgoing=True, pattern="^.notifon$")
async def notifon(non_event):
    """ For .notifoff command, get notifications from unapproved PMs. """
    try:
        from userbot.modules.sql_helper.globals import delgvar
    except AttributeError:
        await non_event.edit("`Running on Non-SQL mode!`")
        return
    delgvar("NOTIF_OFF")
    await non_event.edit("`Notifications from unapproved PM's unmuted!`")


@register(outgoing=True, pattern="^.approve$")
async def approvepm(apprvpm):
    """ For .approve command, give someone the permissions to PM you. """
    try:
        from userbot.modules.sql_helper.pm_permit_sql import approve
    except AttributeError:
        await apprvpm.edit("`Running on Non-SQL mode!`")
        return

    if apprvpm.reply_to_msg_id:
        reply = await apprvpm.get_reply_message()
        replied_user = await apprvpm.client.get_entity(reply.from_id)