diff --git a/util/custom_commands/getOwnerOfCustomCommand.js b/util/custom_commands/getOwnerOfCustomCommand.js index bdcf156..f0106c0 100644 --- a/util/custom_commands/getOwnerOfCustomCommand.js +++ b/util/custom_commands/getOwnerOfCustomCommand.js @@ -1,15 +1,10 @@ const fs = require('fs'); module.exports = function(customName){ - let author = false; const customPath = './data/customCommands.json'; let json = fs.readFileSync(customPath, 'utf8'); let customCommands = JSON.parse(json) - customCommands.forEach(function (customCommand) { - if (customCommand.customName === customName) { - author = customCommand.author; - } - }); - - return author; + let author = customCommands.filter(customCommands => customCommands.customName === customName); + if(author.length === 0) return false; + return author[0].author; } \ No newline at end of file