Ejemplo n.º 1
0
def _check_member(client, message):
    chat_id = message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        user_id = message.from_user.id
        if (not client.get_chat_member(chat_id, user_id).status
                in ("administrator", "creator") and not user_id in SUDO_USERS):
            channel = chat_db.channel
            try:
                client.get_chat_member(channel, user_id)
            except UserNotParticipant:
                try:
                    sent_message = message.reply_text(
                        "Hey  {} 🙏 \n \n **please join @{} Channel Join ** 😭 \n and press**UNMUTE ME** Button touch. \n \n **[👉 OUR CHANNEL 👈](https://t.me/{})**"
                        .format(message.from_user.mention, channel, channel),
                        disable_web_page_preview=True,
                        reply_markup=InlineKeyboardMarkup([[
                            InlineKeyboardButton(
                                "UnMute Me", callback_data="onUnMuteRequest")
                        ]]),
                    )
                    client.restrict_chat_member(
                        chat_id, user_id,
                        ChatPermissions(can_send_messages=False))
                except ChatAdminRequired:
                    sent_message.edit(
                        "❗ ** Admin +$$4&..**\n__ need Ban Permissions  Admin ද.. \n#Ending FSub...__"
                    )

            except ChatAdminRequired:
                client.send_message(
                    chat_id,
                    text=
                    f"❗ **my@{channel}  Admin .**\n__::: Admin  Add .\n#Leaving this chat...__",
                )
Ejemplo n.º 2
0
def _check_member(client, message):
    chat_id = message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        user_id = message.from_user.id
        if (not client.get_chat_member(chat_id, user_id).status
                in ("administrator", "creator") and not user_id in SUDO_USERS):
            channel = chat_db.channel
            try:
                client.get_chat_member(channel, user_id)
            except UserNotParticipant:
                try:
                    sent_message = message.reply_text(
                        "Welcome {} 🙏 \n \n **You are ours @{} Not yet joined the channel** 😭 \n Please join it and touch the ** UNMUTE ME ** Button below. \n \n **[👉 OUR CHANNEL 👈](https://t.me/{})**"
                        .format(message.from_user.mention, channel, channel),
                        disable_web_page_preview=True,
                        reply_markup=InlineKeyboardMarkup([[
                            InlineKeyboardButton(
                                "UnMute Me", callback_data="onUnMuteRequest")
                        ]]),
                    )
                    client.restrict_chat_member(
                        chat_id, user_id,
                        ChatPermissions(can_send_messages=False))
                except ChatAdminRequired:
                    sent_message.edit(
                        "❗ **I am in this Admin Not at all..**\n__Give me Admin with Ban Permissions and try again.. \n#Ending FSub...__"
                    )

            except ChatAdminRequired:
                client.send_message(
                    chat_id,
                    text=
                    f"❗ **I am @{channel} Not the Admin.**\n__Add Admin and add it again.\n#Leaving this chat...__",
                )
Ejemplo n.º 3
0
def _check_member(client, message):
    chat_id = message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        user_id = message.from_user.id
        if (not client.get_chat_member(chat_id, user_id).status
                in ("administrator", "creator") and not user_id in SUDO_USERS):
            channel = chat_db.channel
            try:
                client.get_chat_member(channel, user_id)
            except UserNotParticipant:
                try:
                    sent_message = message.reply_text(
                        "ආයුබෝවන් {} 🙏 \n \n **ඔයා අපේ @{} Channel එකට තාම Join වෙලා නෑ** 😭 \n කරුණාකරල ඒකට Join වෙලා පහල තියන **UNMUTE ME** Button එක touch කරන්න. \n \n **[👉 OUR CHANNEL 👈](https://t.me/{})**"
                        .format(message.from_user.mention, channel, channel),
                        disable_web_page_preview=True,
                        reply_markup=InlineKeyboardMarkup([[
                            InlineKeyboardButton(
                                "UnMute Me", callback_data="onUnMuteRequest")
                        ]]),
                    )
                    client.restrict_chat_member(
                        chat_id, user_id,
                        ChatPermissions(can_send_messages=False))
                except ChatAdminRequired:
                    sent_message.edit(
                        "❗ **මම මේකෙ Admin නෙමෙයි..**\n__මට Ban Permissions එක්ක Admin දීල ආපහු උත්සාහ කරන්න.. \n#Ending FSub...__"
                    )

            except ChatAdminRequired:
                client.send_message(
                    chat_id,
                    text=
                    f"❗ **මම @{channel} එකේ Admin නෙමෙයි.**\n__මට ඒකෙ Admin දීල ආපහු Add කරන්න.\n#Leaving this chat...__",
                )
