Beispiel #1
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if should_ban:
        try:
            chat.kick_member(user.id)
            msg.reply_text("Kullanıcı flood yaptığı için gruptan " "atıldı.")

            return "<b>{}:</b>" \
                   "\n#BANNED" \
                   "\n<b>User:</b> {}" \
                   "\nFlooded the group.".format(html.escape(chat.title),
                                                 mention_html(user.id, user.first_name))

        except BadRequest:
            msg.reply_text(
                "Burada insanları atma yetkisini ver! O zamana kadar, antiflood'u devre dışı bırakacağım."
            )
            sql.set_flood(chat.id, 0)
            return "<b>{}:</b>" \
                   "\n#INFO" \
                   "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)

    return ""
Beispiel #2
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text(get_string("antiflood", "MSG_KICK", lang.get_lang(update.effective_chat.id))) # MSG_KICK

        return get_string("antiflood", "MSG_KICK_HTML", lang.get_lang(update.effective_chat.id)).format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name)) # MSG_KICK_HTML

    except BadRequest:
        msg.reply_text(get_string("antiflood", "ERR_NO_PERMS", lang.get_lang(update.effective_chat.id))) # ERR_NO_PERMS
        sql.set_flood(chat.id, 0)
        return get_string("antiflood", "ERR_NO_PERMS_HTML", lang.get_lang(update.effective_chat.id)).format(chat.title) # ERR_NO_PERMS_HTML
Beispiel #3
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("flood atma lan sie")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("Bana izin vermediğiniz sürece bu hizmeti kullanamazsınız.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nkullanıcı atmak için izim yok antiflood deve dışı.".format(chat.title)
Beispiel #4
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text(
            "අන් අයට බාධා නොකරන්න ඔබ තවදුරටත් මෙම කණ්ඩායමට අවශ්‍ය නැත...")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "ඔබ මට අවසර ලබා නොදෙන තාක් කල් ඔබට මෙම සේවාව භාවිතා කළ නොහැක.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nකික් අවසර නැත, එබැවින් ස්වයංක්‍රීයව ඇන්ටිෆ්ලූඩ් අක්‍රීය කරන්න.".format(chat.title)
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("Przestań przeskadzać innym futrzakom. Nie jesteś dłużej potrzebny na tej grupie...")

        return "<b>{}:</b>" \
               "\n#ZBANOWANY" \
               "\n<b>Futrzak:</b> {}" \
               "\nSpam na grupie.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("Nie możesz korzystać z tej usługi, dopóki nie dasz mi uprawnień.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFORMACJA" \
               "\nBrak uprawnień do wyrzucania, więc automatycznie wyłączona anty-spam.".format(chat.title)
Beispiel #6
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("başqlarını narahat etmə! Bu qrupda sənə yer yoxdu!")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlood etdi. Bu qrupa -->.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "Mənə lazımi səlahiyyətlər verməyincə bu xidmətdən istifadə edə bilməzsiniz."
        )
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nQrupdan atmaq icazəniz yoxdur, buna görə də antiflood avtomatik olaraq söndürüldü.".format(chat.title)
Beispiel #7
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text(
            "لا تزعج الآخرين أنك لا حاجة لهذه المجموعة بعد الآن ...")

        return "<b>{}:</b>" \
               "\n#حظر" \
               "\n<b>للمستخدم:</b> {}" \
               "\nغمرت المجموعة.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "لا يمكنك استخدام هذه الخدمة طالما أنك لا تعطيني أذونات.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#معلومات" \
               "\nليس لديك أذونات ركلة، لذلك تعطيلها تلقائيا Antiflood.".format(chat.title)
Beispiel #8
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text(
            "başkalarını rahatsız etme artık bu gruba ihtiyacın yok ...")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\Grubu flood altında bıraktı.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "Bana İzin vermediğiniz sürece bu hizmeti kullanamazsınız.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nAntiflood izinleriniz yok, bu nedenle antiflood otomatik olarak devre dışı bırakılır.".format(chat.title)
