From 4769f96fc0b36c74324beed950bc476ca3ee1989 Mon Sep 17 00:00:00 2001 From: Kaneki <72992708+KanekiWeb@users.noreply.github.com> Date: Sat, 18 Dec 2021 17:35:11 +0100 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=94=8D=20Searcher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔍 Searcher --- Searcher.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Searcher.py b/Searcher.py index 09760ac..2bb3949 100644 --- a/Searcher.py +++ b/Searcher.py @@ -1,4 +1,4 @@ -import os, discord, json +import os, discord, json, re from colorama import Fore, init client = discord.Client() @@ -54,10 +54,15 @@ async def on_ready(): try: async for message in client.get_channel(channel.id).history(limit=99999): messages_count += 1 - for searchmessage in config['messages']: + for searchmessage in config['words']: if searchmessage in message.content: print(f"[{Fore.GREEN}MESSAGE{Fore.RESET}] Message Found: " + message.content) open('found.txt', 'a+').write(f"{message.author.name}: {message.content}\n") + + for regex in config['regex']: + if re.match(r"" + regex, message.content): + print(f"[{Fore.GREEN}MESSAGE{Fore.RESET}] Message Found: " + message.content) + open('found.txt', 'a+').write(f"{message.author.name}: {message.content}\n") except: pass @@ -70,10 +75,15 @@ async def on_ready(): try: async for message in channel.history(limit=99999): messages_count += 1 - for searchmessage in config['messages']: + for searchmessage in config['words']: if searchmessage in message.content: print(f"[{Fore.GREEN}MESSAGE{Fore.RESET}] Message Found: " + message.content) open('found.txt', 'a+').write(f"{message.author.name}: {message.content}\n") + + for regex in config['regex']: + if re.match(r"" + regex, message.content): + print(f"[{Fore.GREEN}MESSAGE{Fore.RESET}] Message Found: " + message.content) + open('found.txt', 'a+').write(f"{message.author.name}: {message.content}\n") except: pass