def antiarabic(bot: Bot, update: Update): chat = update.effective_chat msg = update.effective_message to_match = extract_text(msg) user = update.effective_user has_arabic = False if not sql.chat_antiarabic(chat.id): return "" if not user: # ignore channels return "" if user.id == 777000: # ignore telegram return "" if not to_match: return if chat.type != chat.PRIVATE: for c in to_match: if ('\u0600' <= c <= '\u06FF' or '\u0750' <= c <= '\u077F' or '\u08A0' <= c <= '\u08FF' or '\uFB50' <= c <= '\uFDFF' or '\uFE70' <= c <= '\uFEFF' or '\U00010E60' <= c <= '\U00010E7F' or '\U0001EE00' <= c <= '\U0001EEFF'): if can_delete(chat, bot.id): update.effective_message.delete() return ""
def antiarabic_setting(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat msg = update.effective_message if chat.type != chat.PRIVATE: if args: if args[0].lower() in ("yes", "on", "true"): sql.set_chat_setting(chat.id, True) msg.reply_text(tld(chat.id, "antiarabic_enabled")) elif args[0].lower() in ("no", "off", "false"): sql.set_chat_setting(chat.id, False) msg.reply_text(tld(chat.id, "antiarabic_disabled")) else: msg.reply_text(tld(chat.id, "antiarabic_setting").format( sql.chat_antiarabic(chat.id)), parse_mode=ParseMode.MARKDOWN)
def antiarabic_setting(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat msg = update.effective_message user = update.effective_user member = chat.get_member(int(user.id)) if chat.type != chat.PRIVATE: if len(args) >= 1: if args[0] in ("yes", "on"): sql.set_chat_setting(chat.id, True) msg.reply_text(tld(chat.id, "antiarabic_enabled")) elif args[0] in ("no", "off"): sql.set_chat_setting(chat.id, False) msg.reply_text(tld(chat.id, "antiarabic_edisabled")) else: msg.reply_text(tld(chat.id, "antiarabic_setting").format( sql.chat_antiarabic(chat.id)), parse_mode=ParseMode.MARKDOWN)