#Args Question
1 messages ยท Page 1 of 1 (latest)
Yeah
You are fox
0 1 2
args[0] You
args[1] are
args[2] fox
I try to make a help command and therefore I also create sub commands so that people know a bit more about a command if they don't know what it should do. But here's the problem. I use: if (!args[0]) return and then the help message but If I do: if (args[0] = "ping") return embed... it displays the embed, which is fine but when I try another one: if (args[0] = "test" return different embed) it will automatically display the embed of the "ping" argument if you kinda understand what I mean
Here's an example:
if (args[0] = "ping")
return message.channel.send(
new MessageEmbed()
.setAuthor(
"Command Details: >ping", "https://cdn.discordapp.com/avatars/891770116944040057/2861d7bbe152355021f95a1e0d30276b.png?size=4096"
)
.setColor("#5865f2")
.addFields(
{name: "__Description__", value: "Get the bot's latency.", inline: true},
{name: "__Aliases__", value: "`N/A`", inline: true},
{name: "__Usage__", value: "`>ping`", inline: true}
)
.setFooter(`Requested by: ${message.author.tag}`)
);
if (args[0] = "connect")
return message.channel.send(
new MessageEmbed()
.setAuthor(
"Command Details: >connect", "https://cdn.discordapp.com/avatars/891770116944040057/2861d7bbe152355021f95a1e0d30276b.png?size=4096"
)
.setColor("#5865f2")
.addFields(
{name: "__Description__", value: "Join the [#863375541813116963](/guild/222078108977594368/channel/863375541813116963/).", inline: true},
{name: "__Aliases__", value: "`>c`", inline: true},
{name: "__Usage__", value: "`>connect`", inline: true}
)
.setFooter(`Requested by: ${message.author.tag}`)
);
When I use: help connect it will display the message of the ping sub command
Instead of the connect sub command
if you know what I mean ๐
and what does === mean?
control the types ig. i didnt need to use it ever
Haha I understand things quite easily. It worked! Tysm for your help.