def __user_info__(user_id): if user_id in (777000, 1087968824): return "" is_blacklisted = sql.is_user_blacklisted(user_id) text = "Blacklisted: <b>{}</b>" if ( user_id in [777000, 1087968824, dispatcher.bot.id] + SUDO_USERS + SARDEGNA_USERS + WHITELIST_USERS ): return "" if is_blacklisted: text = text.format("Yes") reason = sql.get_reason(user_id) if reason: text += f"\nReason: <code>{reason}</code>" else: text = text.format("No") return text
def read_item(user_id: int): try: a = sql1.is_user_gbanned(user_id) if a: user = sql1.get_gbanned_user(user_id) areason = user.reason else: areason = None b = sql2.is_user_blacklisted(user_id) breason = sql2.get_reason(user_id) if b else None return { "status": "ok", "user_id": user_id, "gbanned": a, "gban_reason": areason, "blacklisted": b, "blacklist_reason": breason } except Exception: a = None areason = None b = None breason = None return { "status": "ok", "user_id": user_id, "gbanned": a, "gban_reason": areason, "blacklisted": b, "blacklist_reason": breason }
def bl_users(bot: Bot, update: Update): rep = "<b>Blacklisted Users</b>\n" for x in sql.BLACKLIST_USERS: name = bot.get_chat(x) name = name.first_name.replace("<", "<") name = name.replace(">", ">") reason = sql.get_reason(x) if reason: rep += f"• <a href='tg://user?id={x}'>{name}</a> :- {reason}\n" else: rep += f"• <a href='tg://user?id={x}'>{name}</a>\n" update.effective_message.reply_text(rep, parse_mode=ParseMode.HTML)
def __user_info__(user_id): is_blacklisted = sql.is_user_blacklisted(user_id) text = "Blacklisted: <b>{}</b>" if is_blacklisted: text = text.format("Yes") reason = sql.get_reason(user_id) if reason: text += f"\nReason: <code>{reason}</code>" else: text = text.format("No") return text
def bl_users(update: Update, context: CallbackContext): users = [] bot = context.bot for each_user in sql.BLACKLIST_USERS: user = bot.get_chat(each_user) reason = sql.get_reason(each_user) if reason: users.append( f"• {mention_html(user.id, user.first_name)} :- {reason}") else: users.append(f"• {mention_html(user.id, user.first_name)}") message = "<b>Blacklisted Users</b>\n" message += "\n".join( users) if users else "Noone is being ignored as of yet." update.effective_message.reply_text(message, parse_mode=ParseMode.HTML)
def __user_info__(user_id): if user_id in (777000, 1087968824): return "" is_blacklisted = sql.is_user_blacklisted(user_id) text = "Globally Ignored: <b>{}</b>" if is_blacklisted: text = text.format("Yes") reason = sql.get_reason(user_id) if reason: text += f"\nReason: <code>{reason}</code>" else: text = text.format("No") return text
def bl_users(bot: Bot, update: Update): reply = "<b>Blacklisted Users</b>\n" for each_user in sql.BLACKLIST_USERS: name = html.escape(bot.get_chat(each_user)) reason = sql.get_reason(each_user) if reason: reply += f"• <a href='tg://user?id={each_user}'>{name}</a> :- {reason}\n" else: reply += f"• <a href='tg://user?id={each_user}'>{name}</a>\n" if reply == "<b>Blacklisted Users</b>\n": reply += "Noone is being ignored as of yet." update.effective_message.reply_text(reply, parse_mode=ParseMode.HTML)
def __user_info__(user_id): is_blacklisted = sql.is_user_blacklisted(user_id) text = "<b>Blacklisted : </b>{}" if user_id in [777000, 1087968824]: return "" if user_id == dispatcher.bot.id: return "" if int(user_id) in BLACKLISTWHITELIST: return "This User Is Staff Member \n<i>(Staff Members Can Not Be Banned!)</i>" if is_blacklisted: text = text.format("Yes") reason = sql.get_reason(user_id) if reason: text += f"\nReason: <code>{reason}</code>" else: text = text.format("No") return text
def bl_users(bot: Bot, update: Update): users = [] for each_user in sql.BLACKLIST_USERS: user = bot.get_chat(each_user) reason = sql.get_reason(each_user) if reason: users.append(f"• {mention_html(user.id, user.first_name)} :- {reason}") else: users.append(f"• {mention_html(user.id, user.first_name)}") message = "<b>Blacklisted Users</b>\n" if not users: message += "Noone is being ignored as of yet." else: message += '\n'.join(users) update.effective_message.reply_text(message, parse_mode=ParseMode.HTML)
def bl_users(bot: Bot, update: Update): users = [] for each_user in sql.BLACKLIST_USERS: user = bot.get_chat(each_user) reason = sql.get_reason(each_user) if reason: users.append( f"• {mention_html(user.id, user.first_name)} :- {reason}") else: users.append(f"• {mention_html(user.id, user.first_name)}") message = "<b>Pengguna yang Masuk Daftar Hitam</b>\n" if not users: message += "Belum ada yang diabaikan." else: message += "\n".join(users) update.effective_message.reply_text(message, parse_mode=ParseMode.HTML)