Different responses for different users

Hey @GokuSan!

This may help:


Actually, I have some free time, so let’s fix this.

When using a Pastebin you want to declare your Nightbot variables outside of it, I know your code works, but it’s best practice so if one day you need to use more than one variable, you won’t face an issue.

So here’s how to write your command:

$(eval u = '$(user)'.toLowerCase(); $(urlfetch json https://pastebin.com/raw/XXXXXXXX))

And then inside of your Pastebin have the following code:

switch (u) {
  case 'user1':
    'hello user1';
    break;
  case 'user2':
    'hello user2';
    break;
  case 'user3':
    'hello user3';
    break;
  default:
    `¡hello ${u}! 👋`;
}

Write every username (like user1) in lowercase.
I advise you to use a switch in your case to replace the if/else mess, but that’s basically the same thing.

To have the username in the message if it doesn’t match any of the case,
I used template literals: `text ${variable} text`,
but I could have done it like so as well: 'text '+ variable +' text'.