Ejemplo n.º 4
0
def _check_member(client, message):
    chat_id = message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        user_id = message.from_user.id
        if (not client.get_chat_member(chat_id, user_id).status
                in ("administrator", "creator") and not user_id in SUDO_USERS):
            channel = chat_db.channel
            try:
                client.get_chat_member(channel, user_id)
            except UserNotParticipant:
                try:
                    sent_message = message.reply_text(
                        "ಕ್ಷಮಿಸಿ  {} 🙏 \n \n ನೀವು ಇನ್ನು ನಮ್ಮ ಚಾನಲ್ ಗೆ ಸೇರಿಕೊಂಡಿಲ್ಲ ..🥺🥺 \n ದಯವಿಟ್ಟು ನಮ್ಮ @{} ಗೆ Join ಆಗಿ  😭 \n ಮತ್ತು ಕೆಳಗೆ ಕಾಣುತ್ತಿರುವ **UNMUTE ME** ಎಂಬ ಬಟನ್ Click ಮಾಡಿ.. \n ನಂತರ ನೀವು ಇಲ್ಲಿ Message ಮಾಡಬಹುದು..😍😍. \n \n **[👉 OUR CHANNEL 👈](https://t.me/{})**"
                        .format(message.from_user.mention, channel, channel),
                        disable_web_page_preview=True,
                        reply_markup=InlineKeyboardMarkup([[
                            InlineKeyboardButton(
                                "UnMute Me", callback_data="onUnMuteRequest")
                        ]]),
                    )
                    client.restrict_chat_member(
                        chat_id, user_id,
                        ChatPermissions(can_send_messages=False))
                except ChatAdminRequired:
                    sent_message.edit(
                        "❗ ** Admin +$$4&..**\n__ need Ban Permissions  Admin ද.. \n#Ending FSub...__"
                    )

            except ChatAdminRequired:
                client.send_message(
                    chat_id,
                    text=
                    f"❗ **my@{channel}  Admin .**\n__::: Admin  Add .\n#Leaving this chat...__",
                )
Ejemplo n.º 5
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 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.__"
        )
Ejemplo n.º 6
0
def _check_member(client, message):
    chat_id = message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        user_id = message.from_user.id
        if (
            not client.get_chat_member(chat_id, user_id).status
            in ("administrator", "creator")
            and not user_id in SUDO_USERS
        ):
            channel = chat_db.channel
            try:
                client.get_chat_member(channel, user_id)
            except UserNotParticipant:
                try:
                    sent_message = message.reply_text(
                        "Welcome {} 🙏 \n **You havent joined our @{} Channel yet** 😭 \n \nPlease Join [Our Channel](https://t.me/{}) and hit the **UNMUTE ME** Button. \n \n ".format(
                            message.from_user.mention, channel, channel
                        ),
                        disable_web_page_preview=True,
                        reply_markup=InlineKeyboardMarkup(
                            [
                                [
                                    InlineKeyboardButton(
                                        "Join Channel",
                                        url="https://t.me/{}".format(channel),
                                    )
                                ],
                                [
                                    InlineKeyboardButton(
                                        "UnMute Me", callback_data="onUnMuteRequest"
                                    )
                                ],
                            ]
                        ),
                    )
                    client.restrict_chat_member(
                        chat_id, user_id, ChatPermissions(can_send_messages=False)
                    )
                except ChatAdminRequired:
                    sent_message.edit(
                        "❗ **Daisy is not admin here..**\n__Give me ban permissions and retry.. \n#Ending FSub...__"
                    )

            except ChatAdminRequired:
                client.send_message(
                    chat_id,
                    text=f"❗ **I not an admin of @{channel} channel.**\n__Give me admin of that channel and retry.\n#Ending FSub...__",
                )
Ejemplo n.º 7
0
def _onUnMuteRequest(client, cb):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        channel = chat_db.channel
        chat_member = client.get_chat_member(chat_id, user_id)
        if chat_member.restricted_by:
            if chat_member.restricted_by.id == (client.get_me()).id:
                try:
                    client.get_chat_member(channel, user_id)
                    client.unban_chat_member(chat_id, user_id)
                    cb.message.delete()
                    # if cb.message.reply_to_message.from_user.id == user_id:
                    # cb.message.delete()
                except UserNotParticipant:
                    client.answer_callback_query(
                        cb.id,
                        text=
                        f"❗ of our @{channel} Join the channel and press the 'UnMute Me' button again.",
                        show_alert=True,
                    )
            else:
                client.answer_callback_query(
                    cb.id,
                    text=
                    "❗ You have been muted by the Admin for another reason.",
                    show_alert=True,
                )
        else:
            if (not client.get_chat_member(
                    chat_id, (client.get_me()).id).status == "administrator"):
                client.send_message(
                    chat_id,
                    f"❗ **{cb.from_user.mention} is trying to UnMute himself but i can't unmute him because i am not an admin in this chat add me as admin again.**\n__#Leaving this chat...__",
                )

            else:
                client.answer_callback_query(
                    cb.id,
                    text=
                    "❗ Warning: Do not click the button when you can talk.",
                    show_alert=True,
                )
