def del_blacklist(update, context): chat = update.effective_chat # type: Optional[Chat] message = update.effective_message # type: Optional[Message] user = update.effective_user bot = context.bot to_match = extract_text(message) if not to_match: return getmode, value = sql.get_blacklist_setting(chat.id) chat_filters = sql.get_chat_blacklist(chat.id) for trigger in chat_filters: pattern = r"( |^|[^\w])" + re.escape(trigger) + r"( |$|[^\w])" if re.search(pattern, to_match, flags=re.IGNORECASE): try: if getmode == 0: return elif getmode == 1: message.delete() elif getmode == 2: message.delete() warn(update.effective_user, chat, tl(update.effective_message, "Mengatakan kata '{}' yang ada di daftar hitam").format(trigger), message, update.effective_user, conn=False) return elif getmode == 3: message.delete() bot.restrict_chat_member(chat.id, update.effective_user.id, can_send_messages=False) bot.sendMessage(chat.id, tl(update.effective_message, "{} di bisukan karena mengatakan kata '{}' yang ada di daftar hitam").format(mention_markdown(user.id, user.first_name), trigger), parse_mode="markdown") return elif getmode == 4: message.delete() res = chat.unban_member(update.effective_user.id) if res: bot.sendMessage(chat.id, tl(update.effective_message, "{} di tendang karena mengatakan kata '{}' yang ada di daftar hitam").format(mention_markdown(user.id, user.first_name), trigger), parse_mode="markdown") return elif getmode == 5: message.delete() chat.kick_member(user.id) bot.sendMessage(chat.id, tl(update.effective_message, "{} di blokir karena mengatakan kata '{}' yang ada di daftar hitam").format(mention_markdown(user.id, user.first_name), trigger), parse_mode="markdown") return elif getmode == 6: message.delete() bantime = extract_time(message, value) chat.kick_member(user.id, until_date=bantime) bot.sendMessage(chat.id, tl(update.effective_message, "{} di blokir selama {} karena mengatakan kata '{}' yang ada di daftar hitam").format(mention_markdown(user.id, user.first_name), value, trigger), parse_mode="markdown") return elif getmode == 7: message.delete() mutetime = extract_time(message, value) bot.restrict_chat_member(chat.id, user.id, until_date=mutetime, can_send_messages=False) bot.sendMessage(chat.id, tl(update.effective_message, "{} di bisukan selama {} karena mengatakan kata '{}' yang ada di daftar hitam").format(mention_markdown(user.id, user.first_name), value, trigger), parse_mode="markdown") return except BadRequest as excp: if excp.message == "Message to delete not found": pass else: LOGGER.exception("Error while deleting blacklist message.") break
def check_flood(update, context) -> str: user = update.effective_user # type: Optional[User] chat = update.effective_chat # type: Optional[Chat] msg = update.effective_message # type: Optional[Message] if not user: # ignore channels return "" # ignore admins if is_user_admin(chat, user.id): sql.update_flood(chat.id, None) return "" should_ban = sql.update_flood(chat.id, user.id) if not should_ban: return "" try: getmode, getvalue = sql.get_flood_setting(chat.id) if getmode == 1: chat.kick_member(user.id) execstrings = tl(update.effective_message, "Keluar!") tag = "BANNED" elif getmode == 2: chat.kick_member(user.id) chat.unban_member(user.id) execstrings = tl(update.effective_message, "Keluar!") tag = "KICKED" elif getmode == 3: context.bot.restrict_chat_member(chat.id, user.id, permissions=ChatPermissions(can_send_messages=False)) execstrings = tl(update.effective_message, "Sekarang kamu diam!") tag = "MUTED" elif getmode == 4: bantime = extract_time(msg, getvalue) chat.kick_member(user.id, until_date=bantime) execstrings = tl(update.effective_message, "Keluar selama {}!").format(getvalue) tag = "TBAN" elif getmode == 5: mutetime = extract_time(msg, getvalue) context.bot.restrict_chat_member(chat.id, user.id, until_date=mutetime, permissions=ChatPermissions(can_send_messages=False)) execstrings = tl(update.effective_message, "Sekarang kamu diam selama {}!").format(getvalue) tag = "TMUTE" send_message(update.effective_message, tl(update.effective_message, "Saya tidak suka orang yang mengirim pesan beruntun. Tapi kamu hanya membuat " "saya kecewa. {}").format(execstrings)) return "<b>{}:</b>" \ "\n#{}" \ "\n<b>User:</b> {}" \ "\nFlooded the group.".format(tag, html.escape(chat.title), mention_html(user.id, user.first_name)) except BadRequest: send_message(update.effective_message, tl(update.effective_message, "Saya tidak bisa menendang orang di sini, beri saya izin terlebih dahulu! Sampai saat itu, saya akan menonaktifkan antiflood.")) sql.set_flood(chat.id, 0) return "<b>{}:</b>" \ "\n#INFO" \ "\n{}".format(chat.title, tl(update.effective_message, "Tidak memiliki izin kick, jadi secara otomatis menonaktifkan antiflood."))
def security_mute(bot: Bot, update: Update, args: List[str]) -> str: spam = spamfilters(update.effective_message.text, update.effective_message.from_user.id, update.effective_chat.id, update.effective_message) if spam == True: return chat = update.effective_chat # type: Optional[Chat] message = update.effective_message # type: Optional[Message] getcur, cur_value, cust_text = sql.welcome_security(chat.id) if len(args) >= 1: var = args[0] if var[:1] == "0": mutetime = "0" sql.set_welcome_security(chat.id, getcur, "0", cust_text) text = tl(update.effective_message, "Setiap member baru akan di bisukan selamanya sampai dia menekan tombol selamat datang!") else: mutetime = extract_time(message, var) if mutetime == "": return sql.set_welcome_security(chat.id, getcur, str(var), cust_text) text = tl(update.effective_message, "Setiap member baru akan di bisukan selama {} sampai dia menekan tombol selamat datang!").format(var) send_message(update.effective_message, text) else: if str(cur_value) == "0": send_message(update.effective_message, tl(update.effective_message, "Pengaturan saat ini: member baru akan di bisukan selamanya sampai dia menekan tombol selamat datang!")) else: send_message(update.effective_message, tl(update.effective_message, "Pengaturan saat ini: member baru akan di bisukan selama {} sampai dia menekan tombol selamat datang!").format(cur_value))
def blacklist_mode(update, context): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] msg = update.effective_message # type: Optional[Message] args = context.args conn = connected(context.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, tl(update.effective_message, "Anda bisa lakukan command ini pada grup, bukan pada 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() == 'off' or args[0].lower() == 'nothing' or args[0].lower() == 'no': settypeblacklist = tl(update.effective_message, 'di biarkan') sql.set_blacklist_strength(chat_id, 0, "0") elif args[0].lower() == 'del' or args[0].lower() == 'delete': settypeblacklist = tl(update.effective_message, 'di biarkan, pesannya akan dihapus') sql.set_blacklist_strength(chat_id, 1, "0") elif args[0].lower() == 'warn': settypeblacklist = tl(update.effective_message, 'di peringati') sql.set_blacklist_strength(chat_id, 2, "0") elif args[0].lower() == 'mute': settypeblacklist = tl(update.effective_message, 'di bisukan') sql.set_blacklist_strength(chat_id, 3, "0") elif args[0].lower() == 'kick': settypeblacklist = tl(update.effective_message, 'di tendang') sql.set_blacklist_strength(chat_id, 4, "0") elif args[0].lower() == 'ban': settypeblacklist = tl(update.effective_message, 'di blokir') sql.set_blacklist_strength(chat_id, 5, "0") elif args[0].lower() == 'tban': if len(args) == 1: teks = tl(update.effective_message, """Sepertinya Anda mencoba menetapkan nilai sementara untuk blacklist, tetapi belum menentukan waktu; gunakan `/blacklistmode tban <timevalue>`. Contoh nilai waktu: 4m = 4 menit, 3h = 3 jam, 6d = 6 hari, 5w = 5 minggu.""") send_message(update.effective_message, teks, parse_mode="markdown") return "" restime = extract_time(msg, args[1]) if not restime: teks = tl(update.effective_message, """Nilai waktu tidak valid! Contoh nilai waktu: 4m = 4 menit, 3h = 3 jam, 6d = 6 hari, 5w = 5 minggu.""") send_message(update.effective_message, teks, parse_mode="markdown") return "" settypeblacklist = tl(update.effective_message, 'di blokir sementara selama {}').format(args[1]) sql.set_blacklist_strength(chat_id, 6, str(args[1])) elif args[0].lower() == 'tmute': if len(args) == 1: teks = tl(update.effective_message, """Sepertinya Anda mencoba menetapkan nilai sementara untuk blacklist, tetapi belum menentukan waktu; gunakan `/blacklistmode tmute <timevalue>`. Contoh nilai waktu: 4m = 4 menit, 3h = 3 jam, 6d = 6 hari, 5w = 5 minggu.""") send_message(update.effective_message, teks, parse_mode="markdown") return "" restime = extract_time(msg, args[1]) if not restime: teks = tl(update.effective_message, """Nilai waktu tidak valid! Contoh nilai waktu: 4m = 4 menit, 3h = 3 jam, 6d = 6 hari, 5w = 5 minggu.""") send_message(update.effective_message, teks, parse_mode="markdown") return "" settypeblacklist = tl(update.effective_message, 'di bisukan sementara selama {}').format(args[1]) sql.set_blacklist_strength(chat_id, 7, str(args[1])) else: send_message(update.effective_message, tl(update.effective_message, "Saya hanya mengerti off/del/warn/ban/kick/mute/tban/tmute!")) return "" if conn: text = tl(update.effective_message, "Mode blacklist diubah, Pengguna akan `{}` pada *{}*!").format(settypeblacklist, chat_name) else: text = tl(update.effective_message, "Mode blacklist diubah, Pengguna akan `{}`!").format(settypeblacklist) send_message(update.effective_message, text, parse_mode="markdown") return "<b>{}:</b>\n" \ "<b>Admin:</b> {}\n" \ "Changed the blacklist mode. will {}.".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 = tl(update.effective_message, "tidak aktif") elif getmode == 1: settypeblacklist = tl(update.effective_message, "hapus") elif getmode == 2: settypeblacklist = tl(update.effective_message, "warn") elif getmode == 3: settypeblacklist = tl(update.effective_message, "mute") elif getmode == 4: settypeblacklist = tl(update.effective_message, "kick") elif getmode == 5: settypeblacklist = tl(update.effective_message, "ban") elif getmode == 6: settypeblacklist = tl(update.effective_message, "banned sementara selama {}").format(getvalue) elif getmode == 7: settypeblacklist = tl(update.effective_message, "mute sementara selama {}").format(getvalue) if conn: text = tl(update.effective_message, "Mode blacklist saat ini disetel ke *{}* pada *{}*.").format(settypeblacklist, chat_name) else: text = tl(update.effective_message, "Mode blacklist saat ini disetel ke *{}*.").format(settypeblacklist) send_message(update.effective_message, text, parse_mode=ParseMode.MARKDOWN) return ""
def temp_mute(bot: Bot, update: Update, args: List[str]) -> str: spam = spamfilters(update.effective_message.text, update.effective_message.from_user.id, update.effective_chat.id, update.effective_message) if spam == True: return chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: send_message( update.effective_message, tl(update.effective_message, "Anda sepertinya tidak mengacu pada pengguna.")) return "" 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": update.effective_send_message( update.effective_message, tl(update.effective_message, "Anda bisa lakukan command ini pada grup, bukan pada PM")) return "" chat = update.effective_chat chat_id = update.effective_chat.id chat_name = update.effective_message.chat.title try: member = chat.get_member(user_id) except BadRequest as excp: if excp.message == "User not found": send_message( update.effective_message, tl(update.effective_message, "Saya tidak dapat menemukan pengguna ini")) return "" else: raise if is_user_admin(chat, user_id, member): send_message( update.effective_message, tl(update.effective_message, "Saya benar-benar berharap dapat membisukan admin...")) return "" if user_id == bot.id: send_message( update.effective_message, tl( update.effective_message, "Saya tidak akan membisukan diri saya sendiri, apakah kamu gila?" )) return "" check = bot.getChatMember(chat.id, user.id) if check['can_restrict_members'] == False: send_message( update.effective_message, tl(update.effective_message, "Anda tidak punya hak untuk membatasi seseorang.")) return "" if not reason: send_message( update.effective_message, tl( update.effective_message, "Anda belum menetapkan waktu untuk menonaktifkan pengguna ini!" )) return "" split_reason = reason.split(None, 1) time_val = split_reason[0].lower() if len(split_reason) > 1: reason = split_reason[1] else: reason = "" mutetime = extract_time(message, time_val) if not mutetime: return "" log = "<b>{}:</b>" \ "\n#TMUTE" \ "\n<b>Admin:</b> {}" \ "\n<b>User:</b> {}" \ "\n<b>Time:</b> {}".format(html.escape(chat.title), mention_html(user.id, user.first_name), mention_html(member.user.id, member.user.first_name), time_val) if reason: log += "\n<b>Reason:</b> {}".format(reason) try: if member.can_send_messages is None or member.can_send_messages: bot.restrict_chat_member(chat.id, user_id, until_date=mutetime, can_send_messages=False) if conn: text = tl(update.effective_message, "Dibisukan untuk *{}* pada *{}*!").format( time_val, chat_name) else: text = tl(update.effective_message, "Dibisukan untuk *{}*!").format(time_val) send_message(update.effective_message, text, parse_mode="markdown") return log else: send_message( update.effective_message, tl(update.effective_message, "Pengguna ini sudah dibungkam.")) except BadRequest as excp: if excp.message == "Reply message not found": # Do not reply send_message(update.effective_message, tl(update.effective_message, "Dibisukan untuk *{}*!").format(time_val), quote=False) return log else: LOGGER.warning(update) LOGGER.exception("ERROR muting user %s in chat %s (%s) due to %s", user_id, chat.title, chat.id, excp.message) send_message( update.effective_message, tl(update.effective_message, "Yah sial, aku tidak bisa membisukan pengguna itu.")) return ""
def temp_ban(bot: Bot, update: Update, args: List[str]) -> str: currentchat = update.effective_chat # type: Optional[Chat] chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] spam = spamfilters(update.effective_message.text, update.effective_message.from_user.id, update.effective_chat.id, update.effective_message) if spam == True: return user_id, reason = extract_user_and_text(message, 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, tl(update.effective_message, "Anda bisa lakukan command ini pada grup, bukan pada PM")) return "" chat = update.effective_chat chat_id = update.effective_chat.id chat_name = update.effective_message.chat.title check = bot.getChatMember(chat_id, bot.id) if check.status == 'member': if conn: text = tl( update.effective_message, "Saya tidak bisa membatasi orang di *{}*! Pastikan saya admin dan dapat menunjuk admin baru." ).format(chat_name) else: text = tl( update.effective_message, "Saya tidak bisa membatasi orang di sini! Pastikan saya admin dan dapat menunjuk admin baru." ) send_message(update.effective_message, text, parse_mode="markdown") return "" else: if check['can_restrict_members'] == False: if conn: text = tl( update.effective_message, "Saya tidak bisa membatasi orang di *{}*! Pastikan saya admin dan dapat menunjuk admin baru." ).format(chat_name) else: text = tl( update.effective_message, "Saya tidak bisa membatasi orang di sini! Pastikan saya admin dan dapat menunjuk admin baru." ) send_message(update.effective_message, text, parse_mode="markdown") return "" if not user_id: send_message( update.effective_message, tl(update.effective_message, "Anda sepertinya tidak mengacu pada pengguna.")) return "" try: if conn: member = bot.getChatMember(chat_id, user_id) else: member = chat.get_member(user_id) except BadRequest as excp: if excp.message == "User not found": send_message( update.effective_message, tl(update.effective_message, "Saya tidak dapat menemukan pengguna ini 😣")) return "" else: raise if user_id == bot.id: send_message( update.effective_message, tl(update.effective_message, "Saya tidak akan BAN diri saya sendiri, apakah kamu gila? 😠")) return "" if is_user_ban_protected(chat, user_id, member): send_message( update.effective_message, tl(update.effective_message, "Saya tidak bisa banned orang ini karena dia adalah admin 😒")) return "" if member['can_restrict_members'] == False: send_message( update.effective_message, tl(update.effective_message, "Anda tidak punya hak untuk membatasi seseorang.")) return "" if not reason: send_message( update.effective_message, tl(update.effective_message, "Anda belum menetapkan waktu untuk banned pengguna ini!")) return "" split_reason = reason.split(None, 1) time_val = split_reason[0].lower() if len(split_reason) > 1: reason = split_reason[1] else: reason = "" bantime = extract_time(message, time_val) if not bantime: return "" log = "<b>{}:</b>" \ "\n#TEMPBAN" \ "\n<b>Admin:</b> {}" \ "\n<b>User:</b> {} (<code>{}</code>)" \ "\n<b>Time:</b> {}".format(html.escape(chat.title), mention_html(user.id, user.first_name), mention_html(member.user.id, member.user.first_name), member.user.id, time_val) if reason: log += "\n<b>Reason:</b> {}".format(reason) try: if conn: bot.kickChatMember(chat_id, user_id, until_date=bantime) bot.send_sticker(currentchat.id, BAN_STICKER) # banhammer marie sticker send_message( update.effective_message, tl(update.effective_message, "Banned! Pengguna diblokir untuk *{}* pada *{}*.").format( time_val, chat_name), parse_mode="markdown") else: chat.kick_member(user_id, until_date=bantime) bot.send_sticker(chat.id, BAN_STICKER) # banhammer marie sticker send_message( update.effective_message, tl(update.effective_message, "Banned! Pengguna diblokir untuk {}.").format(time_val)) return log except BadRequest as excp: if excp.message == "Reply message not found": # Do not reply send_message( update.effective_message, tl(update.effective_message, "Banned! Pengguna diblokir untuk {}.").format(time_val), quote=False) return log else: LOGGER.warning(update) LOGGER.exception("ERROR banning user %s in chat %s (%s) due to %s", user_id, chat.title, chat.id, excp.message) send_message( update.effective_message, tl(update.effective_message, "Yah sial, aku tidak bisa menendang pengguna itu 😒")) return ""
def new_member(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] should_welc, cust_welcome, cust_content, welc_type = sql.get_welc_pref(chat.id) cleanserv = sql.clean_service(chat.id) if cleanserv: new_members = update.effective_message.new_chat_members for new_mem in new_members: try: dispatcher.bot.delete_message(chat.id, update.message.message_id) except BadRequest: pass if should_welc: sent = None new_members = update.effective_message.new_chat_members for new_mem in new_members: # Give the owner a special welcome if OWNER_SPECIAL and new_mem.id == OWNER_ID: if cleanserv: bot.send_message(chat.id, tl(update.effective_message, "Master telah pulang! Mari kita mulai pesta ini! 😆")) else: send_message(update.effective_message, tl(update.effective_message, "Master telah pulang! Mari kita mulai pesta ini! 😆")) continue # Don't welcome yourself elif new_mem.id == bot.id: continue else: # If welcome message is media, send with appropriate function if welc_type != sql.Types.TEXT and welc_type != sql.Types.BUTTON_TEXT: reply = update.message.message_id # Clean service welcome if cleanserv: reply = False # Formatting text first_name = new_mem.first_name or "PersonWithNoName" # edge case of empty name - occurs for some bugs. if new_mem.last_name: fullname = "{} {}".format(first_name, new_mem.last_name) else: fullname = first_name count = chat.get_members_count() mention = mention_markdown(new_mem.id, first_name) if new_mem.username: username = "******" + escape_markdown(new_mem.username) else: username = mention if cust_welcome: formatted_text = cust_welcome.format(first=escape_markdown(first_name), last=escape_markdown(new_mem.last_name or first_name), fullname=escape_markdown(fullname), username=username, mention=mention, count=count, chatname=escape_markdown(chat.title), id=new_mem.id) else: formatted_text = "" # Build keyboard buttons = sql.get_welc_buttons(chat.id) keyb = build_keyboard(buttons) getsec, mutetime, custom_text = sql.welcome_security(chat.id) # If user ban protected don't apply security on him if is_user_ban_protected(chat, new_mem.id, chat.get_member(new_mem.id)): pass elif getsec: # If mute time is turned on if mutetime: if mutetime[:1] == "0": try: bot.restrict_chat_member(chat.id, new_mem.id, can_send_messages=False) canrest = True except BadRequest: canrest = False else: mutetime = extract_time(update.effective_message, mutetime) try: bot.restrict_chat_member(chat.id, new_mem.id, until_date=mutetime, can_send_messages=False) canrest = True except BadRequest: canrest = False # If security welcome is turned on if canrest: sql.add_to_userlist(chat.id, new_mem.id) keyb.append([InlineKeyboardButton(text=str(custom_text), callback_data="check_bot_({})".format(new_mem.id))]) keyboard = InlineKeyboardMarkup(keyb) # Send message try: sent = ENUM_FUNC_MAP[welc_type](chat.id, cust_content, caption=formatted_text, reply_markup=keyboard, parse_mode="markdown", reply_to_message_id=reply) except BadRequest: sent = send_message(update.effective_message, tl(update.effective_message, "Catatan: Terjadi kesalahan saat mengirim pesan kustom. Harap perbarui.")) return else: # else, move on first_name = new_mem.first_name or "PersonWithNoName" # edge case of empty name - occurs for some bugs. if cust_welcome: if new_mem.last_name: fullname = "{} {}".format(first_name, new_mem.last_name) else: fullname = first_name count = chat.get_members_count() mention = mention_markdown(new_mem.id, first_name) if new_mem.username: username = "******" + escape_markdown(new_mem.username) else: username = mention valid_format = escape_invalid_curly_brackets(cust_welcome, VALID_WELCOME_FORMATTERS) if valid_format: res = valid_format.format(first=escape_markdown(first_name), last=escape_markdown(new_mem.last_name or first_name), fullname=escape_markdown(fullname), username=username, mention=mention, count=count, chatname=escape_markdown(chat.title), id=new_mem.id) else: res = "" buttons = sql.get_welc_buttons(chat.id) keyb = build_keyboard(buttons) else: res = sql.DEFAULT_WELCOME.format(first=first_name) keyb = [] getsec, mutetime, custom_text = sql.welcome_security(chat.id) # If user ban protected don't apply security on him if is_user_ban_protected(chat, new_mem.id, chat.get_member(new_mem.id)): pass elif getsec: if mutetime: if mutetime[:1] == "0": try: bot.restrict_chat_member(chat.id, new_mem.id, can_send_messages=False) canrest = True except BadRequest: canrest = False else: mutetime = extract_time(update.effective_message, mutetime) try: bot.restrict_chat_member(chat.id, new_mem.id, until_date=mutetime, can_send_messages=False) canrest = True except BadRequest: canrest = False if canrest: sql.add_to_userlist(chat.id, new_mem.id) keyb.append([InlineKeyboardButton(text=str(custom_text), callback_data="check_bot_({})".format(new_mem.id))]) keyboard = InlineKeyboardMarkup(keyb) sent = send(update, res, keyboard, sql.DEFAULT_WELCOME.format(first=first_name)) # type: Optional[Message] prev_welc = sql.get_clean_pref(chat.id) if prev_welc: try: if int(prev_welc) != 1: bot.delete_message(chat.id, prev_welc) except BadRequest as excp: pass if sent: sql.set_clean_welcome(chat.id, sent.message_id) fed_id = fedsql.get_fed_id(chat.id) if fed_id == "TeamNusantaraDevs": new_members = update.effective_message.new_chat_members for new_mem in new_members: # CAS Security thread t = threading.Thread(target=check_cas, args=(bot, new_mem.id, new_mem, update.effective_message,)) t.start()