diff --git a/src/automations/unscan.ts b/src/automations/unscan.ts
new file mode 100644
index 0000000..1fb47f8
--- /dev/null
+++ b/src/automations/unscan.ts
@@ -0,0 +1,67 @@
+import * as scan from '../utils/scanners.js'
+
+export async function LinkCheck(message): Promise<boolean> {
+    let links = message.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi) ?? []
+    let detections = []
+    const promises = links.map(async element => {
+        try {
+            element = await scan.testLink(element)
+        } catch {}
+        detections.push({tags: element.tags || [], safe: element.safe})
+    });
+    await Promise.all(promises);
+    let types = [
+        "PHISHING",  "DATING",            "TRACKERS",    "ADVERTISEMENTS", "FACEBOOK",
+        "AMP",       "FACEBOOK TRACKERS", "IP GRABBERS", "PORN",
+        "GAMBLING",  "MALWARE",           "PIRACY",      "RANSOMWARE",
+        "REDIRECTS", "SCAMS",             "TORRENT",     "HATE",           "JUNK"
+    ]
+    let detectionsTypes = detections.map(element => {
+        let type = types.find(type => element.tags.includes(type))
+        if (type) return type
+        if (!element.safe) return "UNSAFE"
+        return undefined
+    }).filter(element => element !== undefined)
+    return detectionsTypes.length > 0
+}
+
+export async function NSFWCheck(element): Promise<boolean> {
+    try {
+        //@ts-ignore
+        let test = (await scan.testNSFW(element)).nsfw
+        return test
+    } catch {
+        return false
+    }
+}
+
+export async function SizeCheck(element): Promise<boolean> {
+    if (element.height == undefined || element.width == undefined) return true
+    if (element.height < 20 || element.width < 20) return false
+	return true
+}
+
+export async function MalwareCheck(element): Promise<boolean> {
+	try {
+        //@ts-ignore
+        return (await scan.testMalware(element)).safe
+    } catch {
+        return true
+    }
+}
+
+export function TestString(string, soft, strict): string {
+    for(let word of strict || []) {
+        if (string.toLowerCase().includes(word)) {
+            return "strict"
+        }
+    }
+    for(let word of soft) {
+        for(let word2 of string.match(/[a-z]+/gi) || []) {
+            if (word2 == word) {
+                return "loose"
+            }
+        }
+    }
+    return "none"
+}
\ No newline at end of file
