Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

If you're going to add more commands in the future, I'd recommend setting up a dictionary/object, or a switch statement. Personally, I'd recommend the switch statement, so here's how you might do that:

if(message.user !== "SirAlfred") {
    switch(message.content) {
        case "subscribe":
            ...
            break;

        ...
    }
}

Also, you have a bug. Instead of using the != and == equality operators, you should be using the !== and === identity operators. See this Stackoverflow questionthis Stackoverflow question.

If you're going to add more commands in the future, I'd recommend setting up a dictionary/object, or a switch statement. Personally, I'd recommend the switch statement, so here's how you might do that:

if(message.user !== "SirAlfred") {
    switch(message.content) {
        case "subscribe":
            ...
            break;

        ...
    }
}

Also, you have a bug. Instead of using the != and == equality operators, you should be using the !== and === identity operators. See this Stackoverflow question.

If you're going to add more commands in the future, I'd recommend setting up a dictionary/object, or a switch statement. Personally, I'd recommend the switch statement, so here's how you might do that:

if(message.user !== "SirAlfred") {
    switch(message.content) {
        case "subscribe":
            ...
            break;

        ...
    }
}

Also, you have a bug. Instead of using the != and == equality operators, you should be using the !== and === identity operators. See this Stackoverflow question.

Source Link
Ethan Bierlein
  • 15.8k
  • 4
  • 59
  • 146

If you're going to add more commands in the future, I'd recommend setting up a dictionary/object, or a switch statement. Personally, I'd recommend the switch statement, so here's how you might do that:

if(message.user !== "SirAlfred") {
    switch(message.content) {
        case "subscribe":
            ...
            break;

        ...
    }
}

Also, you have a bug. Instead of using the != and == equality operators, you should be using the !== and === identity operators. See this Stackoverflow question.