Exemplo n.º 1
0
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator" or user.user.id in Config.SUDO_USERS:
        chat_id = message.chat.id
        if len(message.command) > 1:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
            if input_str.lower() in ("off", "no", "disable"):
                sql.disapprove(chat_id)
                message.reply_text(
                    "❌ **Force Subscribe Berhasil Dinonaktifkan.**")
            elif input_str.lower() in ('clear'):
                sent_message = message.reply_text(
                    '**Membatalkan aksi pembisuan semua anggota yang dibisukan oleh saya...**'
                )
                try:
                    for chat_member in client.get_chat_members(
                            message.chat.id, filter="restricted"):
                        if chat_member.restricted_by.id == (
                                client.get_me()).id:
                            client.unban_chat_member(chat_id,
                                                     chat_member.user.id)
                            time.sleep(1)
                    sent_message.edit(
                        '✅ **Mensuarakan semua anggota yang dibisukan oleh saya.**'
                    )
                except ChatAdminRequired:
                    sent_message.edit(
                        '❗ **Saya bukan admin dalam obrolan ini.**\n__Saya tidak dapat membisukan anggota karena saya bukan admin dalam obrolan ini, jadikan saya admin dengan izin blokir pengguna.__'
                    )
            else:
                try:
                    client.get_chat_member(input_str, "me")
                    sql.add_channel(chat_id, input_str)
                    message.reply_text(
                        f"✅ **Force Subscribe berhasil diaktifkan, semua anggota grup harus bergabung di [channel](https://t.me/{input_str}) ini untuk dapat mengirim pesan dengan bebas.__",
                        disable_web_page_preview=True)
                except UserNotParticipant:
                    message.reply_text(
                        f"❗ **Bukan Admin di Channel**\n__Saya bukan admin di [channel](https://t.me/{input_str}). Tambahkan saya sebagai admin untuk mengaktifkan Fitur ini.__",
                        disable_web_page_preview=True)
                except (UsernameNotOccupied, PeerIdInvalid):
                    message.reply_text(f"❗ **Username Channel tidak benar.**")
                except Exception as err:
                    message.reply_text(f"❗ **ERROR:** ```{err}```")
        else:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Force Subscribe diaktifkan dalam obrolan ini.**\n__Untuk [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
            else:
                message.reply_text(
                    "❌ **Force Subscribe dinonaktifkan dalam obrolan ini.**")
    else:
        message.reply_text(
            "❗ **Pemilik Grup Diperlukan**\n__Anda harus menjadi pemilik grup untuk mengaktifkannya.__"
        )
Exemplo n.º 2
0
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator" or user.user.id in Config.SUDO_USERS:
        chat_id = message.chat.id
        if len(message.command) > 1:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
            if input_str.lower() in ("off", "no", "disable"):
                sql.disapprove(chat_id)
                message.reply_text(
                    "❌ **Perintah Subscribe Dinonaktifkan 'Berhasil'.**")
            elif input_str.lower() in ('clear'):
                sent_message = message.reply_text(
                    '**Menormalkan kembali semua member yang dibisukan...**')
                try:
                    for chat_member in client.get_chat_members(
                            message.chat.id, filter="restricted"):
                        if chat_member.restricted_by.id == (
                                client.get_me()).id:
                            client.unban_chat_member(chat_id,
                                                     chat_member.user.id)
                            time.sleep(1)
                    sent_message.edit(
                        '✅ **Menormalkan kembali semua member yang dibisukan.**'
                    )
                except ChatAdminRequired:
                    sent_message.edit(
                        '❗ **Saya bukan admin di chat ini.**\n__saya dak pacak unmute members krna bukan admin di grup ini, jadikan aku admin dan izinkan perintah banned user ya.__'
                    )
            else:
                try:
                    client.get_chat_member(input_str, "me")
                    sql.add_channel(chat_id, input_str)
                    message.reply_text(
                        f"✅ **Force Subscribe Di Aktifkan**\n__Force Subscribe lah diaktifkan ya, semua member grup harus subscribe/join ke channel >> [channel](https://t.me/{input_str}) supaya bisa chat di grup kembali.__",
                        disable_web_page_preview=True)
                except UserNotParticipant:
                    message.reply_text(
                        f"❗ **aku bukan admin dichannel**\n__Aku bukan admin di channel >> [channel](https://t.me/{input_str}). tambahkan aku sebagai admin untuk Mengaktifkan ForceSubscribe.__",
                        disable_web_page_preview=True)
                except (UsernameNotOccupied, PeerIdInvalid):
                    message.reply_text(
                        f"❗ **Nama 'Username Channelnya' salah ouy.**")
                except Exception as err:
                    message.reply_text(f"❗ **neh salah :** ```{err}```")
        else:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Alhamdulillah Force Subscribe telah diaktifkan di sini.**\n__Silahkan Follow yaa >>> [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
            else:
                message.reply_text(
                    "❌ **Hmm... Force Subscribe tidak diaktifkan di sini.**")
    else:
        message.reply_text(
            "❗ **Kita kenal ?**\n__Maaf mengatakan ini :p Sepertinya kita belum saling mengenal wkwk.__"
        )
Exemplo n.º 3
0
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator" or user.user.id in Config.SUDO_USERS:
        chat_id = message.chat.id
        if len(message.command) > 1:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
            if input_str.lower() in ("off", "no", "disable"):
                sql.disapprove(chat_id)
                message.reply_text(
                    "❌ **Force Subscribe is Disabled Successfully.**")
            elif input_str.lower() in ('clear'):
                sent_message = message.reply_text(
                    '**Unmuting all members who are muted by me...**')
                try:
                    for chat_member in client.get_chat_members(
                            message.chat.id, filter="restricted"):
                        if chat_member.restricted_by.id == (
                                client.get_me()).id:
                            client.unban_chat_member(chat_id,
                                                     chat_member.user.id)
                            time.sleep(1)
                    sent_message.edit(
                        '✅ **Finally UnMuted all members who are muted by me.**'
                    )
                except ChatAdminRequired:
                    sent_message.edit(
                        '❗ **I am not an admin in this chat.**\n__I can\'t unmute members because i am not an admin in this chat make me admin with ban user permission.__'
                    )
            else:
                try:
                    client.get_chat_member(input_str, "me")
                    sql.add_channel(chat_id, input_str)
                    message.reply_text(
                        f"✅ **Great Force Subscribe is Enabled**\n__Force Subscribe is enabled, all the group members have to subscribe this [channel](https://t.me/{input_str}) in order to send messages in this group.__",
                        disable_web_page_preview=True)
                except UserNotParticipant:
                    message.reply_text(
                        f"❗ **Not an Admin in the Channel**\n__I am not an admin in the [channel](https://t.me/{input_str}). Add me as a admin in order to enable ForceSubscribe.__",
                        disable_web_page_preview=True)
                except (UsernameNotOccupied, PeerIdInvalid):
                    message.reply_text(f"❗ **Invalid Channel Username.**")
                except Exception as err:
                    message.reply_text(f"❗ **ERROR:** ```{err}```")
        else:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Force Subscribe is enabled in this chat.**\n__For this [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
            else:
                message.reply_text(
                    "❌ **Oops, Force Subscribe is disabled in this chat.**")
    else:
        message.reply_text(
            "❗ **Group Creator Required**\n__You have to be the group creator to do that.__"
        )
Exemplo n.º 4
0
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator" or user.user.id in Config.SUDO_USERS:
        chat_id = message.chat.id
        if len(message.command) > 1:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
            if input_str.lower() in ("off", "no", "disable"):
                sql.disapprove(chat_id)
                message.reply_text(
                    "❌ **Force Subscribe is Disabled Successfully.**")
            elif input_str.lower() in ('clear'):
                sent_message = message.reply_text(
                    '**Unmuting All Members Who Are Muted By Me...**')
                try:
                    for chat_member in client.get_chat_members(
                            message.chat.id, filter="restricted"):
                        if chat_member.restricted_by.id == (
                                client.get_me()).id:
                            client.unban_chat_member(chat_id,
                                                     chat_member.user.id)
                            time.sleep(1)
                    sent_message.edit(
                        '✅ **UnMuted All Members Who Are Muted By Me.**')
                except ChatAdminRequired:
                    sent_message.edit(
                        '❗ **I Am Not An Admin In This Chat.**\n__I Can\'t Unmute Members Because I Am Not An Admin In This Chat Make Me Admin With Ban User Permission.__'
                    )
            else:
                try:
                    client.get_chat_member(input_str, "me")
                    sql.add_channel(chat_id, input_str)
                    message.reply_text(
                        f"✅ **Force Subscribe is Enabled**\n__Force Subscribe is Enabled, All The Group Members Have To Subscribe This [Channel](https://t.me/{input_str}) In Order To Send Messages In This Group.__",
                        disable_web_page_preview=True)
                except UserNotParticipant:
                    message.reply_text(
                        f"❗ **Not an Admin In The Channel**\n__I Am Not An Admin In The [Channel](https://t.me/{input_str}). Add Me As A Admin In Order To Enable ForceSubscribe.__",
                        disable_web_page_preview=True)
                except (UsernameNotOccupied, PeerIdInvalid):
                    message.reply_text(f"❗ **Invalid Channel Username.**")
                except Exception as err:
                    message.reply_text(f"❗ **ERROR:** ```{err}```")
        else:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Force Subscribe Is Enabled In This Chat.**\n__For This [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
            else:
                message.reply_text(
                    "❌ **Force Subscribe Is Disabled In This Chat.**")
    else:
        message.reply_text(
            "❗ **Group Creator Required**\n__You Have To Be The Group Creator To Do That.__"
        )
Exemplo n.º 5
0
def fsub(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator" or user.user.id in Config.SUDO_USERS:
        chat_id = message.chat.id
        if len(message.command) > 1:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
            if input_str.lower() in ("off", "no", "disable"):
                sql.disapprove(chat_id)
                message.reply_text("❌ **Desactivado correctamente.**")
            elif input_str.lower() in ('clear'):
                sent_message = message.reply_text('**Actualizando...**')
                try:
                    for chat_member in client.get_chat_members(
                            message.chat.id, filter="restricted"):
                        if chat_member.restricted_by.id == (
                                client.get_me()).id:
                            client.unban_chat_member(chat_id,
                                                     chat_member.user.id)
                            time.sleep(1)
                    sent_message.edit(
                        '✅ **Ya pueden escribir todos los miembros que he silenciado.**'
                    )
                except ChatAdminRequired:
                    sent_message.edit(
                        '❗ **No soy administrador en este grupo.**\n__No puedo silenciar a los miembros si no me otorgas todos los permisos.__'
                    )
            else:
                try:
                    client.get_chat_member(input_str, "me")
                    sql.add_channel(chat_id, input_str)
                    message.reply_text(
                        f"✅ **El bot está habilitado**\n__Todos los mimbros del grupo tendrán que estar suscrito a [Anuncios_cu](https://t.me/{input_str}) para poder enviar mensajes al grupo.__",
                        disable_web_page_preview=True)
                except UserNotParticipant:
                    message.reply_text(
                        f"❗ **No soy administrador en el canal.**\n__Añádeme a [channel](https://t.me/{input_str}). Y otórgame todos los permisos.__",
                        disable_web_page_preview=True)
                except (UsernameNotOccupied, PeerIdInvalid):
                    message.reply_text(f"❗ **Username del canal inválido.**")
                except Exception as err:
                    message.reply_text(f"❗ **ERROR:** ```{err}```")
        else:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Está activo en este grupo.**\n__Para el Canal [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
            else:
                message.reply_text("❌ **No está activado en este grupo.**")
    else:
        message.reply_text(
            "❗ **Creador del grupo requerido.**\n__Tienes que ser el creador del grupo para usar el bot acá.__"
        )
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status == "creator" or user.user.id in Config.SUDO_USERS:
        chat_id = message.chat.id
        if len(message.command) > 1:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
            if input_str.lower() in ("off", "no", "disable"):
                sql.disapprove(chat_id)
                message.reply_text(
                    "❌ **Force Subscribe is Disabled Successfully.**")
            elif input_str.lower() in ('clear'):
                sent_message = message.reply_text(
                    '**Unmuting all members who are muted by me...**')
                try:
                    for chat_member in client.get_chat_members(
                            message.chat.id, filter="restricted"):
                        if chat_member.restricted_by.id == (
                                client.get_me()).id:
                            client.unban_chat_member(chat_id,
                                                     chat_member.user.id)
                            time.sleep(1)
                    sent_message.edit(
                        '✅ **UnMuted all members who are muted by me.**')
                except ChatAdminRequired:
                    sent_message.edit(
                        '❗ **I am not an admin in this chat.**\n__I can\'t unmute members because i am not an admin in this chat make me admin with ban user permission.__'
                    )
            else:
                swo, wso = get_valid_channels(message)
                if not swo:
                    message.reply_text(wso, disable_web_page_preview=True)
                    return
                input_str = ".".join(wso)
                mmo = "@" + " @".join(wso)
                sql.add_channel(chat_id, input_str)
                message.reply_text(
                    f"✅ **Force Subscribe is Enabled**\n__Force Subscribe is enabled, all the group members have to subscribe these {mmo} channels in order to send messages in this group.__",
                    disable_web_page_preview=True)
        else:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Force Subscribe is enabled in this chat.**\n__For this [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
            else:
                message.reply_text(
                    "❌ **Force Subscribe is disabled in this chat.**")
    else:
        message.reply_text(
            "❗ **Group Creator Required**\n__You have to be the group creator to do that.__"
        )
Exemplo n.º 7
0
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator":
        chat_id = message.chat.id
        try:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
        except IndexError:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"✅ **Force Subscribe is enabled in this chat.**\n__For this [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__",
                    disable_web_page_preview=True)
                return
            else:
                message.reply_text(
                    "❌ **Force Subscribe is disabled in this chat.**")
                return
        if input_str.lower() in ("off", "no", "disable"):
            sql.disapprove(chat_id)
            message.reply_text(
                "❌ **Force Subscribe is Disabled Successfully.**")
        elif input_str:
            try:
                client.get_chat_member(input_str, "me")
                sql.add_channel(chat_id, input_str)
                message.reply_text(
                    f"✅ **Force Subscribe is Enabled**\n__Force Subscribe is enabled, all the group members have to subscribe this [channel](https://t.me/{input_str}) in order to send messages in this group.",
                    disable_web_page_preview=True)
            except pyrogram.errors.exceptions.bad_request_400.UserNotParticipant:
                message.reply_text(
                    f"❗ **Not an Admin in the Channel**\n__I am not an admin in the [channel](https://t.me/{input_str}). Add me as a admin in order to enable ForceSubscribe.__",
                    disable_web_page_preview=True)
            except pyrogram.errors.exceptions.bad_request_400.UsernameNotOccupied:
                message.reply_text(f"❗ **Invalid Channel Username.**")
            except ValueError:
                message.reply_text(f"❗ **Invalid Channel Username.**")
        else:
            message.reply_text("⚠️ **Something went wrong.**")
    else:
        message.reply_text(
            "❗ **Group Creator Required**\n__You have to be the group creator to do that.__"
        )
Exemplo n.º 8
0
def config(client, message):
    user = client.get_chat_member(message.chat.id, message.from_user.id)
    if user.status is "creator":
        chat_id = message.chat.id
        try:
            input_str = message.command[1]
            input_str = input_str.replace("@", "")
        except IndexError:
            if sql.fs_settings(chat_id):
                message.reply_text(
                    f"Force Subscribe is **enabled** in this chat.\nChannel - @{sql.fs_settings(chat_id).channel}"
                )
                return
            else:
                message.reply_text(
                    "Force Subscribe is **disabled** in this chat.")
                return
        if input_str.lower() in ("off", "no", "disable"):
            sql.disapprove(chat_id)
            message.reply_text("Force Subscribe is **Disabled**")
        elif input_str:
            try:
                client.get_chat_member(input_str, "me")
                sql.add_channel(chat_id, input_str)
                message.reply_text(
                    f"Force Subscribe is **enabled** for this chat\nChannel - @{input_str}"
                )
            except pyrogram.errors.exceptions.bad_request_400.UserNotParticipant:
                message.reply_text(
                    f"I am not an admin in @{input_str}\nAdd me on your channel as admin and send the command again."
                )
            except pyrogram.errors.exceptions.bad_request_400.UsernameNotOccupied:
                message.reply_text(f"Invalid Channel Username")
            except ValueError:
                message.reply_text(
                    f"@{input_str} didn't belongs to a channel.")
        else:
            message.reply_text("Something went wrong")
    else:
        message.reply_text("You have to be the **Group Creator** to do that.")