Issue with command info cmd

if(command.perms === "Owner" && message.author.id !== config.client.owner) return message.channel.send("Owner")
else if(command.perms === "Staff" && !message.member.roles.cache.has(config.moderation.modRole) || message.channel.id !== config.channels.staffCommands) return message.channel.send("Staff")
if(command.perms === "Owner" && message.author.id !== config.client.owner) return message.channel.send("Owner")
else if(command.perms === "Staff" && !message.member.roles.cache.has(config.moderation.modRole) || message.channel.id !== config.channels.staffCommands) return message.channel.send("Staff")
why does it return "Staff" even if command.perms is "Owner"?
19 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
SpecialSauce
SpecialSauce•2y ago
Just debug your conditionals. Log command and config.client before this section.
-Carlos👑
-Carlos👑OP•2y ago
command log:
{
name: 'eval',
perms: [ 'Owner' ],
aliases: [ 'e', 'ev', 'evaluate' ],
run: [AsyncFunction: run]
}
{
name: 'eval',
perms: [ 'Owner' ],
aliases: [ 'e', 'ev', 'evaluate' ],
run: [AsyncFunction: run]
}
config.client log
{
token: 'token',
prefix: '>',
owner: '756734055025999982',
mongodb: 'hidden',
mainGuild: '1050191162302025838'
}
{
token: 'token',
prefix: '>',
owner: '756734055025999982',
mongodb: 'hidden',
mainGuild: '1050191162302025838'
}
SpecialSauce
SpecialSauce•2y ago
Perms is an array You’re testing it against a string
-Carlos👑
-Carlos👑OP•2y ago
I also tried without an array gonna try without array again yeah same result
SpecialSauce
SpecialSauce•2y ago
Is the owner id yours?
-Carlos👑
-Carlos👑OP•2y ago
yes
SpecialSauce
SpecialSauce•2y ago
So what do you want it to do? You have it set to send owner when author is not owner
-Carlos👑
-Carlos👑OP•2y ago
it's a command info command, I want users only to see info on commands they can use, so if the command perm is set to "Owner" and the author id is not my id it will send "Owner"
SpecialSauce
SpecialSauce•2y ago
Ok so what’s it doing and what’s the expected result
-Carlos👑
-Carlos👑OP•2y ago
It sends "Staff" even if the provided command perm is set to "Owner"
SpecialSauce
SpecialSauce•2y ago
Who is testing it
-Carlos👑
-Carlos👑OP•2y ago
me
SpecialSauce
SpecialSauce•2y ago
So it will never say owner. What is the expected result
-Carlos👑
-Carlos👑OP•2y ago
wait I just realized it works if I run the command on the channel config.channels.staffCommands
SpecialSauce
SpecialSauce•2y ago
Yeah that’s because of the ||
-Carlos👑
-Carlos👑OP•2y ago
but the command perm is owner not staff
SpecialSauce
SpecialSauce•2y ago
&& groups || is separate
-Carlos👑
-Carlos👑OP•2y ago
oh // yeah this fixed it ty
Want results from more Discord servers?
Add your server