def check_and_ban(update, user_id, should_message=True): try: spmban = spamwtc.get_ban(int(user_id)) if spmban: update.effective_chat.kick_member(user_id) if should_message: update.effective_message.reply_text( f"This person has been detected as spambot by @SpamWatch and has been removed!\nReason: <code>{spmban.reason}</code>", parse_mode=ParseMode.HTML, ) return else: return except Exception: pass if sql.is_user_gbanned(user_id): update.effective_chat.kick_member(user_id) if should_message: usr = sql.get_gbanned_user(user_id) greason = usr.reason if not greason: greason = "No reason given" update.effective_message.reply_text( f"*Alert! this user was GBanned and have been removed!*\n*Reason*: {greason}", parse_mode=ParseMode.MARKDOWN, ) return
def __user_info__(user_id): is_gbanned = sql.is_user_gbanned(user_id) text = "<b>Globally banned</b>: {}" if int(user_id) in DEV_USERS + SUDO_USERS + SUPPORT_USERS: return "" if is_gbanned: text = text.format("Yes") user = sql.get_gbanned_user(user_id) if user.reason: text += "\n<b>Reason:</b> {}".format(html.escape(user.reason)) text += "\nAppeal at @userbotspamgroup if you think it's invalid." else: text = text.format("No") return text
def check_and_ban(update, user_id, should_message=True): try: spmban = spamwtc.get_ban(int(user_id)) cas_banned = check_cas(user_id) if spmban or cas_banned: update.effective_chat.kick_member(user_id) if should_message: if spmban and cas_banned: banner = "@Spamwatch and Combot Anti Spam" reason = f"\n<code>{spmban.reason}</code>\n\nand <a href='{cas_banned}'>CAS Banned</a>" elif cas_banned: banner = "Combot Anti Spam" reason = f"<a href='{cas_banned}''>CAS Banned</a>" elif spmban: banner = "@Spamwatch" reason = f"<code>{spmban.reason}</code>" update.effective_message.reply_text( f"#SPAM_SHIELD\n\nThis person has been detected as spambot by {banner} and has been removed!\nReason: {reason}", parse_mode=ParseMode.HTML, ) return except Exception: pass if sql.is_user_gbanned(user_id): update.effective_chat.kick_member(user_id) if should_message: usr = sql.get_gbanned_user(user_id) greason = usr.reason if not greason: greason = "No reason given" update.effective_message.reply_text( f"*Alert! this user was GBanned and have been removed!*\n*Reason*: {greason}", parse_mode=ParseMode.MARKDOWN, ) return
def __user_info__(user_id): is_gbanned = sql.is_user_gbanned(user_id) spmban = spamwtc.get_ban(int(user_id)) cas_banned = check_cas(user_id) text = "<b>Globally banned</b>: {}" if int(user_id) in DEV_USERS + SUDO_USERS + SUPPORT_USERS: return "" if user_id in (777000, 1087968824): return "" if cas_banned or spmban or is_gbanned: text = text.format("Yes") if is_gbanned: user = sql.get_gbanned_user(user_id) if user.reason: text += "\n<b>Reason:</b> {}".format(html.escape(user.reason)) text += "\nAppeal at @botspamgroup if you think it's invalid." else: text = text.format("No") return text