Use set for listing all custom commands
All checks were successful
CI / CI (push) Successful in 25s
Lint Codebase / eslint (push) Successful in 16s

This commit is contained in:
SileNce5k 2024-12-19 18:56:53 +01:00
parent eae1e9130e
commit 7702f10587
Signed by: SileNce
GPG key ID: B0A142BB4291B204
2 changed files with 5 additions and 11 deletions

View file

@ -61,7 +61,7 @@ module.exports = {
}
case "list": {
const embed = new EmbedBuilder();
sendText = getAllCustomCommands();
sendText = getAllCustomCommands(client);
if(sendText !== ""){
embed.setColor(15780145)
embed.addFields(

View file

@ -1,13 +1,7 @@
const fs = require('fs');
module.exports = function(){
const customPath = './data/customCommands.json';
module.exports = function(client){
let list = "";
let json = fs.readFileSync(customPath, 'utf8');
let customCommands = JSON.parse(json)
customCommands.forEach(function (customCommand) {
list = list + customCommand.customName+"\n";
});
client.customCommands.keys().forEach(commandName => list += `${commandName}\n`)
return list;
}