def warns(update: Update, context: CallbackContext): args = context.args message: Optional[Message] = update.effective_message chat: Optional[Chat] = update.effective_chat user_id = extract_user(message, args) or update.effective_user.id result = sql.get_warns(user_id, chat.id) if result and result[0] != 0: num_warns, reasons = result limit, soft_warn = sql.get_warn_setting(chat.id) if reasons: text = f"This user has {num_warns}/{limit} warns, for the following reasons:" for reason in reasons: text += f"\n - {reason}" msgs = split_message(text) for msg in msgs: update.effective_message.reply_text(msg) else: update.effective_message.reply_text( f"User has {num_warns}/{limit} warns, but no reasons for any of them." ) else: update.effective_message.reply_text( "This user doesn't have any warns!")
def warns(update: Update, context: CallbackContext): args = context.args message: Optional[Message] = update.effective_message chat: Optional[Chat] = update.effective_chat user_id = extract_user(message, args) or update.effective_user.id result = sql.get_warns(user_id, chat.id) if result and result[0] != 0: num_warns, reasons = result limit, soft_warn = sql.get_warn_setting(chat.id) if reasons: text = ( f"User ini sudah {num_warns}/{limit} diperingatkan, Karena alasan:" ) for reason in reasons: text += f"\n • {reason}" msgs = split_message(text) for msg in msgs: update.effective_message.reply_text(msg) else: update.effective_message.reply_text( f"User punya {num_warns}/{limit} peringatan, tapi tanpa alasan." ) else: update.effective_message.reply_text( "User ini ga punya satupun peringatan!")
def warns(update: Update, context: CallbackContext): args = context.args message: Optional[Message] = update.effective_message chat: Optional[Chat] = update.effective_chat user_id = extract_user(message, args) or update.effective_user.id result = sql.get_warns(user_id, chat.id) if result and result[0] != 0: num_warns, reasons = result limit, soft_warn = sql.get_warn_setting(chat.id) if reasons: text = f"Bu istifadəçinin {num_warns}/{limit} xəbərdarlığı var, səbəblər aşağıdadır:" for reason in reasons: text += f"\n • {reason}" msgs = split_message(text) for msg in msgs: update.effective_message.reply_text(msg) else: update.effective_message.reply_text( f"Bu istifadəçinin {num_warns}/{limit} xbərdarlığı var, amma bir səbəb verilməyib." ) else: update.effective_message.reply_text("Bu istifadəçinin xəbərdarlığı yoxdur!")
def blacklist(bot: Bot, update: Update, args: List[str]): msg = update.effective_message chat = update.effective_chat update_chat_title = chat.title message_chat_title = update.effective_message.chat.title if update_chat_title == message_chat_title: base_blacklist_string = "Current <b>blacklisted</b> words:\n" else: base_blacklist_string = f"Current <b>blacklisted</b> words in <b>{update_chat_title}</b>:\n" all_blacklisted = sql.get_chat_blacklist(chat.id) filter_list = base_blacklist_string if len(args) > 0 and args[0].lower() == 'copy': for trigger in all_blacklisted: filter_list += f"<code>{html.escape(trigger)}</code>\n" else: for trigger in all_blacklisted: filter_list += f" - <code>{html.escape(trigger)}</code>\n" split_text = split_message(filter_list) for text in split_text: if text == base_blacklist_string: if update_chat_title == message_chat_title: msg.reply_text("There are no blacklisted messages here!") else: msg.reply_text( f"There are no blacklisted messages in <b>{update_chat_title}</b>!", parse_mode=ParseMode.HTML) return msg.reply_text(text, parse_mode=ParseMode.HTML)
def blacklist(bot: Bot, update: Update, args: List[str]): msg = update.effective_message chat = update.effective_chat update_chat_title = chat.title message_chat_title = update.effective_message.chat.title if update_chat_title == message_chat_title: base_blacklist_string = "şimdiki <b>blacklisted</b> kelimeler:\n" else: base_blacklist_string = f"şimdiki <b>blacklisted</b> kelimeler içinde <b>{update_chat_title}</b>:\n" all_blacklisted = sql.get_chat_blacklist(chat.id) filter_list = base_blacklist_string if len(args) > 0 and args[0].lower() == 'copy': for trigger in all_blacklisted: filter_list += f"<code>{html.escape(trigger)}</code>\n" else: for trigger in all_blacklisted: filter_list += f" - <code>{html.escape(trigger)}</code>\n" split_text = split_message(filter_list) for text in split_text: if text == base_blacklist_string: if update_chat_title == message_chat_title: msg.reply_text("Burada kara listeye alınmış mesaj yok!") else: msg.reply_text(f"İçinde kara listeye alınmış mesaj yok <b>{update_chat_title}</b>!", parse_mode=ParseMode.HTML) return msg.reply_text(text, parse_mode=ParseMode.HTML)
def blackliststicker(bot: Bot, update: Update, args: List[str]): msg = update.effective_message # type: Optional[Message] chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] conn = connected(bot, update, chat, user.id, need_admin=False) if conn: chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if chat.type == "private": return else: chat_id = update.effective_chat.id chat_name = chat.title sticker_list = "<b>Şu anda kara listede bulunan etiketleri listele {}:</b>\n".format(chat_name) all_stickerlist = sql.get_chat_stickers(chat_id) if len(args) > 0 and args[0].lower() == 'copy': for trigger in all_stickerlist: sticker_list += "<code>{}</code>\n".format(html.escape(trigger)) elif len(args) == 0: for trigger in all_stickerlist: sticker_list += " - <code>{}</code>\n".format(html.escape(trigger)) split_text = split_message(sticker_list) for text in split_text: if sticker_list == "<b>Şu anda kara listede bulunan etiketleri listele {}:</b>\n".format(chat_name).format(chat_name): send_message(update.effective_message, "İçinde kara liste etiketi yok <b>{}</b>!".format(chat_name), parse_mode=ParseMode.HTML) return send_message(update.effective_message, text, parse_mode=ParseMode.HTML)
def warns(update: Update, context: CallbackContext): args = context.args message: Optional[Message] = update.effective_message chat: Optional[Chat] = update.effective_chat user_id = extract_user(message, args) or update.effective_user.id result = sql.get_warns(user_id, chat.id) if result and result[0] != 0: num_warns, reasons = result limit, soft_warn = sql.get_warn_setting(chat.id) if reasons: text = ( f"Este usuario tiene {num_warns}/{limit} advertencias, por los siguientes motivos:" ) for reason in reasons: text += f"\n • {reason}" msgs = split_message(text) for msg in msgs: update.effective_message.reply_text(msg) else: update.effective_message.reply_text( f"El usuario tiene {num_warns}/{limit} advertencias, pero no hay motivos para ninguna de ellas." ) else: update.effective_message.reply_text("¡Este usuario no tiene ninguna advertencia!")
def blacklist(update, context): chat = update.effective_chat user = update.effective_user args = context.args conn = connected(context.bot, update, chat, user.id, need_admin=False) if conn: chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if chat.type == "private": return else: chat_id = update.effective_chat.id chat_name = chat.title filter_list = "<b>{}</b> qrupunda qara siyahıdakı sözlər:\n".format( chat_name) all_blacklisted = sql.get_chat_blacklist(chat_id) if len(args) > 0 and args[0].lower() == "copy": for trigger in all_blacklisted: filter_list += "<code>{}</code>\n".format(html.escape(trigger)) else: for trigger in all_blacklisted: filter_list += " - <code>{}</code>\n".format(html.escape(trigger)) # for trigger in all_blacklisted: # filter_list += " - <code>{}</code>\n".format(html.escape(trigger)) split_text = split_message(filter_list) for text in split_text: if filter_list == "<b>{}</b> qrupunda qara siyahıdakı sözlər:\n".format( html.escape(chat_name)): send_message( update.effective_message, "<b>{}</b> qrupunda qara siyahıda söz yoxdur!".format( html.escape(chat_name)), parse_mode=ParseMode.HTML, ) return send_message(update.effective_message, text, parse_mode=ParseMode.HTML)
def blackliststicker(update: Update, context: CallbackContext): msg = update.effective_message # type: Optional[Message] chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] bot, args = context.bot, context.args conn = connected(bot, update, chat, user.id, need_admin=False) if conn: chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if chat.type == "private": return chat_id = update.effective_chat.id chat_name = chat.title sticker_list = "<b>List blacklisted stickers currently in {}:</b>\n".format( chat_name, ) all_stickerlist = sql.get_chat_stickers(chat_id) if len(args) > 0 and args[0].lower() == "copy": for trigger in all_stickerlist: sticker_list += "<code>{}</code>\n".format(html.escape(trigger)) elif len(args) == 0: for trigger in all_stickerlist: sticker_list += " - <code>{}</code>\n".format(html.escape(trigger)) split_text = split_message(sticker_list) for text in split_text: if sticker_list == "<b>List blacklisted stickers currently in {}:</b>\n".format( chat_name, ).format(html.escape(chat_name)): send_message( update.effective_message, "There are no blacklist stickers in <b>{}</b>!".format( html.escape(chat_name), ), parse_mode=ParseMode.HTML, ) return send_message(update.effective_message, text, parse_mode=ParseMode.HTML)
def warns(bot: Bot, update: Update, args: List[str]): message: Optional[Message] = update.effective_message chat: Optional[Chat] = update.effective_chat user_id = extract_user(message, args) or update.effective_user.id result = sql.get_warns(user_id, chat.id) if result and result[0] != 0: num_warns, reasons = result limit, soft_warn = sql.get_warn_setting(chat.id) if reasons: text = f"This user has {num_warns}/{limit} aşağıdaki nedenlerle uyarıyor:" for reason in reasons: text += f"\n - {reason}" msgs = split_message(text) for msg in msgs: update.effective_message.reply_text(msg) else: update.effective_message.reply_text( f"Kullanıcının {num_warns}/{limit} uyarısı var, ancak bunların hiçbir nedeni yok." ) else: update.effective_message.reply_text("Bu kullanıcının uyarısı yok!")