From ef0633d2e51201fee8a0613fabcb8edbf6d7f2d8 Mon Sep 17 00:00:00 2001 From: pixtaded Date: Mon, 2 Sep 2024 14:41:41 +0300 Subject: [PATCH] Add blacklist. --- config.example.json | 1 + index.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.example.json b/config.example.json index f660983..ac7cc85 100644 --- a/config.example.json +++ b/config.example.json @@ -1,6 +1,7 @@ { "token": "Token", "ALLOWED_IDS": ["1266775948548903026", "1151129960141037659", "1275008490959667234", "1234866477086019648", "1277611369578889277", "1242022836529266708", "1275098630059200586", "1277311957405405296", "1277936618749300760", "1275899048171409528"], + "DISALLOWED_IDS": ["1275098630059200586"], "admin": "593524756393754635", "shapeGuild": "1277635303363973173", "shapeChannel": "1277652579547086860", diff --git a/index.js b/index.js index 4ca33ac..23188af 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,12 @@ function isAllowedUser(id) { return false; } +function isDisallowedUser(id) { + const DISALLOWED_IDS = config.DISALLOWED_IDS; + if (DISALLOWED_IDS.find(string => string == id) || !DISALLOWED_IDS.length) return true; + return false; +} + async function getMessageContent(message) { if (message.attachments.size > 0) { try { @@ -60,12 +66,14 @@ function filterPrompt(string) { } async function sendToAI(message) { - if (message.author.id == client.user.id) return; + if (message.author.id == client.user.id && isDisallowedUser(message.author.id)) return; if (message.author.id == config.admin && message.content.startsWith("e ")) { eval(message.content.substring(1)); return; } + + if (message.content.length >= 1800) return; savedMessage = message; client.guilds.cache.get(shapeGuild).channels.cache.get(config.shapeChannel).send(await getMessageContent(message));