Beispiel #9
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("dont disturb others you are No need for this group anymore...")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("You cannot use this service as long as you do not give me Permissions.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #10
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("من همرو دوست دارم . ولی توو ، تو فقط باعث ناامیدی گونه بشریتی  "
                       "گمشو بیرون😒.")

        return "<b>{}:</b>" \
               "\n#بن_شد" \
               "\n<b>کاربر:</b> {}" \
               "\nاسپم داخل گپ.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("من نمیتونم کسیو بیرون کنم اینجا .اجازشو ندارم! پس تا اونموقع حالت ضد تکرار خاموش.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#اطلاعات" \
               "\nاجازه اخراج کسیو ندارم ، تا اونموقع ضد تکرار خاموش.".format(chat.title)
Beispiel #11
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins and whitelists
    if is_user_admin(chat, user.id) or user.id in WHITELIST_USERS:
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("*Normal Punches the user because of spamming* ")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("I can't kick people here, give me permissions first! Until then, I'll disable antiflood.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #12
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("jangan ganggu orang lain kamu tidak lagi diperlukan di grup ini lagi")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("jadikan saya admin dulu")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\ntidak memilikin izin kick".format(chat.title)
Beispiel #13
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("താൻ എന്തൊരു വെറുപ്പിക്കൽ ആണെടോ... ഇങ്ങനെ നിർത്താതെ മെസ്സേജ് അയച്ചാൽ മറ്റുള്ളവർക്ക് ശല്യം ആകില്ലേ.... തന്നെ ഇനി ഈ ഗ്രൂപ്പിന് ആവിശ്യം ഇല്ല ഇറങ്ങി പൊക്കോ....")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("നിങ്ങൾ എനിക്ക് Permissions തരാത്ത കാലത്തോളം ഈ സേവനം നിങ്ങൾക്ക് ഉപയോഗിക്കാൻ കഴിയില്ല.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #14
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("Flooding = Spaming and Spaming leads to BAN 😁...")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlood kar rha tha.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "Ap laga do setting lekin pehle admin banao aur permission do😞")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nkick karne ki permission nhi...disabling anti-flooding...😞".format(chat.title)
Beispiel #15
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("I like to leave the flooding to natural disasters. But you, you were just a "
                       "disappointment. Get out.")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("I can't kick people here, give me permissions first! Until then, I'll disable antiflood.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #16
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "ناتوانم خەڵک دەربکەم، بزانە مافی پێویستم هەیە. هەتاوەکو ئەوکاتەی مافی پێویستم دەدەیتێ دژەدووبارەبوونەوە دەوەستێنم."
        )
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #17
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("തുടർച്ചയായി മെസ്സേജ് അയച്ച് സ്പാം ചെയ്തതിനാൽ താങ്കളെ ഗ്രൂപ്പിൽ നിന്നും പുറത്താക്കുന്നു... Goodbye!")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("നിങ്ങൾ എനിക്ക് Permissions തരാത്ത കാലത്തോളം ഈ സേവനം നിങ്ങൾക്ക് ഉപയോഗിക്കാൻ കഴിയില്ല.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #18
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text(
            "Başkalarını rahatsız edemezsin, artık sana ihtiyacımız yok...")

        return "<b>{}:</b>" \
               "\n#Banlandı" \
               "\n<b>Kullanıcı:</b> {}" \
               "\nGrupta flood yaptı.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "Bana yetki vermediğiniz sürece bu hizmeti kullanamazsınız.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#Bilgi" \
               "\nBan izinine sahip değilim, bu yüzden antiflood otomatik olarak devre dışı bırakıldı.".format(chat.title)
def check_flood(update: Update, context) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("메시지를 한 번에 너무 많이 보낸 이유로 강퇴 당하셨습니다!")

        return "<b>{}:</b>" \
               "\n#밴" \
               "\n<b>사용자:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("강퇴시킬 수 없어요! 저에게 권한을 주실 때까지 도배 방지 기능은 사용할 수 없어요.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#정보" \
               "\n저에게 사용자 차단 권한이 없기 때문에 도배 방지 기능이 자동으로 비활성화됩니다!".format(chat.title)
Beispiel #20
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text(
            "Başkalarını Rahatsız Etme Artık Bu Grupta Yerin Yok...")

        return "<b>{}:</b>" \
               "\n#BAN" \
               "\n<b>Kullanıcı:</b> {}" \
               "\nGrupta Flood.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "Bana İzin Vermediğiniz Sürece Bu Hizmeti Kullanamazsınız.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#BİLGİ" \
               "\nYetkim Yok Antiflood Devre Dışı.".format(chat.title)
Beispiel #21
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("من همرو دوست دارم . ولی توو ، تو فقط باعث ناامیدی گونه بشریتی  "
                       "گمشو بیرون😒.")

        return "<b>{}:</b>" \
               "\n#BANNED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("من نمیتونم کسیو بیرون کنم اینجا .اجازشو ندارم! پس تا اونموقع حالت ضد تکرار.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #22
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        chat.kick_member(user.id)
        msg.reply_text("Das ist eine Nachricht zu viel. Raus hier.")

        return "<b>{}:</b>" \
               "\n#Verbannt" \
               "\n<b>User:</b> {}" \
               "\nHat die Gruppe vollgespammt".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "Ich benötige die Berechtigung, Leute zu kicken, damit du diese Funktion aktivieren kannst."
        )
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nIch habe die Berechtigung nicht, deshalb habe ich Antiflood deaktiviert.".format(chat.title)
Beispiel #23
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        bot.restrict_chat_member(chat.id, user.id, can_send_messages=False)
        msg.reply_text("ഫ്ലഡ് ചെയ്യുന്നോ... നിങ്ങൾക്കായി ഒരു കണ്ടം ഒരുക്കിയിട്ടുണ്ട്...   ഒന്ന് ഓടിയിട്ട് വരൂ...")

        return "<b>{}:</b>" \
               "\n#mutED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("I can't mute people here, give me permissions first! Until then, I'll disable antiflood.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have mute permissions, so automatically disabled antiflood.".format(chat.title)
Beispiel #24
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    if user.id == 777000:  # ignore Telegram
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_mute = sql.update_flood(chat.id, user.id)
    if not should_mute:
        return ""

    try:
        bot.restrict_chat_member(chat.id, user.id, can_send_messages=False)

        keyboard = InlineKeyboardMarkup([[
            InlineKeyboardButton("Unmute",
                                 callback_data="unmute_flooder({})".format(
                                     user.id))
        ]])
        try:
            msg.reply_text(
                f"{mention_html(user.id, user.first_name)} has been muted for flooding the group!",
                reply_markup=keyboard,
                parse_mode="HTML")
        except BadRequest as e:
            if e.message == "Reply message not found":
                bot.send_message(
                    chat.id,
                    f"{mention_html(user.id, user.first_name)} has been muted for flooding the group!",
                    reply_markup=keyboard,
                    parse_mode="HTML")
            else:
                pass



        return "<b>{}:</b>" \
               "\n#MUTED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "I can't mute people here, give me permissions first! Until then, I'll disable antiflood."
        )
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled antiflood.".format(chat.title)
def check_flood(update, context) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    try:
        getmode, getvalue = sql.get_flood_setting(chat.id)
        if getmode == 1:
            chat.kick_member(user.id)
            execstrings = ("Banned")
            tag = "BANNED"
        elif getmode == 2:
            chat.kick_member(user.id)
            chat.unban_member(user.id)
            execstrings = ("Kicked")
            tag = "KICKED"
        elif getmode == 3:
            context.bot.restrict_chat_member(chat.id, user.id, permissions=ChatPermissions(can_send_messages=False))
            execstrings = ("Muted")
            tag = "MUTED"
        elif getmode == 4:
            bantime = extract_time(msg, getvalue)
            chat.kick_member(user.id, until_date=bantime)
            execstrings = ("Banned for {}".format(getvalue))
            tag = "TBAN"
        elif getmode == 5:
            mutetime = extract_time(msg, getvalue)
            context.bot.restrict_chat_member(chat.id, user.id, until_date=mutetime, permissions=ChatPermissions(can_send_messages=False))
            execstrings = ("Muted for {}".format(getvalue))
            tag = "TMUTE"
        send_message(update.effective_message, "Great, I like to leave flooding to natural disasters but you, "
                       "you were just a disappointment. {}!".format(execstrings))

        return "<b>{}:</b>" \
               "\n#{}" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(tag, html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text("I can't restrict people here, give me permissions first! Until then, I'll disable anti-flood.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have enough permission to restrict users so automatically disabled anti-flood".format(chat.title)
Beispiel #26
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]
    limit = sql.get_flood_limit(chat.id)

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""
    
    soft_flood = sql.get_flood_strength(chat.id)
    if soft_flood:  # kick
        chat.unban_member(user.id)
        reply = "Wonderful, I don't like your flooding. Get out!" \
                " {} has been kicked!".format(mention_html(user.id, user.first_name))

    else:  # ban
        chat.kick_member(user.id)
        reply = "Frankly, I like to leave the flooding to natural disasters." \
                " {} has been banned!".format(mention_html(user.id, user.first_name))
    try:
        keyboard = []
        msg.reply_text(reply, reply_markup=keyboard, parse_mode=ParseMode.HTML)
        msg.delete()
        
        log = "<b>{}:</b>" \
              "\n#FLOOD_CONTROL" \
              "\n<b>• User:</b> {}" \
              "\n<b>• ID:</b> <code>{}</code>".format(html.escape(chat.title), mention_html(user.id, user.first_name), user.id)
        
        if soft_flood:
           log +="\n<b>• Action:</b> kicked"
        
        else:
           log +="\n<b>• Action:</b> banned"
        
        log +="\n<b>• Reason:</b> Exceeded flood limit of {} consecutive messages.".format(limit)
                                                                               
        
        return log

    except BadRequest:
        msg.reply_text("I can't kick people here, give me permissions first! Until then, I'll disable anti-flood.")
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have kick permissions, so automatically disabled anti-flood.".format(chat.title)
Beispiel #27
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user
    chat = update.effective_chat
    msg = update.effective_message
    log_message = ""

    if not user:  # ignore channels
        return log_message

    # ignore admins and whitelists
    if (is_user_admin(chat, user.id) or user.id in WHITELIST_USERS
            or user.id in TIGER_USERS):
        sql.update_flood(chat.id, None)
        return log_message

    should_mute = sql.update_flood(chat.id, user.id)
    if not should_mute:
        return ""

    try:
        bot.restrict_chat_member(chat.id, user.id, can_send_messages=False)

        keyboard = InlineKeyboardMarkup([[
            InlineKeyboardButton("Unmute(Admins Only)",
                                 callback_data="unmute_flooder({})".format(
                                     user.id))
        ]])
        bot.send_message(
            chat.id,
            f"{mention_html(user.id, user.first_name)} has been muted for flooding the group!",
            reply_markup=keyboard,
            parse_mode="HTML")


        return "<b>{}:</b>" \
               "\n#MUTED" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.\nMuted until an admin unmutes".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            "I can't mute people here, give me permissions first! Until then, I'll disable antiflood."
        )
        sql.set_flood(chat.id, 0)
        log_message = (
            "<b>{chat.title}:</b>\n"
            "#INFO\n"
            "Don't have kick permissions, so automatically disabled antiflood."
        )

        return log_message
Beispiel #28
0
def check_flood(update: Update, context: CallbackContext) -> str:
    bot = context.bot
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if (int(user.id) == 777000 or int(user.id) == 1087968824
            or not user):  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return ""

    soft_flood = sql.get_flood_strength(chat.id)
    if soft_flood:  # kick
        chat.unban_member(user.id)
        reply = "Wonderful, I don't like your flooding. Get out! {} has been kicked!".format(
            mention_html(user.id, user.first_name))

    else:  # ban
        chat.ban_member(user.id)
        reply = "Frankly, I like to leave the flooding to natural disasters. {} has been banned!".format(
            mention_html(user.id, user.first_name))
    try:
        msg.reply_text(reply, parse_mode=ParseMode.HTML)
        msg.delete()
        return ("<b>{}:</b>"
                "\n#FLOOD_CTL"
                "\n<b>User:</b> {}"
                "\nFlooded the group.".format(
                    html.escape(chat.title),
                    mention_html(user.id, user.first_name)))

    except BadRequest:
        msg.reply_text(
            "I can't kick people here, give me permissions first! Until then, I'll disable anti-flood."
        )
        sql.set_flood(chat.id, 0)
        return (
            "<b>{}:</b>"
            "\n#INFO"
            "\nDon't have kick permissions, so automatically disabled anti-flood."
            .format(chat.title))
Beispiel #29
0
def check_flood(bot: Bot, update: Update) -> str:
    user = update.effective_user
    chat = update.effective_chat
    msg = update.effective_message

    if is_approved(chat.id, user.id):
        return

    log_message = ""

    if not user:  # ignore channels
        return log_message

    # ignore admins and whitelists
    if (is_user_admin(chat, user.id) or user.id in WHITELIST_USERS
            or user.id in TIGER_USERS):
        sql.update_flood(chat.id, None)
        return log_message

    should_ban = sql.update_flood(chat.id, user.id)
    if not should_ban:
        return log_message

    try:
        bot.restrict_chat_member(chat.id, user.id, can_send_messages=False)
        msg.reply_text(
            f"*mutes {mention_html(user.id, user.first_name)} permanently*\nStop flooding the group!",
            parse_mode=ParseMode.HTML)
        log_message = (
            f"<b>{html.escape(chat.title)}:</b>\n"
            f"#MUTED\n"
            f"<b>User:</b> {mention_html(user.id, user.first_name)}\n"
            f"Flooded the group.\nMuted until an admin unmutes")

        return log_message

    except BadRequest:
        msg.reply_text(
            "I can't kick people here, give me permissions first! Until then, I'll disable antiflood."
        )
        sql.set_flood(chat.id, 0)
        log_message = (
            "<b>{chat.title}:</b>\n"
            "#INFO\n"
            "Don't have kick permissions, so automatically disabled antiflood."
        )

        return log_message
Beispiel #30
0
def check_flood(update, context) -> str:
    user = update.effective_user  # type: Optional[User]
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    if not user:  # ignore channels
        return ""

    # ignore admins
    if is_user_admin(chat, user.id):
        sql.update_flood(chat.id, None)
        return ""

    should_mute = sql.update_flood(chat.id, user.id)
    if not should_mute:
        return ""

    try:
        context.bot.restrict_chat_member(
            chat.id,
            user.id,
            permissions=ChatPermissions(can_send_messages=False))
        msg.reply_text(
            tld(
                chat.id,
                "I like to leave the flooding to natural disasters. But you, you were just a "
                "disappointment. Get tapped."))

        return "<b>{}:</b>" \
               "\n#MUTE" \
               "\n<b>User:</b> {}" \
               "\nFlooded the group.".format(html.escape(chat.title),
                                             mention_html(user.id, user.first_name))

    except BadRequest:
        msg.reply_text(
            tld(
                chat.id,
                "I can't mute people here, give me permissions first! Until then, I'll disable antiflood."
            ))
        sql.set_flood(chat.id, 0)
        return "<b>{}:</b>" \
               "\n#INFO" \
               "\nDon't have permissions to mute someone, so I'm gonna disable antiflood.".format(chat.title)