mIRC Homepage

[Twitch] $msgtags for sub/resub/subgift help?

Posted By: Predatorfusion

[Twitch] $msgtags for sub/resub/subgift help? - 11/02/18 05:53 AM

With sub/resub/subgift scripts is it possible to display whether the user subbed resubbed or had a sub gifted to them with 4.99 9.99 or 24.99?
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 15/02/18 05:45 AM

Any help? would be greatly appreciated smile
Posted By: Blas

Re: [Twitch] $msgtags for sub/resub/subgift help? - 04/03/18 12:58 PM

I've been away from the forum for a while so I'm a bit late to reply. I essentially answered this same question a while ago in another thread. See this post as well as the two links referenced in it. It should provide you with everything that you need to write to a script that will do what you want.

Script for Subscriber notifications

Let me know if helps or not. smile
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 09/03/18 10:30 PM

Ahh okay. Looked at the raw events with msg-param-sub-plan but idk how to convert 1000,2000 and 3000 to display 4.99, 9.99 and 24.99. i tried doing $msgtags(msg-param-sub-plan) but it returns saying $true.
Posted By: Blas

Re: [Twitch] $msgtags for sub/resub/subgift help? - 13/03/18 07:02 PM

From the Twitch Documentation:

Quote:
msg-param-sub-plan (Sent only on sub or resub) The type of subscription plan being used. Valid values: Prime, 1000, 2000, 3000. 1000, 2000, and 3000 refer to the first, second, and third levels of paid subscriptions, respectively (currently $4.99, $9.99, and $24.99).


Therefor, you can just tell your script what to do with the values.

Example 1:

Code:
IF ($msgtags(msg-param-sub-plan).key == 1000) VAR %sub-plan $chr(36) $+ 4.99
ELSEIF ($msgtags(msg-param-sub-plan).key == 2000) VAR %sub-plan $chr(36) $+ 9.99
ELSEIF ($msgtags(msg-param-sub-plan).key == 3000) VAR %sub-plan $chr(36) $+ 24.99
ELSEIF ($msgtags(msg-param-sub-plan).key == Prime) VAR %sub-plan Prime


Example 2:

Code:
VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99)
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 13/03/18 07:14 PM

Ohhh okay, how would i implement them into sub/resub/subgift scripts?
Posted By: Blas

Re: [Twitch] $msgtags for sub/resub/subgift help? - 15/03/18 01:14 AM

Originally Posted By: Predatorfusion
Ohhh okay, how would i implement them into sub/resub/subgift scripts?


The way you would with anything else in your mIRC scripts... assuming you used %sub-plan as the variable name like in the above examples you could do something like:

Code:
MSG $chan %username just subscribed with a %sub-plan Subscription!


Assuming that %username is the variable you set up for the persons name... it would message chat something like:

Quote:
Predatorfusion just subscribed with a $4.99 Subscription!


You would have to set up other parts of your script to check for gifted subs or resubs if you want it worded differently with the usernames of the people who gave and received the subscription.

As a side note, you mentioned earlier that $msgtags(msg-param-sub-plan) only returned $true for you. Be sure that you added the .key at the end of that. It's easy to forget it. So it's actually $msgtags(msg-param-sub-plan).key .
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 15/03/18 11:58 AM

Ahhhi tried to do it like this:
Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == sub) && ($1 == #)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99)
    if ($0 == 1) {
      msg $1 Thank you $msgtags(display-name).key for subscribing with a %sub-plan sub! 
    }
  }
}

But whenever someone subbbed it wouldnt detect anyone subbing
Posted By: Blas

Re: [Twitch] $msgtags for sub/resub/subgift help? - 16/03/18 06:20 AM

First off, if you're going to use ($1 == #) on your line 2 to verify that the sub is coming from the channel that you want, make sure that you're specifying the full #channelname with the # symbol. I prefer to match the room-id instead to make sure that it's from the right channel, this makes more sense to me as the room-id can never change but the name of the channel on Twitch can change if you change your username.

