mIRC Homepage

Script To Announce Subs On Twitch

Posted By: SayLoh

Script To Announce Subs On Twitch - 03/07/18 01:33 AM

Hello I am new to mIRC but am trying to set myself up as a bot to announce new subscribers for my friends stream. I have tried pulling scripts from other forums and such but have been unable to get it to work. If anyone could help me out with a working script it would be much appreciated. I basically just need it to automatically respond with a message thanking the user for their sub/resub. Thank you for any help!
Posted By: SayLoh

Re: Script To Announce Subs On Twitch - 23/07/18 12:57 AM

I have a script that is working kind of strangely. It is announcing subscriptions without a problem, but it is also announcing the sub message for resubs and gift subs as well. So when someone resubs it triggers the sub message and the resub message. The sub message is also oddly triggered on raids as well.

Code:
ON *:CONNECT: {
  raw CAP REQ :twitch.tv/membership 
  raw CAP REQ :twitch.tv/commands 
  raw CAP REQ :twitch.tv/tags 
} 

raw USERNOTICE:*:{
  if(($msgtags(msg-id).key == sub)&&($1 == #averagemark)){
  var %nick $iif($msgtags(display-name).key,$v1,$msgtags(login).key)
  describe $1 THANK YOU %nick FOR SUBSCRIBING!! Welcome to the AVGFAM!! averag3Sip nickmercsLG nickmercsSUB
}
elseif(($msgtags(msg-id).key == resub)&&($1 == #averagemark)){
var %nick $iif($msgtags(display-name).key,$v1,$msgtags(login).key)
if ($0 == 1) {
  describe $1 THANK YOU %nick FOR THE $msgtags(msg-param-months).key MONTHS IN A ROW! averag3Sip nickmercsLG nickmercsSUB
}
else {
  describe $1 THANK YOU %nick FOR THE $msgtags(msg-param-months).key MONTHS IN A ROW! averag3Sip nickmercsLG nickmercsSUB Left a note: $qt($2-) 
}
}
}
Posted By: Wims

Re: Script To Announce Subs On Twitch - 23/07/18 01:14 AM

all { and } basically have to be spaced out, same for && and ||, your script is not working at all, it's just executing the commands with no logic/condition:

Code:
ON *:CONNECT: {
  raw CAP REQ :twitch.tv/membership 
  raw CAP REQ :twitch.tv/commands 
  raw CAP REQ :twitch.tv/tags 
} 

raw USERNOTICE:*:{
  if ($1 == #averagemark) && ($findtok(resub sub,$msgtags(msg-id).key,32)) {
   var %emot averag3Sip nickmercsLG nickmercsSUB
   describe $1 THANK YOU $iif($msgtags(display-name).key,$v1,$msgtags(login).key) FOR [ $iif($v1 == 2,SUBSCRIBING!! Welcome to the AVGFAM!! %emot,THE $msgtags(msg-param-months).key MONTHS IN A ROW! %emot $iif($0 != 1,Left a note: $qt($2-))) ]
  }
}

I took the liberty to rewrite your script shorter since it's doing the same thing everywhere, if you understand $iif you shouldn't have much troubles understanding it, I added %emot so that you can just edit that variable to apply the emote to all cases, this is untested but should work..


Posted By: SayLoh

Re: Script To Announce Subs On Twitch - 23/07/18 05:51 AM

Thank you for consolidating the script, I appreciate the help, however there is one issue. I just tested it with a basic subscription, however the resub message was triggered.
Posted By: Wims

Re: Script To Announce Subs On Twitch - 23/07/18 09:44 AM

Yes, the original rewrite had an issue, I didn't realize $v1 would not be the correct value, I edited my post to include a quick fix using [ ]
Posted By: SayLoh

Re: Script To Announce Subs On Twitch - 23/07/18 09:59 AM

I missed the edit, my bad, thank you so much for the help!
© 2021 mIRC Discussion Forums