mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2016
Posts: 8
O
OAM Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jun 2016
Posts: 8
This is what I'm working with. It works, but when someone resubs and adds a custom message, it doesnt trigger. Where am I going wrong :^(

Quote:
on *:LOGON:*:{
raw CAP REQ :twitch.tv/membership
raw CAP REQ :twitch.tv/tags
raw CAP REQ :twitch.tv/commands
/debug raw
}

on 1:text:*subscribed*:#channelname:{
if ( $nick == twitchnotify ) && ($istok($1-,subscribed to,32)) halt
elseif ($nick == twitchnotify) && ( $4 == $null ) { describe $chan $1 just subscribed to the stream! }
}

raw USERNOTICE:*#channelname:{
if ($1 == #channelname) {
if ($2- == $null) && (resub isin $msgtags) {
msg $1 /me $msgtags(display-name).key has been subbed for $msgtags(msg-param-months).key months in a row!
}
else {
msg $1 /me $msgtags(display-name).key has been subbed for $msgtags(msg-param-months).key months in a row with the message: " $2- "!
}
}
}

Last edited by OAM; 29/06/16 03:31 AM.
Joined: Jun 2014
Posts: 77
K
Babel fish
Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
Hey @OAM,


Try using this code:

Quote:
on *:LOGON:*:{
raw CAP REQ :twitch.tv/membership
raw CAP REQ :twitch.tv/tags
raw CAP REQ :twitch.tv/commands
/debug @raw
}

on 1:TEXT:*subscribed*:#channelname:{
if ( $nick == twitchnotify ) && ($istok($1-,subscribed to,32)) halt
elseif ($nick == twitchnotify) && ( $4 == $null ) { describe $chan $1 just subscribed to the stream! }
}


raw USERNOTICE:*:{
if ($msgtags(room-id).key == [CHANNEL ID HERE]) {
if ($2- == $null) && (resub isin $msgtags) {
msg $1 $msgtags(display-name).key has been subbed for $msgtags(msg-param-months).key months in a row!
}
else {
msg $1 $msgtags(display-name).key has been subbed for $msgtags(msg-param-months).key months in a row with the message: " $2- "!
}
}
}




Remember in the Room-ID is not going this "[ ]" or the bot will not respond you.

Joined: Jun 2016
Posts: 8
O
OAM Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jun 2016
Posts: 8
I will test this one, Does this one work when people put a custom message or no? Because that was the only issue I had with the code I used

edit: it still doesnt work for me, not sure if I'm doing something wrong :^(

Last edited by OAM; 29/06/16 08:58 PM.
Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
The room-id is not necessary as twitch no longer sends re-sub messages to hosting channels. Also relying on $msgtags(display-name).key is not advised as display name is not ALWAYS set and may be empty resulting in a blank where the name should be. The new USERNOTICE tags also have a $msgtags(login) value that will always be set, so we can use an $iif to use display-name if it is set, and login if not. Replace #channelname in the code below with the #channel you wish this script to work in.

Code:
raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == resub) && ($1 == #channelname)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    if ($0 == 1) {
      describe $1 %nick has been subbed for $msgtags(msg-param-months).key months in a row!
    }
    else {
      describe $1 %nick has been subbed for $msgtags(msg-param-months).key months in a row with the message:  $qt($2-)
    }
  }
}

Last edited by paper0rplastic; 29/06/16 10:48 PM. Reason: Now uses display-name if set, login if not.
Joined: Jun 2016
Posts: 8
O
OAM Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jun 2016
Posts: 8
thanks @paper0rplastic , Hopefully this one will work, if not i'll just revert back to the old one that I used that only worked with resubs without custom messages

update: hasnt worked at all, not even for normal resubs. idk
¯\_(ツ)_/¯

Last edited by OAM; 30/06/16 02:26 AM.
Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
What exactly are you putting in for #channelname? If the twitch channel is twitch.tv/kappa for example, you need to replace #channelname with #kappa (including the #)

Joined: Jun 2016
Posts: 8
O
OAM Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jun 2016
Posts: 8
yeah thats what i'm doing, should I possibly put the channel name next to the USERNOTICE like

raw USERNOTICE:*#streamer:{

another note: i'm using this for multiple chats

@paper0rplastic

Last edited by OAM; 30/06/16 04:44 AM.
Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
If you are using this for more than one channel then you must remove the channel restriction.
Code:
raw USERNOTICE:*:{
  if ($msgtags(msg-id).key == resub) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    if ($0 == 1) {
      describe $1 %nick has been subbed for $msgtags(msg-param-months).key months in a row!
    }
    else {
      describe $1 %nick has been subbed for $msgtags(msg-param-months).key months in a row with the message: $qt($2-)
    }
  }
}

Joined: Jun 2016
Posts: 8
O
OAM Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jun 2016
Posts: 8
I'd need the channel restriction because it's a different message for each stream, the code still hasnt worked yet smirk

Joined: Jun 2016
Posts: 8
O
OAM Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jun 2016
Posts: 8
possible way to message you, like discord or? @paper0rplastic

Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
If you want it to say different things in different channels, you are going to have to make some If-then-else statements (/help if then else)
$1 is the channel name the resub happens in so you will need something like:
Code:
if ($1 == #channel1) {
say something
}
elseif ($1 == #channel2) {
say something else
}

Also you still need to be requesting the CAPabilities from "your" original code:
Code:
on *:LOGON:*:{
raw CAP REQ :twitch.tv/membership
raw CAP REQ :twitch.tv/tags
raw CAP REQ :twitch.tv/commands
/debug @raw
}

This should be enough to get you started on learning how to code the script the way you want it.


Link Copied to Clipboard