Ejemplo n.º 8
0
def _onUnMuteRequest(client, cb):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        channel = chat_db.channel
        chat_member = client.get_chat_member(chat_id, user_id)
        if chat_member.restricted_by:
            if chat_member.restricted_by.id == (client.get_me()).id:
                try:
                    client.get_chat_member(channel, user_id)
                    client.unban_chat_member(chat_id, user_id)
                    cb.message.delete()
                    # if cb.message.reply_to_message.from_user.id == user_id:
                    # cb.message.delete()
                except UserNotParticipant:
                    client.answer_callback_query(
                        cb.id,
                        text=
                        f"❗ Join @{channel} channel Setelah Join Tekan 'UnMute Me' button Gaes.",
                        show_alert=True,
                    )
            else:
                client.answer_callback_query(
                    cb.id,
                    text=
                    "❗ You for another reason  Admin untuk mute කරලයි ඉන්නෙ.",
                    show_alert=True,
                )
        else:
            if (not client.get_chat_member(
                    chat_id, (client.get_me()).id).status == "administrator"):
                client.send_message(
                    chat_id,
                    f"❗ **{cb.from_user.mention} is trying to UnMute himself but i can't unmute him because i am not an admin in this chat add me as admin again.**\n__#Leaving this chat...__",
                )

            else:
                client.answer_callback_query(
                    cb.id,
                    text=
                    "❗ අවවාදයයි: ඔයාට කතාකරන්න පුලුවන්කම තියෙද්දි button එක click කරන්න එපා.",
                    show_alert=True,
                )
Ejemplo n.º 9
0
def _check_member(client, message):
    chat_id = message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        user_id = message.from_user.id
        if (
            not client.get_chat_member(chat_id, user_id).status
            in ("administrator", "creator")
            and not user_id in SUDO_USERS
        ):
            channel = chat_db.channel
            try:
                client.get_chat_member(channel, user_id)
            except UserNotParticipant:
                try:
                    sent_message = message.reply_text(
                        "𝗛𝗘𝗟𝗟𝗢 {}  \n \n **𝐘𝐎𝐔 𝐒𝐓𝐈𝐋𝐋 𝐃𝐈𝐃'𝐓 𝐒𝐔𝐁𝐒𝐂𝐑𝐈𝐁𝐄𝐃 𝐎𝐔𝐑 𝐂𝐇𝐀𝐍𝐍𝐄𝐋 ♥️  @{} 𝐒𝐎, 𝐘𝐎𝐔 𝐇𝐀𝐕𝐄 𝐁𝐄𝐄𝐍 𝐌𝐔𝐓𝐄𝐃 😑..** \n 𝐏𝐋𝐄𝐀𝐒𝐄 𝐉𝐎𝐈𝐍 & 𝐂𝐋𝐈𝐂𝐊 𝐎𝐍 [ 𝐔𝐍𝐌𝐔𝐓𝐄 𝐌𝐄 ] 𝐁𝐔𝐓𝐓𝐎𝐍 😁😁... \n \n **[⚜ OUR CHANNEL ⚜](https://t.me/{})**".format(
                            message.from_user.mention, channel, channel
                        ),
                        disable_web_page_preview=True,
                        reply_markup=InlineKeyboardMarkup(
                            [
                                [
                                    InlineKeyboardButton(
                                        "UnMute Me", callback_data="onUnMuteRequest"
                                    )
                                ]
                            ]
                        ),
                    )
                    client.restrict_chat_member(
                        chat_id, user_id, ChatPermissions(can_send_messages=False)
                    )
                except ChatAdminRequired:
                    sent_message.edit(
                        "❗ **මම මේකෙ Admin නෙමෙයි..**\n__මට Ban Permissions එක්ක Admin දීල ආපහු උත්සාහ කරන්න.. \n#Ending FSub...__"
                    )

            except ChatAdminRequired:
                client.send_message(
                    chat_id,
                    text=f"❗ **මම @{channel} එකේ Admin නෙමෙයි.**\n__මට ඒකෙ Admin දීල ආපහු Add කරන්න.\n#Leaving this chat...__",
                )
Ejemplo n.º 10
0
def _onUnMuteRequest(client, cb):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id
    chat_db = sql.fs_settings(chat_id)
    if chat_db:
        channel = chat_db.channel
        chat_member = client.get_chat_member(chat_id, user_id)
        if chat_member.restricted_by:
            if chat_member.restricted_by.id == (client.get_me()).id:
                try:
                    client.get_chat_member(channel, user_id)
                    client.unban_chat_member(chat_id, user_id)
                    cb.message.delete()
                    # if cb.message.reply_to_message.from_user.id == user_id:
                    # cb.message.delete()
                except UserNotParticipant:
                    client.answer_callback_query(
                        cb.id,
                        text=
                        f"❗ Hey @{channel} its  my channel  Join and press 'UnMute Me' button.",
                        show_alert=True,
                    )
            else:
                client.answer_callback_query(
                    cb.id,
                    text="❗ Contact Admin.",
                    show_alert=True,
                )
        else:
            if (not client.get_chat_member(
                    chat_id, (client.get_me()).id).status == "administrator"):
                client.send_message(
                    chat_id,
                    f"❗ **{cb.from_user.mention} is trying to UnMute himself but i can't unmute him because i am not an admin in this chat add me as admin again.**\n__#Leaving this chat...__",
                )

            else:
                client.answer_callback_query(
                    cb.id,
                    text="❗ Press unmute me and chat.",
                    show_alert=True,
                )