Exemplo n.º 1
0
def delete_join(bot: Bot, update: Update):
    chat = update.effective_chat  # type: Optional[Chat]
    join = update.effective_message.new_chat_members
    if can_delete(chat, bot.id):
        del_join = sql.get_del_pref(chat.id)
        if del_join:
            update.message.delete()
Exemplo n.º 2
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text("Bundan sonra qrupa qatılan istifadəçi bildirişini silməliyəm.")
        else:
            update.effective_message.reply_text("I'm currently not deleting old joined messages!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text("I'll try to delete old joined messages!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled join deletion to <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text("I won't delete old joined messages.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled joined deletion to <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text("Mən 'on/yes' və 'off/no' başa düşürəm!")
        return ""
Exemplo n.º 3
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text("I should be deleting `user` joined the chat messages now.")
        else:
            update.effective_message.reply_text("I'm currently not deleting old joined messages!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text("I'll try to delete old joined messages!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled join deletion to <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text("I won't delete old joined messages.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled joined deletion to <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text("I understand 'on/yes' or 'off/no' only!")
        return ""
Exemplo n.º 4
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text("මම දැන් කතාබහට සම්බන්ධ වූ පරිශීලකයා මකා දැමිය යුතුය.")
        else:
            update.effective_message.reply_text("මම දැනට පැරණි සම්බන්ධිත පණිවිඩ මකා නොදමමි!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text("පැරණි සම්බන්ධිත පණිවිඩ මකා දැමීමට මම උත්සාහ කරමි!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nසම්බන්ධ වීමට මකාදැමීම ටොගල් කර ඇත <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text("පැරණි සම්බන්ධිත පණිවිඩ මම මකා නොදමමි.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nමකාදැමීමට ටොගල් කර ඇත <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text("මට තේරෙනවා'on/yes' හෝ 'off/no' පමනි!")
        return ""
Exemplo n.º 5
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text("Şimdi sohbet mesajlarına katılan `kullanıcı`yı silmeliyim.")
        else:
            update.effective_message.reply_text("Şu anda eski eski iletileri silmiyorum!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text("Katılan eski mesajları silmeye çalışacağım!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled join deletion to <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text("Katılan eski mesajları silmeyeceğim.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled joined deletion to <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text("Sadece 'on / yes' veya 'off / no' anlıyorum!")
        return ""
Exemplo n.º 6
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text(
                "İstifadəçi qrupa qoşulanda qoşuldu mesajını siləcəm.")
        else:
            update.effective_message.reply_text(
                "Hal hazırda qoşuldu mesajını silmirəm!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text("Qoşuldu mesajını siləcəm!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled join deletion to <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text("Qoşuldu mesajınısilməyəcəm.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled joined deletion to <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text(
            "Yalnız 'on/yes' or 'off/no' işlədə bilərsiniz!")
        return ""
Exemplo n.º 7
0
def __chat_settings__(chat_id, user_id):
    welcome_pref, _, _ = sql.get_welc_pref(chat_id)
    goodbye_pref, _, _ = sql.get_gdbye_pref(chat_id)
    clean_welc_pref = sql.get_clean_pref(chat_id)
    welc_mutes_pref = sql.get_welc_mutes_pref(chat_id)
    clean_service_pref = sql.get_del_pref(chat_id)
    return "This chat has it's welcome preference set to `{}`.\n" \
           "It's goodbye preference is `{}`. \n\n" \
           "*Service preferences:*\n" \
           "\nClean welcome: `{}`" \
           "\nWelcome mutes: `{}`" \
           "\nClean service: `{}`".format(welcome_pref, goodbye_pref, clean_welc_pref,
                                          welc_mutes_pref, clean_service_pref)
Exemplo n.º 8
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text(
                "നിലവിൽ user joined the chat മെസ്സേജുകൾ ഡിലീറ്റ് ചെയ്യുന്നുണ്ട്."
            )
        else:
            update.effective_message.reply_text(
                "നിലവിൽ user joined the chat മെസ്സേജുകൾ ഡിലീറ്റ് ചെയ്യുന്നില്ല."
            )
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text(
            "ശരി, user joined the chat മെസ്സേജുകൾ ഡിലീറ്റ് ചെയ്യാൻ ശ്രമിക്കാം!"
        )
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled join deletion to <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text(
            "ശരി, പഴയ user joined the chat മെസ്സേജുകൾ ഡിലീറ്റ് ചെയ്യുന്നില്ല!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled joined deletion to <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text(
            "എന്താണ് ചെയ്യേണ്ടത് എന്നു മനസ്സിലായില്ല... 'on/yes' അല്ലെങ്കിൽ 'off/no' എന്നു ചേർത്ത് അയക്കൂ."
        )
        return ""
Exemplo n.º 9
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text(
                "Şimdi sohbete katılan kullanıcıların eski hoşgeldin mesajlarını silmeliyim."
            )
        else:
            update.effective_message.reply_text(
                "Şu anda eski hoşgeldin mesajları silmiyorum!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text(
            "I'll try to delete old joined messages!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\n Katılma silme işlemine geçiş yapıldı <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text(
            "I won't delete old joined messages.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\n Katılma silme işlemine geçiş yapıldı  <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text(
            "Yalnızca yes , no veya on , off'u anlıyorum!")
        return ""
Exemplo n.º 10
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text(
                "Sohbet mesajlarına qatılan `user` i silməliyəm.")
        else:
            update.effective_message.reply_text(
                "Hazırda köhnə qoşulmuş mesajları silmirəm.!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text(
            "Köhnə qoşulmuş mesajları silməyə çalışacağam!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nQoşulma silməsini dəyişdirdi <code>Aktiv</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text(
            "Köhnə qoşulmuş mesajları silməyəcəyəm.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nQoşulmuş silməni dəyişdirdi <code>Deaktiv</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text(
            "Yalnız 'on / yes' və ya 'off / no' kimi başa düşürəm!")
        return ""
Exemplo n.º 11
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text(
                "Powinienem teraz usuwać serwisowe wiadomości dołączeń.")
        else:
            update.effective_message.reply_text(
                "Obecnie nie usuwam serwisowych wiadomości dołączeń!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text(
            "Od teraz usuwam wszystkie serwisowe wiadomości dołączeń!")
        return "<b>{}:</b>" \
               "\n#USUWANIE_WIADOMOŚCI_SERWISOWYCH" \
               "\n<b>Administrator:</b> {}" \
               "\nPrzełączył usuwanie serwisowych wiadomości dołączeń na <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text(
            "Od teraz nie usuwam żadnych serwisowych wiadomości dołączeń.")
        return "<b>{}:</b>" \
               "\n#USUWANIE_WIADOMOŚCI_SERWISOWYCH" \
               "\n<b>Administrator:</b> {}" \
               "\nPrzełączył usuwanie serwisowych wiadomości dołączeń na <code>OFF</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text(
            "Rozumię tylko 'on/yes' lub 'off/no'!")
        return ""
Exemplo n.º 12
0
def del_joined(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]

    if not args:
        del_pref = sql.get_del_pref(chat.id)
        if del_pref:
            update.effective_message.reply_text(
                "*Member* ജോയിൻ ആകുമ്പോൾ ഉള്ള മെസ്സേജ് ഡിലീറ്റ് ചെയ്യാം...")
        else:
            update.effective_message.reply_text(
                "Join ആയ മെസ്സേജ് ഞാൻ ഡിലീറ്റ് ആക്കില്ല!")
        return ""

    if args[0].lower() in ("on", "yes"):
        sql.set_del_joined(str(chat.id), True)
        update.effective_message.reply_text(
            "Join ആയ മെസ്സേജ് ഞാൻ ഡിലീറ്റ് ചെയ്യാം!")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled join deletion to <code>ON</code>.".format(html.escape(chat.title),
                                                                         mention_html(user.id, user.first_name))
    elif args[0].lower() in ("off", "no"):
        sql.set_del_joined(str(chat.id), False)
        update.effective_message.reply_text(
            "Join ആയ മെസ്സേജ് ഞാൻ ഡിലീറ്റ് ആക്കില്ല.")
        return "<b>{}:</b>" \
               "\n#CLEAN_SERVICE_MESSAGE" \
               "\n<b>Admin:</b> {}" \
               "\nHas toggled joined deletion to <code>OFF</code>.".format(html.escape(chat.title),
                                                                          mention_html(user.id, user.first_name))
    else:
        # idek what you're writing, say yes or no
        update.effective_message.reply_text(
            "ഇതിൽ ഏതെങ്കിലും അടയാളപ്പെടുത്തുക 'on/yes' or 'off/no'!")
        return ""