Why don't these two pieces of code work together? - 03/01/15 08:38 AM
Trying to make a Twitch bot (mainly for use in one channel) but these two sections of the script break each other. On their own, you can place them wherever and nothing will happen, everything will work fine. But if you place them together, only one of them will work. The one that's on top always works, but it breaks everything below it. For example, if one of them is at the very top and the other is at the very bottom, everything except the very top section will break. I'm not a coder by any means (I practically found all of this on the forums here or somewhere else) so if anyone could explain to me why this happens, that would be awesome.
Here are the two sections in question:
This one is supposed to time someone out for 10 seconds if they talk in caps, then time them out for 180 seconds if they do it again within 5 minutes.
And this one is the same thing, but with (Twitch) emote spamming. I didn't include the rest of the code because all of it is commands (e.g. the bot will say something if someone types "!command").
Here are the two sections in question:
Code:
on *:text:*:#:{ if ($nick isop #) { return } if ( $len($1-) >= 20 ) { if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 60 ) { ; check if user is not warned yet if !$istok(%caps.warned,$nick,32) { ; warning user msg $chan $nick $+ , use your indoor voice! [warning] msg $chan .timeout $nick 10 ; add user to %caps.warned, so we can check it later set -e %caps.warned $addtok(%caps.warned,$nick,32) ; set timer to remove user from %caps.warned after 300s .timer 1 300 remove.warned $nick } else { ; so user is already warned.. msg $chan .timeout $nick 180 msg $chan $nick $+ , silence! [timeout] } } } } alias -l remove.warned { set -e %caps.warned $remtok(%caps.warned,$1,1,32) }
This one is supposed to time someone out for 10 seconds if they talk in caps, then time them out for 180 seconds if they do it again within 5 minutes.
Code:
on *:text:*:#:{ if ($nick isop $chan) return var %e 4Head #/ :7 :( :) :/ :> :\ :D :o :P :p :s :z :| ;) ;P ;p <3 <] >( aneleanele ArsonNoSexy AsianGlow AtGL AtIvy AtWW B) BatChest BCWarrior BibleThump BigBrother BionicBunion BlargNaut BloodTrail BORT BrainSlug BrokeBack CougarHunt DAESuppy DansGame DatSheffy DBstyle DogFace EagleEye EleGiggle EvilFetus FailFish FPSMarksman FrankerZ FreakinStinkin FUNgineer FuzzyOtterOO GasJoker GingerPower GrammarKing HassanChop HotPokket ItsBoshyTime Jebaited JKanStyle JonCarnage KAPOW Kappa kappaHD Keepo KevinTurtle Kippa Kreygasm KZassault KZcover KZguerilla KZhelghast KZowl KZskull MechaSupes MiniK MrDestructoid MVGame NightBat NinjaTroll NoNoSpot noScope420 o_O OMGScoots OneHand OpieOP OptimizePrime PanicVis PazPazowitz PeoplesChamp PicoMause PipeHype PJHarley PJSalt PMSTwin PogChamp Poooound PunchTrees R) RalpherZ RedCoat ResidentSleeper RitzMitz RuleFive Shazam shazamicon ShazBotstix SMOrc SMSkull SoBayed SoonerLater SSSsss StoneLightning StrawBeary SuperVinlin SwiftRage TehFunrun TF2John TheRinger TheTarFu TheThing ThunBeast TinyFace TooSpicy TriHard UleetBackup UncleNox UnSane Volcania WholeWheat WinWaker WTRuck YouWHY var %re /( $+ $replacex(%e,$chr(32),|,/,\/,$chr(40),$+(\,$chr(40)),$chr(41),$+(\,$chr(41)),\,\\,|,\|,],\],[,\[) $+ )/Sig if ($regex($1-,%re) >= 5) { emotespam $chan $nick } } alias -l emotespam { var %chan = $$1 var %nick = $$2 if ($hget(emotespam,$nick)) { timeout %chan %nick 180 msg $chan $nick $+ , no emote spam [timeout] } else { timeout %chan %nick 10 msg $chan $nick $+ , no emote spam [warning] hadd -mu300 emotespam %nick 1 } } alias -l timeout { var %chan = $$1 var %nick = $$2 var %length = $$3 .timer 1 1 msg %chan .timeout %nick %length }
And this one is the same thing, but with (Twitch) emote spamming. I didn't include the rest of the code because all of it is commands (e.g. the bot will say something if someone types "!command").