Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I put 2 discord ids inside a if(message.author.id !=) statement

Hello ive been trying to run this code and tried recoding it multiple times but when ever I try to put 2 ids inside of the if(message.author.id != ownerid) return
message.channel.send("You don’t have access to this command"); it only registers 1 of the ids
heres my current code:

client.on('message', message => {
    if (message.content === prefix + 'listservers') {
    if(message.author.id != ownerid && altid) return message.channel.send("You don't have access to this command");
//rest of the code

}})

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You’ve got a few different options. Here’s how I’d do it, using an array and Array.includes():

const allowedUsers = ["user id 1", "user id 2"]

client.on('message', message => {
    if (message.content === prefix + 'listservers') {
    if(!allowedUsers.includes(message.author.id)) return message.channel.send("You don't have access to this command");
//rest of the code

}})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading