def blacklist_mode(update: Update, context: CallbackContext): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] bot, args = context.bot, context.args conn = connected(bot, update, chat, user.id, need_admin=True) if conn: chat = dispatcher.bot.getChat(conn) chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if update.effective_message.chat.type == "private": send_message(update.effective_message, "Bu əmr qruplarda işlədilə bilər.") return "" chat = update.effective_chat chat_id = update.effective_chat.id chat_name = update.effective_message.chat.title if args: if args[0].lower() == 'off' or args[0].lower( ) == 'nothing' or args[0].lower() == 'no': settypeblacklist = 'turn off' sql.set_blacklist_strength(chat_id, 0, "0") elif args[0].lower() == 'del' or args[0].lower() == 'delete': settypeblacklist = 'left, the message will be deleted' sql.set_blacklist_strength(chat_id, 1, "0") elif args[0].lower() == 'warn': settypeblacklist = 'warned' sql.set_blacklist_strength(chat_id, 2, "0") elif args[0].lower() == 'mute': settypeblacklist = 'muted' sql.set_blacklist_strength(chat_id, 3, "0") elif args[0].lower() == 'kick': settypeblacklist = 'kicked' sql.set_blacklist_strength(chat_id, 4, "0") elif args[0].lower() == 'ban': settypeblacklist = 'banned' sql.set_blacklist_strength(chat_id, 5, "0") elif args[0].lower() == 'tban': if len(args) == 1: teks = """Görünür ki bir zaman dəyəri verməmisiniz; `/blstickermode tban <timevalue>` işlədin. Zaman dəyərləri: 4m = 4 dəqiqə, 3h = 3 saat, 6d = 6 gün, 5w = 5 həftə.""" send_message( update.effective_message, teks, parse_mode="markdown") return settypeblacklist = '{} müddətlik banlandı'.format(args[1]) sql.set_blacklist_strength(chat_id, 6, str(args[1])) elif args[0].lower() == 'tmute': if len(args) == 1: teks = """Görünür ki bir zaman dəyəri verməmisiniz; `/blstickermode tmute <timevalue>` işlədin. Zaman dəyərləri: 4m = 4 dəqiqə, 3h = 3 saat, 6d = 6 gün, 5w = 5 həftə.""" send_message( update.effective_message, teks, parse_mode="markdown") return settypeblacklist = 'temporary muted for {}'.format(args[1]) sql.set_blacklist_strength(chat_id, 7, str(args[1])) else: send_message( update.effective_message, "Mən yalnız off/del/warn/ban/kick/mute/tban/tmute başa düşürəm!") return if conn: text = "Qara siyahı (stiker) modu yenisi işlədin əvəz olundu.\nKöhnə: `{}`\nYeni: *{}*!".format( settypeblacklist, chat_name) else: text = " Qara siyahı (stiker) modu yenisi işlədin əvəz olundu: `{}`!".format( settypeblacklist) send_message(update.effective_message, text, parse_mode="markdown") return "<b>{}:</b>\n" \ "<b>Admin:</b> {}\n" \ "Changed sticker blacklist mode. users will be {}.".format(html.escape(chat.title), mention_html(user.id, html.escape(user.first_name)), settypeblacklist) else: getmode, getvalue = sql.get_blacklist_setting(chat.id) if getmode == 0: settypeblacklist = "not active" elif getmode == 1: settypeblacklist = "delete" elif getmode == 2: settypeblacklist = "warn" elif getmode == 3: settypeblacklist = "mute" elif getmode == 4: settypeblacklist = "kick" elif getmode == 5: settypeblacklist = "ban" elif getmode == 6: settypeblacklist = "{} müddətlik ban".format(getvalue) elif getmode == 7: settypeblacklist = "{} müddətlik susdurulma".format(getvalue) if conn: text = "*{}* qrupunda Qara siyahı(stiker) modu: *{}*.".format( chat_name, settypeblacklist) else: text = "Qara siyahı(stiker) modu: *{}*.".format( settypeblacklist) send_message( update.effective_message, text, parse_mode=ParseMode.MARKDOWN) return ""
def blacklist_mode(update: Update, context: CallbackContext): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] bot, args = context.bot, context.args conn = connected(bot, update, chat, user.id, need_admin=True) if conn: chat = dispatcher.bot.getChat(conn) chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if update.effective_message.chat.type == "private": send_message( update.effective_message, "You can do this command in groups, not PM", ) return "" chat = update.effective_chat chat_id = update.effective_chat.id chat_name = update.effective_message.chat.title if args: if args[0].lower() in ["off", "nothing", "no"]: settypeblacklist = "turn off" sql.set_blacklist_strength(chat_id, 0, "0") elif args[0].lower() in ["del", "delete"]: settypeblacklist = "left, the message will be deleted" sql.set_blacklist_strength(chat_id, 1, "0") elif args[0].lower() == "warn": settypeblacklist = "warned" sql.set_blacklist_strength(chat_id, 2, "0") elif args[0].lower() == "mute": settypeblacklist = "muted" sql.set_blacklist_strength(chat_id, 3, "0") elif args[0].lower() == "kick": settypeblacklist = "kicked" sql.set_blacklist_strength(chat_id, 4, "0") elif args[0].lower() == "ban": settypeblacklist = "banned" sql.set_blacklist_strength(chat_id, 5, "0") elif args[0].lower() == "tban": if len(args) == 1: teks = """It looks like you are trying to set a temporary value to blacklist, but has not determined the time; use `/blstickermode tban <timevalue>`. Examples of time values: 4m = 4 minute, 3h = 3 hours, 6d = 6 days, 5w = 5 weeks.""" send_message(update.effective_message, teks, parse_mode="markdown") return settypeblacklist = "temporary banned for {}".format(args[1]) sql.set_blacklist_strength(chat_id, 6, str(args[1])) elif args[0].lower() == "tmute": if len(args) == 1: teks = """It looks like you are trying to set a temporary value to blacklist, but has not determined the time; use `/blstickermode tmute <timevalue>`. Examples of time values: 4m = 4 minute, 3h = 3 hours, 6d = 6 days, 5w = 5 weeks.""" send_message(update.effective_message, teks, parse_mode="markdown") return settypeblacklist = "temporary muted for {}".format(args[1]) sql.set_blacklist_strength(chat_id, 7, str(args[1])) else: send_message( update.effective_message, "I only understand off/del/warn/ban/kick/mute/tban/tmute!", ) return if conn: text = "Blacklist sticker mode changed, users will be `{}` at *{}*!".format( settypeblacklist, chat_name, ) else: text = "Blacklist sticker mode changed, users will be `{}`!".format( settypeblacklist, ) send_message(update.effective_message, text, parse_mode="markdown") return ("<b>{}:</b>\n" "<b>Admin:</b> {}\n" "Changed sticker blacklist mode. users will be {}.".format( html.escape(chat.title), mention_html(user.id, html.escape(user.first_name)), settypeblacklist, )) getmode, getvalue = sql.get_blacklist_setting(chat.id) if getmode == 0: settypeblacklist = "not active" elif getmode == 1: settypeblacklist = "delete" elif getmode == 2: settypeblacklist = "warn" elif getmode == 3: settypeblacklist = "mute" elif getmode == 4: settypeblacklist = "kick" elif getmode == 5: settypeblacklist = "ban" elif getmode == 6: settypeblacklist = "temporarily banned for {}".format(getvalue) elif getmode == 7: settypeblacklist = "temporarily muted for {}".format(getvalue) if conn: text = "Blacklist sticker mode is currently set to *{}* in *{}*.".format( settypeblacklist, chat_name, ) else: text = "Blacklist sticker mode is currently set to *{}*.".format( settypeblacklist, ) send_message(update.effective_message, text, parse_mode=ParseMode.MARKDOWN) return ""
def blacklist_mode(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] conn = connected(bot, update, chat, user.id, need_admin=True) if conn: chat = dispatcher.bot.getChat(conn) chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: if update.effective_message.chat.type == "private": send_message(update.effective_message, "Bu komutu PM değil gruplar halinde yapabilirsiniz") return "" chat = update.effective_chat chat_id = update.effective_chat.id chat_name = update.effective_message.chat.title if args: if args[0].lower() == 'off' or args[0].lower() == 'nothing' or args[0].lower() == 'no': settypeblacklist = 'turn off' sql.set_blacklist_strength(chat_id, 0, "0") elif args[0].lower() == 'del' or args[0].lower() == 'delete': settypeblacklist = 'left, the message will be deleted' sql.set_blacklist_strength(chat_id, 1, "0") elif args[0].lower() == 'warn': settypeblacklist = 'warned' sql.set_blacklist_strength(chat_id, 2, "0") elif args[0].lower() == 'mute': settypeblacklist = 'muted' sql.set_blacklist_strength(chat_id, 3, "0") elif args[0].lower() == 'kick': settypeblacklist = 'kicked' sql.set_blacklist_strength(chat_id, 4, "0") elif args[0].lower() == 'ban': settypeblacklist = 'banned' sql.set_blacklist_strength(chat_id, 5, "0") elif args[0].lower() == 'tban': if len(args) == 1: teks = """Kara listeye geçici bir değer ayarlamaya çalıştığınız anlaşılıyor, ama zamanı belirlemedi; kullan `/blstickermode tban <timevalue>`. Examples of time values: 4m = 4 minute, 3h = 3 hours, 6d = 6 days, 5w = 5 weeks.""" send_message(update.effective_message, teks, parse_mode="markdown") return settypeblacklist = 'temporary banned for {}'.format(args[1]) sql.set_blacklist_strength(chat_id, 6, str(args[1])) elif args[0].lower() == 'tmute': if len(args) == 1: teks = """Kara listeye geçici bir değer ayarlamaya çalıştığınız anlaşılıyor, ama zamanı belirlemedi; kullan `/blstickermode tmute <timevalue>`. Examples of time values: 4m = 4 minute, 3h = 3 hours, 6d = 6 days, 5w = 5 weeks.""" send_message(update.effective_message, teks, parse_mode="markdown") return settypeblacklist = tl(update.effective_message, 'geçici olarak kapatıldı {}').format(args[1]) sql.set_blacklist_strength(chat_id, 7, str(args[1])) else: send_message(update.effective_message, "Sadece anlıyorum off/del/warn/ban/kick/mute/tban/tmute!") return if conn: text = "Kara liste çıkartma modu değişti, kullanıcılar olacak `{}` at *{}*!".format(settypeblacklist, chat_name) else: text = "Kara liste çıkartma modu değişti, kullanıcılar olacak `{}`!".format(settypeblacklist) send_message(update.effective_message, text, parse_mode="markdown") return "<b>{}:</b>\n" \ "<b>Admin:</b> {}\n" \ "Etiket kara listesi modunu değiştirdi. kullanıcılar olacak {}.".format(html.escape(chat.title), mention_html(user.id, user.first_name), settypeblacklist) else: getmode, getvalue = sql.get_blacklist_setting(chat.id) if getmode == 0: settypeblacklist = "not active" elif getmode == 1: settypeblacklist = "hapus" elif getmode == 2: settypeblacklist = "warn" elif getmode == 3: settypeblacklist = "mute" elif getmode == 4: settypeblacklist = "kick" elif getmode == 5: settypeblacklist = "ban" elif getmode == 6: settypeblacklist = "geçici olarak yasaklandı {}".format(getvalue) elif getmode == 7: settypeblacklist = "geçici olarak susturuldu {}".format(getvalue) if conn: text = "Kara liste çıkartma modu şu anda olarak ayarlanmış *{}* in *{}*.".format(settypeblacklist, chat_name) else: text = "Kara liste çıkartma modu şu anda olarak ayarlanmış *{}*.".format(settypeblacklist) send_message(update.effective_message, text, parse_mode=ParseMode.MARKDOWN) return ""