async def scan(event): trim = None replied = await event.get_reply_message() if re.match('.scan -f -o .*', event.text) or re.match( ".scan -o .*", event.text): if replied.fwd_from: if re.match('.scan -o .*', event.text): trim = 2 else: trim = 3 reply = replied.fwd_from target = reply.from_id if reply.from_id in ENFORCERS or reply.from_id in SIBYL: return if reply.from_name: sender = f"[{reply.from_name}](tg://user?id={reply.from_id})" else: sender = f"[{reply.from_id}](tg://user?id={reply.from_id})" else: if replied.sender.id in ENFORCERS: return sender = f"[{replied.sender.first_name}](tg://user?id={replied.sender.id})" target = replied.sender.id executer = await event.get_sender() try: if re.match('.scan -f .*', event.text) and executer.id in INSPECTORS: if not trim: reason = event.text.split(" ", 2)[2] approve = True else: reason = event.text.split(" ", 1)[1] approve = False except BaseException: return if replied.video or replied.document or replied.contact or replied.gif or replied.sticker: await replied.forward_to(Sibyl_logs) if trim: reason = event.text.split(" ", trim)[trim] executor = f'[{executer.first_name}](tg://user?id={executer.id})' chat = f"t.me/{event.chat.username}/{event.message.id}" if event.chat.username else f"Occurred in Private Chat - {event.chat.title}" await event.reply("Scanning...") if not approve: msg = await System.send_message( Sibyl_logs, scan_request_string.format(enforcer=executor, spammer=sender, chat=chat, message=replied.text, reason=reason)) if approve: msg = await System.send_message( Sibyl_logs, forced_scan_string.format(ins=executor, spammer=sender, chat=chat, message=replied.text, reason=reason)) await System.gban(executer.id, target, reason, msg.id, executer)
async def scan(event): replied = await event.get_reply_message() flags, reason = seprate_flags(event.text) if len(reason.split(" ", 1)) == 1: return split = reason.strip().split(" ", 1) reason = reason.strip().split(" ", 1)[1].strip() if "u" in flags.keys(): url = reason data = get_data_from_url(url) if not data: await event.reply("Invalid url") return try: message = await System.get_messages( int(data[0]) if data[0].isnumeric() else data[0], ids=int(data[1]) ) except: await event.reply("Failed to get data from url") return executor = await event.get_sender() executor = f"[{executor.first_name}](tg://user?id={executor.id})" if not message: await event.reply("Failed to get data from url") return if message.from_id.user_id in MANAGERS: return msg = await System.send_message( Sibyl_logs, scan_request_string.format( manager=executor, spammer=message.from_id.user_id, chat=f"https://t.me/{data[0]}/{data[1]}", message=message.text, reason=reason.split(" ", 1)[1].strip(), ), ) return if not event.is_reply: return if "o" in flags.keys(): if replied.fwd_from: reply = replied.fwd_from target = reply.from_id.user_id if reply.from_id.user_id in MANAGERS or reply.from_id.user_id in CARDINAL: return if not reply.from_id.user_id: await event.reply("Cannot get user ID.") return if reply.from_name: sender = f"[{reply.from_name}](tg://user?id={reply.from_id.user_id})" else: sender = f"[{reply.from_id.user_id}](tg://user?id={reply.from_id.user_id})" else: if replied.sender.id in MANAGERS: return sender = f"[{replied.sender.first_name}](tg://user?id={replied.sender.id})" target = replied.sender.id executer = await event.get_sender() req_proof = req_user = False if "f" in flags.keys() and executer.id in DEVELOPERS: approve = True else: approve = False if replied.media: await replied.forward_to(Sibyl_logs) executor = f"[{executer.first_name}](tg://user?id={executer.id})" chat = ( f"t.me/{event.chat.username}/{event.message.id}" if event.chat.username else f"t.me/c/{event.chat.id}/{event.message.id}" ) await event.reply("Connecting to Cardinal for a cymatic scan.") if req_proof and req_user: await replied.forward_to(Sibyl_logs) await System.gban( executer.id, req_user, reason, msg.id, executer, message=replied.text ) if not approve: msg = await System.send_message( Sibyl_logs, scan_request_string.format( manager=executor, spammer=sender, chat=chat, message=replied.text, reason=reason, ), ) return msg = await System.send_message( Sibyl_logs, forced_scan_string.format( dev=executor, spammer=sender, chat=chat, message=replied.text, reason=reason ), ) await System.gban( executer.id, target, reason, msg.id, executer, message=replied.text )
async def stfu(event, flags): replied = await event.get_reply_message() if flags.r: reason = " ".join(flags.r) else: split = event.text.split(' ', 1) if len(split) == 1: return reason = seprate_flags(split[1]).strip() if not reason: return if flags.u: url = flags.u data = get_data_from_url(url) if not data: await event.reply("Invalid url") return try: message = await System.get_messages( int(data[0]) if data[0].isnumeric() else data[0], ids=int(data[1])) except: await event.reply("Failed to get data from url") return executor = await event.get_sender() executor = f"[{executor.first_name}](tg://user?id={executor.id})" if not message: await event.reply("Failed to get data from url") return if message.from_id.user_id in ENFORCERS: return msg = await System.send_message( Sibyl_logs, scan_request_string.format( enforcer=executor, spammer=message.from_id.user_id, chat=f"https://t.me/{data[0]}/{data[1]}", message=message.text, reason=reason, ), ) return if not event.is_reply: return if flags.o: if replied.fwd_from: reply = replied.fwd_from target = reply.from_id.user_id if reply.from_id.user_id in ENFORCERS or reply.from_id.user_id in SIBYL: return if not reply.from_id.user_id: await event.reply("Cannot get user ID.") return if reply.from_name: sender = f"[{reply.from_name}](tg://user?id={reply.from_id.user_id})" else: sender = ( f"[{reply.from_id.user_id}](tg://user?id={reply.from_id.user_id})" ) else: if replied.sender.id in ENFORCERS: return sender = f"[{replied.sender.first_name}](tg://user?id={replied.sender.id})" target = replied.sender.id executer = await event.get_sender() req_proof = req_user = False if flags.f and executer.id in INSPECTORS: approve = True else: approve = False if replied.media: await replied.forward_to(Sibyl_logs) executor = f"[{executer.first_name}](tg://user?id={executer.id})" chat = (f"t.me/{event.chat.username}/{event.message.id}" if event.chat.username else f"t.me/c/{event.chat.id}/{event.message.id}") await event.reply("Ok!") if req_proof and req_user: await replied.forward_to(Sibyl_logs) await System.gban(executer.id, req_user, reason, msg.id, executer, message=replied.text) if not approve: msg = await System.send_message( Sibyl_logs, scan_request_string.format( enforcer=executor, spammer=sender, chat=chat, message=replied.text, reason=reason, ), ) return msg = await System.send_message( Sibyl_logs, forced_scan_string.format(ins=executor, spammer=sender, chat=chat, message=replied.text, reason=reason), ) await System.gban(executer.id, target, reason, msg.id, executer, message=replied.text)
async def scan(event): replied = await event.get_reply_message() flags, reason = seprate_flags(event.text) if len(reason.split(" ", 1)) == 1: return split = reason.strip().split(" ", 1) reason = reason.strip().split(" ", 1)[1] if 'u' in flags.keys(): url = reason data = get_data_from_url(url.strip()) if not data: await event.reply('Invalid url') return try: message = await System.get_messages( int(data[0]) if data[0].isnumeric() else data[0], ids=int(data[1])) except: await event.reply('Failed to get data from url') return executor = await event.get_sender() executor = f'[{executor.first_name}](tg://user?id={executor.id})' if not message: await event.reply('Failed to get data from url') return if message.from_id in ENFORCERS: return msg = await System.send_message( Sibyl_logs, scan_request_string.format( enforcer=executor, spammer=message.from_id, chat=f"https://t.me/{data[0]}/{data[1]}", message=message.text, reason=split[1].strip().split(' ')[1])) return if not event.is_reply: return if 'o' in flags.keys(): if replied.fwd_from: reply = replied.fwd_from target = reply.from_id if reply.from_id in ENFORCERS or reply.from_id in SIBYL: return if not reply.from_id: await event.reply("Cannot get user ID.") return if reply.from_name: sender = f"[{reply.from_name}](tg://user?id={reply.from_id})" else: sender = f"[{reply.from_id}](tg://user?id={reply.from_id})" else: if replied.sender.id in ENFORCERS: return sender = f"[{replied.sender.first_name}](tg://user?id={replied.sender.id})" target = replied.sender.id executer = await event.get_sender() req_proof = req_user = False if 'f' in flags.keys() and executer.id in INSPECTORS: approve = True else: approve = False if replied.media: await replied.forward_to(Sibyl_logs) executor = f'[{executer.first_name}](tg://user?id={executer.id})' chat = f"t.me/{event.chat.username}/{event.message.id}" if event.chat.username else f"t.me/c/{event.chat.id}/{event.message.id}" await event.reply("Connecting to Sibyl for a cymatic scan.") if req_proof and req_user: await replied.forward_to(Sibyl_logs) await System.gban(executer.id, req_user, reason, msg.id, executer) if not approve: msg = await System.send_message( Sibyl_logs, scan_request_string.format(enforcer=executor, spammer=sender, chat=chat, message=replied.text, reason=reason)) return msg = await System.send_message( Sibyl_logs, forced_scan_string.format(ins=executor, spammer=sender, chat=chat, message=replied.text, reason=reason)) await System.gban(executer.id, target, reason, msg.id, executer)