SyntaxError: Unexpected token 'return'

Kyklops :

So, I'm very new to node.js and I was attempting to make a command that can only be run by people with the permissions to do so (I'm creating a discord bot.), in this case the requirement being having either the role: "Trusted" or "Ya boi". This is how the console reads the error message:

SyntaxError: Unexpected token 'return'

and these are the lines of code that I'm working with:

    switch(args[0]){
    case 'bump':
        if(!message.member.roles.cache.find(r => r.name === "Trusted") || !message.member.roles.cache.find(r => r.name === "Ya boi") return message.channel.send('You do not have the permissions to do that.');
        setInterval(() => {
        message.channel.send('!d bump');
        }, 10000)
        ;break

I hope someone can help with this problem, thanks in advance!

Eugene Obrezkov :

You missed a parenthesis:

function someOfYourFunctions() {
    switch (args[0]) {
        case 'bump':
            if (!message.member.roles.cache.find(r => r.name === "Trusted") ||!message.member.roles.cache.find(r => r.name === "Ya boi")) return message.channel.send('You do not have the permissions to do that.');

            setInterval(() => message.channel.send('!d bump'), 10000);
            break;
    }
}

There is another ) must be after Ya boi.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related