I need to know if it’s possible to have a !hello command which displays a specific message to a specific user and a normal message to everybody else. The specific people are around 15 and I’d like them to have a specific message for each.
I’ve seen this code which gets close to what I need
Yes, create an account on Pastebin, and create a public or unlisted paste with the code I said should go in it, it’ll be useful to come back and add more people to your command.
As shown by the code example I wrote, you simply add another case.
Let’s say you have this:
switch (u) {
case 'Clauwasaki':
'CLAUWASAKI_MESSAGE';
break;
case 'Nightbot':
'NIGHTBOT_MESSAGE';
break;
default:
'DEFAULT_MESSAGE';
}
…and you want to add a user named Twitch:
switch (u) {
case 'Clauwasaki':
'CLAUWASAKI_MESSAGE';
break;
case 'Nightbot':
'NIGHTBOT_MESSAGE';
break;
case 'Twitch':
'TWITCH_MESSAGE';
break;
default:
'DEFAULT_MESSAGE';
}
No worries, I’ll help you kickstart your file; can you give me the default message(s), and the user-specific messages you already thought of (along with their usernames)?
$(eval u = '$(user)'; $(urlfetch json https://pastebin.com/raw/XXXXXXXX))
Replace XXXXXXXX with your paste id, you’ll see it in the URL once you save it for the first time.
And in your paste, put the following code:
switch (u) {
case 'user1':
'message1';
break;
case 'user2':
'message2';
break;
case 'user3':
'message3';
break;
default:
'Welcome';
}
Each username need to match the case of the username on Twitch, and if your message contains apostrophes you’ll need to escape them with a backslash (\):
Let’s imagine your username was typed clauWasaki to illustrate different casing…