mIRC Home    About    Download    Register    News    Help

Print Thread
[Twitch] New gift a sub update. #261707 16/11/17 04:18 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Does any one have a updated version of the new subs/resubs scripts for the new gifted subs update that twitch did?

Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261764 23/11/17 11:44 PM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Anyone able to help?

Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261767 24/11/17 08:34 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I don't know what subs/resubs scripts that you're referring to. You need to use the proper $msgtags in your scripts for sub gifting. I don't think Twitch has any docs on it anywhere (not unusual). I was able to modify my own scripts to work with sub gifting.

An example to get started:
Code:
IF ($msgtags(msg-id).key == subgift) {
  ...do stuff...
}

Re: [Twitch] New gift a sub update. [Re: Blas] #261800 26/11/17 01:39 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Ahh so something like this?
raw USERNOTICE:*:{
if (($msgtags(msg-id).key == subgift) && ($1 == #channel)) {
var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
if ($0 == 1) {
msg $1 Thank you $msgtags(display-name).key for subscribing with a gifted sub from $2 <3
}
}
}

Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261801 26/11/17 02:00 AM
Joined: Jan 2004
Posts: 1,204
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,204
I don't know enough about twitch to answer your twitch-related question, but I just have a comment about your script. When you paste code you should use the "#" icon to give you the code tags. If you place your code between them it puts your code in a different font, and also preserves the extra spacing, making it easier to read. The preview-post button lets you see what it looks like before you post it. Like:

Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == subgift) && ($1 == #channel)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    if ($0 == 1) {
      msg $1 Thank you $msgtags(display-name).key for subscribing with a gifted sub from $2 <3 
    }
  }
}


You have a command to create the %nick local variable but never use it again, and local variables disappear as soon as the event or alias completes.

Then you have ($0 == 1) which can only be true if there was exactly 1 parameter 'token' in the usernotice ($0 is the count of how many token there are), yet your message uses $2 which represents the 2nd parameter, which can never exist when $0 is 1.

Re: [Twitch] New gift a sub update. [Re: maroon] #261802 26/11/17 02:51 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Ahh okay, so what would i use to get 2 nick's then? as it posts "userwhogifted gifted a $4.99 sub to user!" and the $msgtags(display-name).key only gets 1 of the nicks from the message. i understand the $0 part now as in the script its used to separate it from being triggered in multiple channels.

Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261803 26/11/17 03:23 AM
Joined: Jan 2004
Posts: 1,204
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,204
Based on the assumption that $1 is the string you mentioned, if the $1 token contains the quotes, you'll need to use $noqt($1) in place of $1 to remove the surrounding quotes. You can use $gettok(string,token-number,delimiter-ascii) to find part of the token, then if the ! is touching the receiver, you'll need to use either $remove(user!,!) to remove all !'s or remove only the last character with $left(user!,-1)

I don't know twitch, so I don't know whether it's possible for them to have "!" as part of the nick. So if you know that user! is the 7th word, you can the the user without the "!" with $left( $gettok($1,7,32) ,-1)

If the sentence can be a variety of sentences but the user! is always the last token by using token -1 instead of 7. If the only thing you know is that user! follows the word 'to' you can use $findtok($1,to,1,32) to find which token is the word 'to' then add 1 to that.

If Userwhogifted is the first word always, you can get it either the way you're getting it, or get the 1st token of $1 with $gettok($1,1,32).

32 is the $asc() of the space character, so if tokens are delimited by commas use 44. The other most common delimiter is the period, which is ASCII 46.

Summary:
Code:
msg $chan giver is $gettok($noqt($1),1,32) receiver is $remove($gettok($noqt($1),7,32),!)

Re: [Twitch] New gift a sub update. [Re: maroon] #261804 26/11/17 04:17 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Ohh, ill have to try than then

Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261808 26/11/17 08:35 AM
Joined: Sep 2016
Posts: 33
P
Predatorfusion Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
so i tried that and it did "giver is #channel receiver is "

Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261813 26/11/17 06:37 PM
Joined: Jan 2004
Posts: 1,204
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,204
within the even where $1 contains that string with the 2 nicks, this will echo to the status window the contents of each token within $1, so you know which one to use in your display, assuming each token is separated by a space character:

Code:
//var %j $numtok($1,32) | var %i 1 | while (%i <= %j) { echo -a token %i is $gettok($1,%i,32) | inc %i }

Last edited by maroon; 26/11/17 06:37 PM.
Re: [Twitch] New gift a sub update. [Re: Predatorfusion] #261815 27/11/17 12:31 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
You can find the $msgtags that are available to be used by reading the RAW data when someone gifts a sub to someone else. Here are the newer ones that I've noticed when it's a sub gift in channel:

Code:
$msgtags(msg-id).key
^ This will match "subgift" if the notice is a gifted sub in the channel.
Code:
$msgtags(msg-param-recipient-display-name).key
^ This is the Twitch DisplayName of the recipient of the gifted sub.
Code:
$msgtags(msg-param-recipient-id).key
^ This is the Twitch UserID of the recipient of the gifted sub.
Code:
$msgtags(msg-param-recipient-user-name).key
^ This is the username of the recipient of the gifted sub (all lowercase name).

Based on this info, I did a quick edit to your script. As mentioned by maroon, the "$0 == 1" doesn't really make sense in your script, and it actually looks unnecessary to me.

Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == subgift) && ($1 == #channel)) {
    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)
    msg $1 Thank you %nick_to for subscribing with a gifted sub from %nick_from <3 
  }
}

Re: [Twitch] New gift a sub update. [Re: Blas] #261835 28/11/17 04:01 PM
Joined: Oct 2017
Posts: 14
K
Kex Offline
Pikka bird
Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Greetings, Is there a working code greetings of followers in chat at the moment?

Re: [Twitch] New gift a sub update. [Re: Kex] #261836 29/11/17 05:53 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
Originally Posted By: Kex
Greetings, Is there a working code greetings of followers in chat at the moment?

I might have one that I wrote that I could maybe share. Perhaps you should open a new topic for it though. smile