mIRC Home    About    Download    Register    News    Help

Print Thread
[Twitch] $msgtags for sub/resub/subgift help? #262517 11/02/18 05:53 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
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?

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262532 15/02/18 05:45 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Any help? would be greatly appreciated smile

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262638 04/03/18 12:58 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Blas] #262673 09/03/18 10:30 PM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
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.

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262689 13/03/18 07:02 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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)

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Blas] #262691 13/03/18 07:14 PM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Ohhh okay, how would i implement them into sub/resub/subgift scripts?

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262699 15/03/18 01:14 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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 .

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Blas] #262703 15/03/18 11:58 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
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

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262707 16/03/18 06:20 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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! 
  }
}

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Blas] #262708 16/03/18 01:32 PM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
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 " "

Last edited by Predatorfusion; 16/03/18 01:43 PM.
Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262710 16/03/18 09:14 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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.

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Blas] #262711 16/03/18 09:19 PM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Yeah it worked for non gifted subs and ill keep that noted if i add the extra line for saying their resub message.

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262713 17/03/18 01:20 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Used that script and tested it for resubs and its still not working for resubs smirk

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Predatorfusion] #262714 17/03/18 03:52 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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

Re: [Twitch] $msgtags for sub/resub/subgift help? [Re: Blas] #262716 17/03/18 05:52 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Ohhh i should of noticed that haha