Hello. I am trying to make a command with specified response. For example if person that types is a mod command should response “you are a mod”, if person is vip, it should response “you are a vip” etc. I looked at guide but I couldnt find the correct parameter for that. What I mean is this:
if (target.vip==True){
client.say(target, “You are a vip”);
}
else if (target.mod==True){
client.say(target, “You are a mod”);
}
This is an example. I dont know that vip and mod parameters are true. It could be “target.badges”.
You would usually grab the tags of a message
Then process the badges in the tags of that message
And then see if a mod or VIP badge is present
So:
@badge-info=subscriber/88;badges=moderator/1,subscriber/84,ambassador/1;client-nonce=60f008953dd3605f9295a92ceeaa5542;color=#033700;display-name=BarryCarlyon;emotes=;flags=;id=b8accce3-ece6-405c-9ad6-49b5d4aa8b18;mod=1;room-id=26610234;subscriber=1;tmi-sent-ts=1622298651298;turbo=0;user-id=15185913;user-type=mod :barrycarlyon!barrycarlyon@barrycarlyon.tmi.twitch.tv PRIVMSG #cohhcarnage :more moo
Extract the tags
@badge-info=subscriber/88;badges=moderator/1,subscriber/84,ambassador/1;client-nonce=60f008953dd3605f9295a92ceeaa5542;color=#033700;display-name=BarryCarlyon;emotes=;flags=;id=b8accce3-ece6-405c-9ad6-49b5d4aa8b18;mod=1;room-id=26610234;subscriber=1;tmi-sent-ts=1622298651298;turbo=0;user-id=15185913;user-type=mod
Then grab the badges
badges=moderator/1,subscriber/84,ambassador/1;
And you can look for the moderator
or vip
badge.
If using an IRC messageparser or something like
And thus assuming JavaScript
It’ll convert it into an object
badges=moderator/1,subscriber/84,ambassador/1;
becomes something like
payload.tags['badges'] = {
'moderator': "1",
'subscriber': "1",
'ambassador': "1"
}
then in JS you can do
if (payload.tags['badges'].hasOwnProperty('moderator')) {
// is a mod
}
if (payload.tags['badges'].hasOwnProperty('vip')) {
// is a vip
}
Thank you so much. I found a solution. Here check it out the working version: Code
system
Closed
July 1, 2021, 10:06pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.