Example:
Code:
if (($msgtags(msg-id).key == sub) && ($msgtags(room-id).key == 83931881)) {


You of course would replace the number of the room-id with your own room-id number. You can get that from simply reading the RAW data from any message sent in your channel.

Also, I'm not sure why you're using if ($0 == 1) on line 4. It's unnecessary IMO if you've already gotten to that point in your script.

Here's a quick edit of your script that should get things working (again, replace the ######## on line 2 with your own room-id):

Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == sub) && ($msgtags(room-id).key == ########)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    var %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99)
    msg $1 Thank you %nick for subscribing with a %sub-plan sub! 
  }
}
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 16/03/18 01:32 PM

Ahh okay i understand now with using room-id instead of if ($0 == 1). WOuld the script be the same for resubs and gifted subs? as resubs and gifted are still not being detected.
Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == resub) && ($msgtags(room-id) == 39298218)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99) 
    msg $1 %nick has just resubscribed for $msgtags(msg-param-months).key months in a row with a %sub-plan sub!
  }
}

Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == subgift) && ($msgtags(room-id).key == 39298218)) {  
    var %nick_from $iif($msgtags(display-name).key, $v1, $msgtags(login).key) , %nick_to $iif($msgtags(msg-param-recipient-display-name).key, $v1, $msgtags(msg-param-recipient-user-name).key)
    VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99)
    msg $1 Thank you %nick_from for gifting a %sub-plan sub to %nick_to $+ !
  }
}

They havent been detecting if someone resubs or gifts a sub.
Also with the resub one idk how id get it respond to resubs that use a message and then when they do resub with a message for it to say the message they put along with Saying Thank you %nick for resubscribing with a %sub-plan sub! with a message " "
Posted By: Blas

Re: [Twitch] $msgtags for sub/resub/subgift help? - 16/03/18 09:14 PM

It is working for new (non-gifted) subs, though?
As it looks like the scripts you posted for resubs and gifted subs should be working. The only reason I would think they're not working if because you have
Code:
raw USERNOTICE:*:{
multiple times in your script. Keep everything under that or your script will only capture on the first instance of that code I believe. So your two scripts above would just be:

Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == resub) && ($msgtags(room-id) == 39298218)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99) 
    msg $1 %nick has just resubscribed for $msgtags(msg-param-months).key months in a row with a %sub-plan sub!
  }
  if (($msgtags(msg-id).key == subgift) && ($msgtags(room-id).key == 39298218)) {  
    var %nick_from $iif($msgtags(display-name).key, $v1, $msgtags(login).key) , %nick_to $iif($msgtags(msg-param-recipient-display-name).key, $v1, $msgtags(msg-param-recipient-user-name).key)
    VAR %sub-plan $replace($msgtags(msg-param-sub-plan).key, 1000, $chr(36) $+ 4.99, 2000, $chr(36) $+ 9.99, 3000, $chr(36) $+ 24.99)
    msg $1 Thank you %nick_from for gifting a %sub-plan sub to %nick_to $+ !
  }
}


You could code it a bit nicer than that but yeah just keep one raw USERNOTICE:*: per script.
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 16/03/18 09:19 PM

Yeah it worked for non gifted subs and ill keep that noted if i add the extra line for saying their resub message.
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 17/03/18 01:20 AM

Used that script and tested it for resubs and its still not working for resubs smirk
Posted By: Blas

Re: [Twitch] $msgtags for sub/resub/subgift help? - 17/03/18 03:52 AM

I missed it earlier, but I just now noticed looking at what you pasted, you forget the .key again for your resub script, this time on $msgtags(room-id). smile
Posted By: Predatorfusion

Re: [Twitch] $msgtags for sub/resub/subgift help? - 17/03/18 05:52 AM

Ohhh i should of noticed that haha
© 2021 mIRC Discussion Forums