mIRC Home    About    Download    Register    News    Help

Print Thread
Twitch Commands Help #264593
18/12/18 07:07 PM
18/12/18 07:07 PM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
TroyL  Offline OP
Babel fish
T

Joined: Dec 2018
Posts: 52
Hi! So when someone does !sub my bot gives them a link to sub but when someone does !sub @username or !sub (random text) it doesnt trigger the command. Can anyone help me on this?

Re: Twitch Commands Help [Re: TroyL] #264594
18/12/18 07:30 PM
18/12/18 07:30 PM
Joined: Jan 2004
Posts: 1,158
maroon Offline
Hoopy frood
maroon  Offline
Hoopy frood

Joined: Jan 2004
Posts: 1,158
If you want it to do 2 different things, depending if there's text after the keyword, you can either have 2 separate events where one uses matchtext :!sub: and the other uses :!sub *:

Or you can have the search match use a regular expression. This one triggers only if !sub is followed by a space or by end-of-line. So it won't trigger for !suburban

Code:
on $*:TEXT:/^!sub(\s|$)/iS:#:{
  echo -s This event triggered by $nick using $1-
}


in the /iS the 'i' makes it case-insensitive, so it would trigger for !SUB and !Sub. The capital S makes it ignore color codes in the match, but still leaves the control codes in there. So this would match where a color or bold/reverse/italic code was touching the !sub as long as there was a trailing space. In effect, it makes the match be against $strip($1-) without altering the content of $1-

In your event handler, $1 would be !sub and $2- would be everything following it. $0 is the total number of parameters, so if $0 is 1 you know that there's nothing following the !sub word.

Re: Twitch Commands Help [Re: maroon] #264596
19/12/18 04:31 AM
19/12/18 04:31 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
TroyL  Offline OP
Babel fish
T

Joined: Dec 2018
Posts: 52
thank you so much! This helped out and it worked. So I need one more thing, and that thing is how do i deal with someone repeating themselves and how i would code the bot to time them out after saying the same thing 3 times in a row?

Re: Twitch Commands Help [Re: maroon] #264597
19/12/18 04:49 AM
19/12/18 04:49 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
TroyL  Offline OP
Babel fish
T

Joined: Dec 2018
Posts: 52
Originally Posted By: maroon
If you want it to do 2 different things, depending if there's text after the keyword, you can either have 2 separate events where one uses matchtext :!sub: and the other uses :!sub *:

Or you can have the search match use a regular expression. This one triggers only if !sub is followed by a space or by end-of-line. So it won't trigger for !suburban

Code:
on $*:TEXT:/^!sub(\s|$)/iS:#:{
  echo -s This event triggered by $nick using $1-
}


in the /iS the 'i' makes it case-insensitive, so it would trigger for !SUB and !Sub. The capital S makes it ignore color codes in the match, but still leaves the control codes in there. So this would match where a color or bold/reverse/italic code was touching the !sub as long as there was a trailing space. In effect, it makes the match be against $strip($1-) without altering the content of $1-

In your event handler, $1 would be !sub and $2- would be everything following it. $0 is the total number of parameters, so if $0 is 1 you know that there's nothing following the !sub word.

Ok so say if i went like !sub @username how would i make my bot say @username here is the link to sub --> because i have $nick and that is for the person who used it

Re: Twitch Commands Help [Re: TroyL] #264598
19/12/18 05:31 AM
19/12/18 05:31 AM
Joined: Jan 2004
Posts: 1,158
maroon Offline
Hoopy frood
maroon  Offline
Hoopy frood

Joined: Jan 2004
Posts: 1,158
$1 is the first word of the line !sub
$2 is the 2nd word of the line, or is $null if there was none. So when they did "!sub foobar" then $2 is foobar. You probably want to do some error checking to make sure that foobar is a real username, and I'm not sure how to do that in twitch.

If $2 is @username and you need just username, you can take the string beginning at the 2nd character. $mid($2,2)

Question about your repeat blocking. Are you talking about repeating what they say to the bot, or any repeats of any kind? Is the repeat supposed to look only at the last 3 things they say, or does it need to check if the latest-msg, 5 messages ago, and 9 messages ago were the same? You'll need to decide what you want to flag and what you don't.

Re: Twitch Commands Help [Re: maroon] #264601
19/12/18 03:03 PM
19/12/18 03:03 PM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
TroyL  Offline OP
Babel fish
T

Joined: Dec 2018
Posts: 52
Well sometimes people just come into chat and keep repeating the same question so I was wondering how I can make my bot time them out after they repeat themselves after like 3 times

Re: Twitch Commands Help [Re: TroyL] #264602
19/12/18 04:20 PM
19/12/18 04:20 PM
Joined: Jan 2004
Posts: 1,158
maroon Offline
Hoopy frood
maroon  Offline
Hoopy frood

Joined: Jan 2004
Posts: 1,158
To be clear, you're talking about repeating themselves 3 times in a row within N seconds, and each time they say something different the counter gets reset to 1?

Re: Twitch Commands Help [Re: maroon] #264604
19/12/18 05:11 PM
19/12/18 05:11 PM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
TroyL  Offline OP
Babel fish
T

Joined: Dec 2018
Posts: 52
Yes

Re: Twitch Commands Help [Re: TroyL] #264607
20/12/18 05:21 AM
20/12/18 05:21 AM
Joined: Jan 2004
Posts: 1,158
maroon Offline
Hoopy frood
maroon  Offline
Hoopy frood

Joined: Jan 2004
Posts: 1,158
Answered to the repeating chatterbox issue in this thread: https://forums.mirc.com/ubbthreads.php/topics/264606/Re:_Simple_One_Man_Spam_Preven#Post264606

Re: Twitch Commands Help [Re: maroon] #264608
20/12/18 06:52 PM
20/12/18 06:52 PM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
TroyL  Offline OP
Babel fish
T

Joined: Dec 2018
Posts: 52
Thank you for the help! Ok so last night someone gifted 42 subs and my bot only picked up 23 of them and it went slow so how do i make my bot spam the message so it gets all of the gifted subs? I also have a spam command where i say like !tspam and it spams the persons twitter and it sends a message every .5 seconds instead of instantly.

Re: Twitch Commands Help [Re: TroyL] #264609
20/12/18 08:10 PM
20/12/18 08:10 PM
Joined: Jan 2004
Posts: 1,158
maroon Offline
Hoopy frood
maroon  Offline
Hoopy frood

Joined: Jan 2004
Posts: 1,158
I don't use twitch, so I'm not familiar with the IRC3 tags used to send the sub info. You should probably create a @SUB window where your alias echoes the string it sees before processing them, to see whether or not the incoming string was malformed or not. Or to see whether it's the first 23, the last 23, or 17 were either not formatted as expected, or split across multiple incoming messages.

The length should be less of an issue in 7.53 now that internal line lengths are longer. mIRC has options/irc/messages choice to split long messages into several messages to fit within the much shorter limit expected by the server - but you don't want these types of messages to be split however mirc decides to do it.

I always add a lot of debug messages while I make new aliases, and had to take a lot of them out before posting that code yesterday.

As for the !tspam, it's hard to tell why it's doing that without seeing the code. Repeats could be from a timer, or a socket command, or you have a que that's not deleting the instruction after it's been 'done'.