Reputation: 13
Here's my code for the section of the command:
if (message.member.id = ("566757254100156426")) {
message.channel.send('Obtaining ping...').then(msg => {
const ping = msg.createdTimestamp - message.createdTimestamp;
msg.edit(`Pong! **${ping}ms**`);
})
} else {
message.channel.send('You do not have the right role for this command!')
}
Upvotes: 1
Views: 147
Reputation: 6710
If the id of whoever is trying to execute the command is equal to yours, execute the command. Otherwise, send an error.
if (message.member.id === '566757254100156426') {
// command code
} else {
// error message
}
Upvotes: 2
Reputation: 89
Use:
if (message.author.id === "566757254100156426")
In JavaScript
, you have to put tree equals to test equality.
Upvotes: 0