Better function calling - ...argumentArray
This commit is contained in:
parent
24fd053710
commit
9ae2359c8b
@ -21,7 +21,7 @@ module.exports = [
|
||||
commands.forEach(commandList => {
|
||||
commandList.forEach(command => {
|
||||
if (command.hide) {
|
||||
return // Go to next command if this one should show up
|
||||
return // Go to next command if this one shouldnt show up
|
||||
}
|
||||
const field = {name: command.name, value: `Description: ${command.description || "None"}\nArguments: ${command.arguments || "None"}`}
|
||||
embed.addFields(field)
|
||||
|
@ -6,12 +6,15 @@ module.exports = [
|
||||
name: "helptest",
|
||||
description: "Kill every1",
|
||||
arguments: [GuildMember.name, GuildChannel.name],
|
||||
run: (ctx, args) => {
|
||||
if (!args[0].user) {
|
||||
run: (ctx, member, channel) => {
|
||||
if (!member.user) {
|
||||
ctx.reply("Member invalid.")
|
||||
}
|
||||
if (!channel.id) {
|
||||
ctx.reply("Member invalid.")
|
||||
}
|
||||
|
||||
ctx.reply(`Member: ${args[0]}\nChannel: ${args[1]}`)
|
||||
ctx.reply(`Member: ${member}\nChannel: ${channel}`)
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
6
index.js
6
index.js
@ -114,7 +114,11 @@ client.on("messageCreate", (message) => {
|
||||
}
|
||||
|
||||
// Run command
|
||||
realCommand.run(message, args)
|
||||
if (realCommand.arguments == ["any"] || realCommand.arguments == ["none"]) {
|
||||
realCommand.run(message, args)
|
||||
} else {
|
||||
realCommand.run(message, ...args) // Example in extra.js
|
||||
}
|
||||
})
|
||||
|
||||
// After getting the command list we can export it
|
||||
|
Loading…
x
Reference in New Issue
Block a user