From a9cae18f6352bf9ac1b15b58a6734f9737cf4602 Mon Sep 17 00:00:00 2001
From: SileNce5k <ozzynexus@gmail.com>
Date: Thu, 19 Dec 2024 18:19:20 +0100
Subject: [PATCH] Change onmessage to use new custom commands set instead of
 json file

---
 server/message.js | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/server/message.js b/server/message.js
index 9178afc..587adf2 100644
--- a/server/message.js
+++ b/server/message.js
@@ -23,16 +23,10 @@ module.exports = function(client, owners, message, globalPrefix){
 	const commandName = args.shift().toLowerCase();
 	const command = client.commands.get(commandName);
 	if (!command){
-		const customPath = './data/customCommands.json';
-		if(fs.existsSync(customPath)){
-			let json = fs.readFileSync(customPath, 'utf8');
-			let customCommands = JSON.parse(json)
-			customCommands.forEach(function (customCommand) {
-				if (customCommand.customName === commandName) {
-					let customMessage = customReplaceWithVariables(customCommand.customMessage, message, prefix, globalPrefix)
-					message.channel.send(customMessage)
-				}
-			});
+		const command = client.customCommands.get(commandName);
+		if(command){
+			let customMessage = customReplaceWithVariables(command.customMessage);
+			message.channel.send(customMessage);
 		}
 		return;
 	}