Dim AbuseArray, dbLoaded, AverageTotal Dim SpecialTags Set SpecialTags = CreateObject("Scripting.Dictionary") SpecialTags.CompareMode = VBTextCompare SpecialTags.Add "You", Empty SpecialTags.Add "RandNick", Empty SpecialTags.Add "Channel", Empty SpecialTags.Add "Target", Empty Sub ONNICK(NewNick,OldNick,ServerNumber) If GetIniFile("Reminders.ini","Main",NewNick,0) = 1 then SendCommand "/notice " & NewNick & " " & NewNick & " Oi! You've got a message pending! !gm in some chan where I am.",ServerNumber If GetIniFile("Reminders.ini","Main",NewNick,0) > 1 then SendCommand "/notice " & NewNick & " " & NewNick & " Oi! You've got " & GetIniFile("Reminders.ini","Main",NewNick,0) & " messages pending! !gm in some chan where I am.",ServerNumber End Sub Sub ONKICK(Nickname,Host,Channel,WhoKicked,Reason,ServerNumber) If Nickname = MyNickname(ServerNumber) then If GetIniFile("Misc.ini","Switches","RejoinSwitch",0) = 1 then Exit Sub If InStr(lcase(Channel),"idlerpg") then Exit Sub SendCommand "/join " & channel,ServerNumber SendCommand "/msg " & channel & " " & WhoKicked & ": " & RandomEntry("Misc", "KickMsgs", "LAME.", WhoKicked),ServerNumber SendCommand "/msg Kyte Ohay, I was kicked from " & channel & " by " & WhoKicked,ServerNumber End If End Sub Sub ONQUERY(Message,Nickname,Host,ServerNumber) If left(Message,1) = "#" then CmdTxt = Split(Message) Chan = CmdTxt(0) CmdTxt(0) = Empty Message = Trim(Join(CmdTxt)) else Chan = Nickname End If Call ONTEXT(Message,Chan,Nickname,Host,ServerNumber) End Sub Sub ONNOTICE(Message,Nickname,Host,ServerNumber) CALL ONQUERY(Message,Nickname,Host,ServerNumber) End Sub REM Chr(2,3,15,22,31) = Bold, Color, Normal, Reverse, Underline Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber) If InStr(lcase(Channel),"idlerpg") then Exit Sub Rem Trigger Control If InList(Nickname,"Banlist") OR InList(Host,"Banlist") then Exit Sub If (GetIniFile("Misc.ini","Switches","PowerSwitch",0) = 1 OR GetIniFile("Misc.ini","Switches","PowerSwitch" & Channel,0) = 1) AND NOT (InList(Nickname,"AdminList") AND InStr(lcase(Nickname), MyNickname(ServerNumber)) = 0) then Exit Sub Rem Trigger Control REM Special Replacers SpecialTags.Item("You") = Nickname SpecialTags.Item("RandNick") = RandomNick(Channel, ServerNumber) SpecialTags.Item("Channel") = Channel REM Special Replacers CmdTxt = Split(Message) Select Case lcase(cmdtxt(0)) case "!deop" CALL OnText("!unop",Channel,Nickname,Host,ServerNumber) case "!unop" If Not InList(Nickname,"OpUsers") then Exit Sub SendCommand "/mode " & channel & " -aoh " & CmdTxt(1) & " " & CmdTxt(1) & " " & CmdTxt(1), ServerNumber case "!ascii" SendCommand "/msg " & channel & " " & Asc(Left(CmdTxt(1),1)),ServerNumber case "!chr" SendCommand "/msg " & channel & " " & Chr(CmdTxt(1)),ServerNumber case "!timer" Countdown = CmdTxt(1) * 60 CmdTxt(0) = Empty CmdTxt(1) = Empty Message = Trim(Join(CmdTxt)) SendCommand TimerFormat(Join(Split(Date()),Empty) & Join(Split(Time()),Empty), 1, Countdown, "/msg " & channel & " " & Nickname & ": " & Message),ServerNumber SendCommand "/msg " & channel & " Timer set.",ServerNumber REM case "!remind" REM "!remind * in|at * of\: *" case "!lm" Message = Replace(Message,"!lm","!leavemessage") Call ONTEXT(Message,Channel,Nickname,Host,ServerNumber) case "!leavemessage" If InStr(Nicks(Channel,ServerNumber),"YocsBot") then Exit Sub If UBound(CmdTxt) < 2 then SendCommand "/msg " & channel & " The syntax is " & Chr(34) & "!leavemessage [reciever] [message]" & Chr(34),ServerNumber Exit Sub End If Reciever = CmdTxt(1) CmdTxt(0) = Empty CmdTxt(1) = Empty NoMessage = GetIniFile("Reminders.ini","Main",Reciever,0) + 1 Message = Trim(Join(CmdTxt)) & " (Sent by " & Nickname & ")" WriteIniFile "Reminders.ini","Main",Reciever,NoMessage WriteIniFile "Reminders.ini",Reciever,NoMessage,Message WriteIniFile "Reminders.ini",Reciever,"DateTime" & NoMessage, Now() SendCommand "/msg " & Channel & " Message left.",ServerNumber case "!getmessages" If (InList(nickname,"AdminList") AND UBound(CmdTxt) > 0) then Nickname = CmdTxt(1) CmdTxt(1) = Empty CmdTxt = Split(Trim(Join(CmdTxt))) End If LastMessage = GetIniFile("Reminders.ini","Main",Nickname,0) If LastMessage = 0 then If InStr(lcase(Nicks(Channel,ServerNumber)),"yocsbot") = 0 then SendCommand "/msg " & channel & " You have no messages.",ServerNumber Exit Sub End If For a = 1 to LastMessage Message = GetIniFile("Reminders.ini",Nickname,a,"Error in storage. Nothing here. (" & Nickname & ": " & a & ")") DateTimeM = GetIniFile("Reminders.ini",Nickname,"DateTime" & a, 0) SendCommand "/msg " & Nickname & " Message " & a & ": " & Message,ServerNumber WriteIniFile "Misc.ini", "General", "Now", Now() SendCommand "/msg " & Nickname & " Sent " & GetDuration(DateDiff("s", DateTimeM, GetIniFile("Misc.ini", "General", "Now", Now()))) & " ago. (" & DateTimeM & ")", ServerNumber WriteIniFile "Reminders.ini",Nickname,a,Empty WriteIniFile "Reminders.ini",Nickname,"DateTime" & a,Empty Next WriteIniFile "Reminders.ini","Main",Nickname,0 case "!gm" Message = Replace(Message,"!gm","!getmessages") Call ONTEXT(Message,Channel,Nickname,Host,ServerNumber) case "!voice" Call ONTEXT("!globalmode +v",Channel,Nickname,Host,ServerNumber) case "!alert" Call ONTEXT("!localalert",Channel,Nickname,Host,ServerNumber) case "!ping" Call ONTEXT("!localalert",Channel,Nickname,Host,ServerNumber) case "!raid" Call ONTEXT("!localalert",Channel,Nickname,Host,ServerNumber) case "!localalert" If (GetIniFile("Misc.ini","Switches","PingSwitch",0) = 1 OR GetIniFile("Misc.ini","Switches","PingSwitch" & Channel,0) = 1) AND NOT InList(Nickname,"AdminList") AND Nickname <> MyNickname(ServerNumber) then Exit Sub SendCommand "/msg " & Channel & " " & Nicks(Channel,ServerNumber),ServerNumber case "!globalmode" If InList(Nickname,"OpUsers") = 0 then Exit Sub Trigger = left(cmdtxt(1),1) Mode = right(cmdtxt(1),1) If ubound(cmdtxt) > 1 then special = cmdtxt(2) Nicklist = Split(Nicks(Channel,ServerNumber)) do modelist = empty nicknames = empty for a = 0 to UBound(Nicklist) if a MOD 10 = 0 AND a > 0 then exit for If nicklist(a) <> getidentifier("$me",servernumber) Then modelist = modelist & mode nicknames = nicknames & " " & special & nicklist(a) End If nicklist(a) = Empty next SendCommand "/mode " & channel & " " & trigger & modelist & " " & nicknames,ServerNumber Nicklist = Split(Trim(Join(Nicklist))) loop while ubound(nicklist) > 0 case "!resetrng" Randomize Timer SendCommand "/msg " & channel & " New Seed Loaded",ServerNumber case "!togglebot" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) > 0 Then PowerSwitch = GetIniFile("Misc.ini","Switches","PowerSwitch" & CmdTxt(1),0) If PowerSwitch = 1 then PowerSwitch = 0 Else PowerSwitch = 1 End If WriteIniFile "Misc.ini","Switches","PowerSwitch" & CmdTxt(1),PowerSwitch SendCommand "/msg " & channel & " Bot Disabled in " & Channel & "? " & PowerSwitch,ServerNumber Else PowerSwitch = GetIniFile("Misc.ini","Switches","PowerSwitch",0) If PowerSwitch = 1 then PowerSwitch = 0 Else PowerSwitch = 1 End If WriteIniFile "Misc.ini","Switches","PowerSwitch",PowerSwitch SendCommand "/msg " & channel & " Bot Disabled? " & PowerSwitch,ServerNumber End If case "!toggleaction" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) > 0 Then ActionSwitch = GetIniFile("Misc.ini","Switches","ActionSwitch" & CmdTxt(1),0) If ActionSwitch = 1 then ActionSwitch = 0 Else ActionSwitch = 1 End If WriteIniFile "Misc.ini","Switches","ActionSwitch" & CmdTxt(1),ActionSwitch SendCommand "/msg " & channel & " Bot Actions Disabled in " & Channel & "? " & ActionSwitch,ServerNumber Else ActionSwitch = GetIniFile("Misc.ini","Switches","ActionSwitch",0) If ActionSwitch = 1 then ActionSwitch = 0 else ActionSwitch = 1 end if WriteIniFile "Misc.ini","Switches","ActionSwitch",ActionSwitch SendCommand "/msg " & channel & " Bot Actions Disabled? " & ActionSwitch,ServerNumber End If case "!toggleping" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) > 0 Then PingSwitch = GetIniFile("Misc.ini","Switches","PingSwitch" & CmdTxt(1),0) If PingSwitch = 1 then PingSwitch = 0 Else PingSwitch = 1 End If WriteIniFile "Misc.ini","Switches","PingSwitch" & CmdTxt(1),PingSwitch SendCommand "/msg " & channel & " Pings Disabled in " & Channel & "? " & PingSwitch,ServerNumber Else PingSwitch = GetIniFile("Misc.ini","Switches","PingSwitch",0) If PingSwitch = 1 then PingSwitch = 0 else PingSwitch = 1 end if WriteIniFile "Misc.ini","Switches","PingSwitch",PingSwitch SendCommand "/msg " & channel & " Pings Disabled? " & PingSwitch,ServerNumber End If case "!togglerejoin" If NOT InList(Nickname,"AdminList") then Exit Sub RejoinSwitch = GetIniFile("Misc.ini","Switches","RejoinSwitch",0) If RejoinSwitch = 1 then RejoinSwitch = 0 else RejoinSwitch = 1 end if WriteIniFile "Misc.ini","Switches","RejoinSwitch",RejoinSwitch SendCommand "/msg " & channel & " Bot Rejoin Disabled? " & RejoinSwitch,ServerNumber case "!do" If NOT InList(Nickname,"AdminList") AND Nickname <> MyNickname(ServerNumber) then Exit Sub CmdTxt(0) = Empty SendCommand Trim(Join(CmdTxt)), ServerNumber case "!hi" if ubound(cmdtxt) > 0 then CmdTxt(0) = Empty TextString = Join(CmdTxt) else TextString = Nickname end if SendCommand "/msg " & channel & " Hello " & TextString & "!",ServerNumber case "!coin" Coin = Split("Heads Tails") Flip = Int(Rnd * 2) SendCommand "/msg " & channel & " You flipped a coin! It fell on... " & Chr(2) & " " & Coin(Flip) & Chr(2) & "!",ServerNumber case "!flip" Call ONTEXT("!coin",Channel,Nickname,Host,ServerNumber) case "!roll" If InStr(lcase(Message),"/h") OR InStr(lcase(Message),"/?") then CALL ErrorOut(CmdTxt(0), "Syntax", Channel, ServerNumber) Exit Sub End If Params = 0 if ubound(cmdtxt) = 0 then Scrap = Dice(Channel,"1d20", ServerNumber, Empty, 0) Exit Sub End If If lcase(Left(CmdTxt(1),1) = "d") then CmdTxt(1) = "1" & CmdTxt(1) If InStr(CmdTxt(1),"d") = 0 then If UBound(Cmdtxt) > 1 then If IsNumeric(left(CmdTxt(2),1)) AND lcase(CmdTxt(UBound(CmdTxt))) <> "times" then CmdTxt(1) = CmdTxt(1) & "d" & CmdTxt(2) For a = 2 to (UBound(CmdTxt) - 1) CmdTxt(a) = CmdTxt(a + 1) Next CmdTxt(UBound(CmdTxt)) = Empty CmdTxt = Split(Trim(Join(CmdTxt))) End If Else CmdTxt(1) = "1d" & CmdTxt(1) End If End If Params = 1 Scrap = Split(CmdTxt(1),"d") If UBound(Scrap) = 1 then If NOT IsNumeric(Scrap(0)) AND NOT IsNumeric(Scrap(1)) then CALL ErrorOut(CmdTxt(0), "Syntax", Channel, ServerNumber) Exit Sub End If Else CALL ErrorOut(CmdTxt(0), "Syntax", Channel, ServerNumber) Exit Sub End If If (lcase(CmdTxt(UBound(CmdTxt))) = "times" AND Asc(Right(CmdTxt(UBound(CmdTxt) - 1),1)) > 47 AND Asc(Right(CmdTxt(UBound(CmdTxt) - 1),1)) < 58) Then Repeats = CmdTxt(UBound(CmdTxt)-1) CmdTxt(UBound(CmdTxt)-1) = Empty CmdTxt(UBound(CmdTxt)) = Empty Command = Trim(Join(CmdTxt)) AverageTotal = 0 If Repeats > 1 AND Repeats < 21 then For a = 1 to Repeats CALL ONTEXT(Command,Channel,Nickname,Host,ServerNumber) Next If InStr(lcase(Message),"/a") then AverageTotal = AverageTotal / Repeats SendCommand "/msg " & channel & " Average for " & Repeats & " rolls: " & AverageTotal,ServerNumber End If Exit Sub End If End If Flags = Empty If InStr(lcase(Message),"/d") then Flags = Flags & "d" Params = Params + 1 End If If InStr(lcase(Message),"/a") then Flags = Flags & "a" Params = Params + 1 End If If InStr(lcase(Message),"+") OR InStr(lcase(Message),"+") then Params = Params + 1 If Params < UBound(CmdTxt) then CALL ErrorOut(CmdTxt(0), "Syntax", Channel, ServerNumber) Exit Sub End If if lcase(CmdTxt(1)) = "percent" then Ten = Dice(Channel, "1d10", ServerNumber, Empty, 0) One = Dice(Channel, "1d10", ServerNumber, Empty, 0) If Ten = 10 then Ten = 0 If One = 10 then One = 0 Total = Ten * 10 + One If Ten = 0 AND One = 0 then Total = 100 SendCommand "/msg " & channel & " Resulting Percentage: " & Total & "%",ServerNumber end if If InStr(lcase(Message),"+") OR InStr(lcase(Message),"+") then CALL Dice(Channel, CmdTxt(1), ServerNumber, Flags & "m", CmdTxt(2)) Else CALL Dice(Channel, CmdTxt(1), ServerNumber, Flags, Empty) End If case "!writedocs" If UBound(CmdTxt) < 3 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If For Count = 3 to ubound(cmdtxt) TextString = TextString & " " & cmdtxt(count) next TextArray = Split(TextString,"
") WriteIniFile "HelpDocs.ini",lcase(cmdtxt(1)),lcase(cmdtxt(2)),UBound(TextArray) + 1 For a = 0 to UBound(TextArray) WriteIniFile "HelpDocs.ini",lcase(cmdtxt(1)),lcase(cmdtxt(2)) & (a+1),TextArray(a) Next Case "!abuse" If Not UBound(CmdTxt) = 0 Then If (lcase(CmdTxt(UBound(CmdTxt))) = "times" AND Asc(Right(CmdTxt(UBound(CmdTxt) - 1),1)) > 47 AND Asc(Right(CmdTxt(UBound(CmdTxt) - 1),1)) < 58) Then Repeats = CmdTxt(UBound(CmdTxt)-1) CmdTxt(UBound(CmdTxt)-1) = Empty CmdTxt(UBound(CmdTxt)) = Empty Command = Trim(Join(CmdTxt)) If Repeats > 5 AND NOT InList(Nickname,"AdminList") then Repeats = 5 If Repeats > 1 AND Repeats < 21 then For a = 1 to Repeats CALL ONTEXT(Command,Channel,Nickname,Host,ServerNumber) Next Exit Sub End If End If End If If UBound(CmdTxt) = 0 Then SendCommand Retaliation(Nickname,Channel),ServerNumber elseif NOT InList(Nickname,"AdminList") AND (InList(Message,"ProtectList") OR InStr(lcase(Message),"self") OR lcase(CmdTxt(1)) = "me" OR InList(Nickname,"Hatelist") OR Int(Rnd * 100) < 2) then SendCommand Retaliation(Nickname,Channel),ServerNumber else CmdTxt(0) = Empty SendCommand Retaliation(Trim(Join(CmdTxt)),Channel),ServerNumber end if If NOT (InList(Nickname,"AdminList") OR InList(Nickname,"FloodProtect")) THEN CALL FloodControl(Channel,Host,ServerNumber) case "!dumpabuses" If NOT InList(Nickname,"AdminList") then Exit Sub PrevPending = GetIniFile("AbuseMsgs.ini","General","PrevPending",0) If PrevPending = 0 then SendCommand "/msg " & channel & " Nothing here.",ServerNumber Exit Sub End If For a = 1 to PrevPending SendCommand "/msg " & channel & " " & GetIniFile("AbuseMsgs.ini","Pending",a,"Nothing here"),ServerNumber WriteIniFile "AbuseMsgs.ini","General","PrevPending",0 Next case "!addabuse" CmdTxt(0) = Empty If InList(Nickname,"AdminList") then Call AddTo("AbuseMsgs","Abuse",Join(CmdTxt)) SendCommand "/msg " & channel & " Abuse added! [" & GetIniFile("AbuseMsgs.ini","General","PrevAbuse",0) & "]",ServerNumber else Call AddTo("AbuseMsgs","Pending",Join(CmdTxt)) SendCommand "/msg " & channel & " Abuse added to waitlist. [" & GetIniFile("AbuseMsgs.ini","General","PrevPending",0) & "]",ServerNumber end if case "!addtolist" If NOT InList(Nickname,"AdminList") then Exit Sub Section = CmdTxt(1) NoMessage = GetIniFile("Lists.ini","Main",Section,0) + 1 CmdTxt(0) = Empty CmdTxt(1) = Empty Message = Trim(Join(CmdTxt)) WriteIniFile "Lists.ini","Main",Section,NoMessage WriteIniFile "Lists.ini",Section,NoMessage,Message SendCommand "/msg " & channel & " Added " & Message & " to " & Section,ServerNumber case "!showlist" If UBound(CmdTxt) < 2 Then SendCommand "/msg " & Channel & " == " & Chr(2) & CmdTxt(1) & Chr(15) & " ==",ServerNumber LastItem = GetIniFile("Lists.ini","Main", CmdTxt(1),0) If LastItem = 0 then SendCommand "/msg " & Channel & " Nothing in this list.",ServerNumber For a = 1 to LastItem SendCommand "/msg " & Channel & " " & a & "=" & GetIniFile("Lists.ini",CmdTxt(1),a,"Nothing (" & CmdTxt(1) & ": " & a & ")"),ServerNumber Next Else SendCommand "/msg " & Channel & " Item " & CmdTxt(2) & " of " & CmdTxt(1) & ": " & Chr(34) & GetIniFile("Lists.ini",CmdTxt(1),CmdTxt(2),"Nothing (" & CmdTxt(1) & ": " & CmdTxt(2) & ")") & Chr(34),ServerNumber End If case "!countlist" SendCommand "/msg " & Channel & " List " & Chr(34) & CmdTxt(1) & Chr(34) & " has " & GetIniFile("Lists.ini","Main", CmdTxt(1),0) & " items.", ServerNumber case "!deletefromlist" If NOT InList(Nickname,"AdminList") then Exit Sub LastItem = GetIniFile("Lists.ini","Main", CmdTxt(1),0) ToReplaceWith = GetIniFile("Lists.ini",CmdTxt(1),LastItem,"Nothing") Replacee = GetIniFile("Lists.ini",CmdTxt(1),CmdTxt(2),"Nothing") WriteIniFile "Lists.ini",CmdTxt(1),CmdTxt(2),ToReplaceWith WriteIniFile "Lists.ini",CmdTxt(1),LastItem,Empty WriteIniFile "Lists.ini","Main",CmdTxt(1),(LastItem - 1) SendCommand "/msg " & Channel & " Deleted item " & CmdTxt(2) & " (" & Chr(34) & Replacee & Chr(34) & ") and replaced it with last item in list (" & Chr(34) & ToReplaceWith & Chr(34) & "). List length: " & (LastItem - 1),ServerNumber case "!replaceinlist" If NOT InList(Nickname,"AdminList") then Exit Sub List = CmdTxt(1) ItemNumber = CmdTxt(2) LastItem = GetIniFile("Lists.ini","Main", List,0) If ItemNumber > LastItem then SendCommand "/msg " & Channel & " Sorry, there's no item with that number. There are " & LastItem & " items in this list.",ServerNumber Exit Sub End If For a = 0 to 2 CmdTxt(a) = Empty Next ToReplaceWith = Trim(Join(CmdTxt)) Replacee = GetIniFile("Lists.ini",List,ItemNumber,"Nothing") WriteIniFile "Lists.ini",List,ItemNumber,ToReplaceWith SendCommand "/msg " & Channel & " Replaced item " & ItemNumber & " (" & Chr(34) & Replacee & Chr(34) & ") with " & Chr(34) & ToReplaceWith & Chr(34),ServerNumber case "!addto" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) < 3 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If Filename = CmdTxt(1) Section = CmdTxt(2) For a = 0 to 2 CmdTxt(a) = Empty Next CALL AddTo(Filename, Section, Join(CmdTxt)) SendCommand "/msg " & Channel & " Data Added to " & Section & " in " & Filename,ServerNumber case "!deletefrom" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) <> 3 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If Deleted = GetIniFile((CmdTxt(1) & ".ini"), CmdTxt(2), CmdTxt(3), "Nothing here, for some reason.") CALL DeleteFrom(CmdTxt(1), CmdTxt(2), CmdTxt(3)) SendCommand "/msg " & channel & " Deleted item " & CmdTxt(3) & " in " & CmdTxt(2) & " in " & CmdTxt(1) & " (" & Chr(34) & Deleted & Chr(34) & ") and replaced it with last item.",ServerNumber case "!replacein" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) < 4 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If Filename = CmdTxt(1) Section = CmdTxt(2) Number = CmdTxt(3) For a = 0 to 3 CmdTxt(a) = Empty Next Replaced = GetIniFile((Filename & ".ini"), Section, Number, "Nothing here, for some reason.") CALL ReplaceIn(Filename, Section, Number, Join(CmdTxt)) SendCommand "/msg " & channel & " Replaced item " & Number & " in " & Section & " in " & Filename & " (" & Chr(34) & Replaced & Chr(34) & ").",ServerNumber case "!countin" If UBound(CmdTxt) < 2 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If SendCommand "/msg " & Channel & " Number of items in " & CmdTxt(2) & " (" & CmdTxt(1) & ".ini): " & GetIniFile((CmdTxt(1) & ".ini"),"General","Prev" & CmdTxt(2),0),ServerNumber case "!showall" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) <> 2 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If ItemCount = GetIniFile((CmdTxt(1) & ".ini"), "General", ("Prev" & CmdTxt(2)), 0) SendCommand "/msg " & channel & " " & Chr(2) & "== " & CmdTxt(1) & ".ini" & " ==", ServerNumber If ItemCount > 29 then SendCommand "/msg " & channel & " Dude, no. That one's got " & ItemCount & " freaking elements. I don't wanna get disconnected for flooding.", ServerNumber Exit Sub End If For a = 1 to ItemCount SendCommand "/msg " & channel & " " & a & "=" & GetIniFile((CmdTxt(1) & ".ini"), CmdTxt(2), a, "Nothing here, for some reason."), ServerNumber Next case "!showrandom" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) <> 2 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If SendCommand "/msg " & channel & " Random item from " & CmdTxt(2) & " in " & CmdTxt(1) & ".ini", ServerNumber ItemCount = GetIniFile((CmdTxt(1) & ".ini"), "General", ("Prev" & CmdTxt(2)), 0) Pick = Int(Rnd * ItemCount + 1) SendCommand "/msg " & channel & " " & Pick & "=" & GetIniFile((CmdTxt(1) & ".ini"), CmdTxt(2), Pick, "Nothing here, for some reason."), ServerNumber case "!showfrom" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) <> 3 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If SendCommand "/msg " & channel & " Item number " & CmdTxt(3) & " from " & CmdTxt(2) & " in " & CmdTxt(1) & ".ini", ServerNumber Pick = CmdTxt(3) SendCommand "/msg " & channel & " " & Pick & "=" & GetIniFile((CmdTxt(1) & ".ini"), CmdTxt(2), Pick, "Nothing here, for some reason."), ServerNumber case "!showparsed" If NOT InList(Nickname,"AdminList") then Exit Sub If UBound(CmdTxt) <> 3 then CALL ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber) Exit Sub End If SendCommand "/msg " & channel & " Item number " & CmdTxt(3) & " from " & CmdTxt(2) & " in " & CmdTxt(1) & ".ini", ServerNumber Pick = CmdTxt(3) SendCommand "/msg " & channel & " " & Pick & "=" & ReplaceTags(GetIniFile((CmdTxt(1) & ".ini"), CmdTxt(2), Pick, "Nothing here, for some reason.")), ServerNumber case "!dumpcommands" If NOT InList(Nickname,"AdminList") then Exit Sub PrevPendingC = GetIniFile("Commands.ini","General","PrevPendingCommands",0) If PrevPendingC = 0 then SendCommand "/msg " & channel & " No commands here.",ServerNumber Else For a = 1 to PrevPendingC SendCommand "/msg " & channel & " " & GetIniFile("Commands.ini","PendingCommands",a,"No commands here."),ServerNumber WriteIniFile "Commands.ini","General","PrevPendingCommands",0 Next End If PrevPendingM = GetIniFile("Commands.ini","General","PrevPendingMessages",0) If PrevPendingM = 0 then SendCommand "/msg " & channel & " No messages here.",ServerNumber Else For a = 1 to PrevPendingM SendCommand "/msg " & channel & " " & GetIniFile("Commands.ini","PendingMessages",a,"No messages here."),ServerNumber WriteIniFile "Commands.ini","General","PrevPendingMessages",0 Next End If Case "!addcommand" If InList(Nickname,"AdminList") then CmdTxt(0) = Empty Message = Trim(Join(CmdTxt)) Message = "!addtolist commands " & Message CALL ONTEXT(Message,Channel,Nickname,Host,ServerNumber) Exit Sub End If If UBound(CmdTxt) < 1 then SendCommand "/msg " & channel & " It's !addcommand [commandname]. Once you do that, remember to use !addmessage [commandname] [message].",ServerNumber Exit Sub End If Call AddTo("Commands","PendingCommands",Join(CmdTxt)) SendCommand "/msg " & channel & " Command added to waitlist. [" & GetIniFile("Commands.ini","General","PrevPendingCommands",0) & "]",ServerNumber Case "!addmessage" If InList(Nickname,"AdminList") then CmdTxt(0) = Empty Message = Trim(Join(CmdTxt)) Message = "!addto commands " & Message CALL ONTEXT(Message,Channel,Nickname,Host,ServerNumber) Exit Sub End If If UBound(CmdTxt) < 2 then SendCommand "/msg " & channel & " It's !addmessage [commandname] [message]. Be sure to have submitted the command with !addcommand [commandname].",ServerNumber Exit Sub End If Call AddTo("Commands","PendingMessages",Join(CmdTxt)) SendCommand "/msg " & channel & " Command message added to waitlist. [" & GetIniFile("Commands.ini","General","PrevPendingMessages",0) & "]",ServerNumber Case Else If Left(Message,1) = "!" AND InList(CmdTxt(0),"Commands") AND Len(CmdTxt(0)) = (Len(LastResultStr("Commands")) + 1) Then If UBound(CmdTxt) = 0 THEN SpecialTags.Item("Target") = RandomNick(Channel, ServerNumber) Elseif InStr(lcase(Message),"self") OR lcase(CmdTxt(1)) = "me" Then SpecialTags.Item("Target") = Nickname Else CmdTxt(0) = Empty SpecialTags.Item("Target") = Join(CmdTxt) End If Answer = RandomEntry("Commands", LastResultStr("Commands"), "/say No responses for this command. Yet.") AnswerBits = Split(Trim(Answer)) If AnswerBits(0) = "/me" OR AnswerBits(0) = "/describe" then AnswerBits(0) = Empty SendCommand "/describe " & Channel & " " & Trim(Join(AnswerBits)),ServerNumber Elseif AnswerBits(0) = "/say" OR AnswerBits(0) = "/msg" then AnswerBits(0) = Empty SendCommand "/msg " & Channel & " " & Trim(Join(AnswerBits)),ServerNumber Elseif AnswerBits(0) = "/notice" then AnswerBits(0) = Empty SendCommand "/notice " & Nickname & " " & Trim(Join(AnswerBits)),ServerNumber Else SendCommand "/msg " & Channel & " " & Answer,ServerNumber End If End If End Select If InList(Nickname,"Hatelist") AND Int(Rnd*200) < 2 then SendCommand Retaliation(Nickname,Channel),ServerNumber End Sub Sub ONJOIN(Nickname,Host,Channel,ServerNumber) If InStr(lcase(Channel),"idlerpg") then If Nickname = MyNickname(ServerNumber) then SendCommand "/msg idlebot LOGIN ChileanBot asdf",ServerNumber Exit Sub End If If GetIniFile("Reminders.ini","Main",Nickname,0) = 1 then SendCommand "/msg " & Channel & " " & Nickname & "! You've got a message pending!",ServerNumber If GetIniFile("Reminders.ini","Main",Nickname,0) > 1 then SendCommand "/msg " & Channel & " " & Nickname & "! You've got " & GetIniFile("Reminders.ini","Main",Nickname,0) & " messages pending!",ServerNumber If instr(lcase(Nickname),"graystash") AND Int(Rnd * 100) < 51 then SendCommand "/describe " & Channel & " hides from the bot molester!",ServerNumber If instr(lcase(Nickname),"ryn") then SendCommand "/describe " & channel & " pokes Kyte. " & Chr(34) & "Hay look. Ryn's here!" & Chr(34),ServerNumber SendCommand "/describe " & channel & " huggles Ryn.",ServerNumber End If If instr(lcase(Nickname),"pyrobot") then SendCommand "/msg " & channel & " Hai Pyro!",ServerNumber SendCommand "/describe " & channel & " snuggles muchly.",ServerNumber End if If Nickname = MyNickname(ServerNumber) then SendCommand TimerFormat("RynCheck", 1, 2, "/! CheckRyn " & Channel & " | " & ServerNumber),ServerNumber SendCommand TimerFormat("PyroCheck", 1, 2, "/! CheckPyro " & Channel & " | " & ServerNumber),ServerNumber SendCommand TimerFormat("Nicklist", 1, 2, "/! CheckReminders " & Channel & " | " & ServerNumber),ServerNumber End If End Sub Sub ONACTION(Message,Channel,Nickname,Host,ServerNumber) If InStr(lcase(Channel),"idlerpg") then Exit Sub If GetIniFile("Misc.ini","Switches","ActionSwitch",0) = 1 OR GetIniFile("Misc.ini","Switches","ActionSwitch" & Channel,0) = 1 OR InList(Message,"BanList") then Exit Sub If InList(Nickname,"Hatelist") AND (Rnd * 100) < 21 then SendCommand Retaliation(Nickname,Channel),ServerNumber If InList(Message,"ProtectList") AND InList(Message,"Attacks") then If Not InList(Nickname,"FloodProtect") THEN Call FloodControl(Channel,Host,ServerNumber) SendCommand Retaliation(Nickname,Channel),ServerNumber End If End Sub Function RandomEntry(Filename, Section, Default) Filename = Filename & ".ini" ItemCount = GetIniFile(Filename, "General", ("Prev" & Section), 0) ItemPick = Int(Rnd * ItemCount) + 1 Pull = GetIniFile(Filename, Section, ItemPick, Default) Pull = ReplaceTags(Pull) RandomEntry = " " & Pull End Function Function ReplaceTags(Pull) Do While InStr(Pull,"<") StartTagPos = InStr(Pull,"<") + 1 EndTagPos = InStr(Pull,">") Tag = Mid(Pull,StartTagPos,EndTagPos - StartTagPos) If SpecialTags.Exists(Tag) Then Replacer = SpecialTags.Item(Tag) Else ReplaceCount = GetIniFile("Replacers.ini", "General", "Prev" & Tag, 0) ReplacePick = Int(Rnd * ReplaceCount + 1) Replacer = GetIniFile("Replacers.ini", Tag, ReplacePick, "[no_" & Tag & "]") End If Pull = Replace(Pull, "<" & Tag & ">", Replacer) Loop ReplaceTags = Pull End Function Sub AddTo(Filename, Section, Data) Filename = Filename & ".ini" ItemCount = GetIniFile(Filename, "General", ("Prev" & Section), 0) ItemCount = ItemCount + 1 WriteIniFile FileName, Section, ItemCount, Trim(Data) WriteIniFile Filename, "General", ("Prev" & Section), ItemCount End Sub Sub DeleteFrom(Filename, Section, Number) Filename = Filename & ".ini" LastItem = GetIniFile(Filename, "General", ("Prev" & Section), 0) Replacee = GetIniFile(Filename, Section, LastItem, "Nothing here, for some reason.") WriteIniFile Filename, Section, Number, Replacee WriteIniFile Filename, Section, LastItem, Empty WriteIniFile Filename, "General", ("Prev" & Section), LastItem - 1 End Sub Sub ReplaceIn(Filename, Section, Number, Data) Filename = Filename & ".ini" WriteIniFile Filename, Section, Number, Trim(Data) End Sub Function Retaliation(Target, Channel) If InList(Target,"DNAlist") then Retaliation = Empty Else If dbLoaded = 0 then CALL LoadAbuses() ItemPick = Int(Rnd * UBound(AbuseArray) + 1) Pull = AbuseArray(ItemPick) SpecialTags.Item("Target") = Target Pull = ReplaceTags(Pull) Retaliation = "/describe " & Channel & " " & Pull End If End Function Sub LoadAbuses() ItemCount = GetIniFile("AbuseMsgs.ini", "General", "PrevAbuse", 0) ReDim AbuseArray(ItemCount) For a = 0 to ItemCount AbuseArray(a) = GetIniFile("AbuseMsgs.ini","Abuse", a, "attacks in the !") Next dbLoaded = 1 End Sub Sub ONCONNECT(ServerNumber) CALL LoadAbuses() End Sub Function Dice(Channel, DieParam, ServerNumber, Flags, Modifier) REM Flags -> "m"=Modifier, "d"=Drop lowest, "a"= Show average If InStr(Flags, "d") then Lowest = 100 DieStats = split(DieParam,"d") If DieStats(0) = Empty then DieStats(0) = 1 ReDim DieValue(DieStats(0) - 1) For DieNum = 0 to (DieStats(0) - 1) DieValue(DieNum) = Int((Rnd * DieStats(1)) + 1) If InStr(Flags, "d") AND DieValue(DieNum) < Lowest Then Lowest = DieValue(DieNum) End If Next If InStr(Flags,"d") then For DieNum = 0 to (DieStats(0) - 1) If DieValue(DieNum) = Lowest then DieValue(DieNum) = DieValue(DieStats(0) - 1) DieStats(0) = DieStats(0) - 1 Lowest = Lowest + 1 End If Next End If For DieNum = 0 to (DieStats(0) - 1) Total = Total + DieValue(DieNum) If UBound(DieValue) < 10 Then If DieNum = 0 then NumberString = NumberString & DieValue(DieNum) Else NumberString = NumberString & ", " & DieValue(DieNum) End If End If Next If InStr(Flags,"m") then DieParam = DieParam & Modifier Total = Total + Int(Modifier) End If If UBound(DieValue) < 10 AND (UBound(DieValue) > 0 OR InStr(Flags,"m")) Then SendCommand "/msg " & channel & " " & DieParam & " = " & Total & " (" & NumberString & ")",ServerNumber Else SendCommand "/msg " & channel & " " & DieParam & " = " & Total,ServerNumber End if If InStr(Flags, "a") then AverageTotal = AverageTotal + Total Dice = Total End Function Sub ErrorOut(Section,Key,Channel,ServerNumber) Key = lcase(Key) Section = lcase(Section) LineCount = GetIniFile("HelpDocs.ini",Section,Key,1) - 1 For a = 0 to LineCount SendCommand "/msg " & channel & " " & GetIniFile("HelpDocs.ini",Section,Key & (a+1),"Error found, no documentation for it. Sorry."),ServerNumber Next End Sub Sub FloodControl(Channel,Host,ServerNumber) FloodTimeout = 20 + (5 * Int(Rnd * 5)) FloodTimer = 5 + Int(Rnd * 4) FloodCount = GetIniFile("misc.ini","Main","FloodCount",0) Select Case FloodCount Case 0 WriteIniFile "Misc.ini","Main","FloodCount",1 SendCommand TimerFormat("Flood_timer", 1, FloodTimer, "/! WriteIniFile @Misc.ini@, @Main@, @FloodCount@, 0"),ServerNumber Case 4 WriteIniFile "misc.ini","Switches","PowerSwitch",1 WriteIniFile "misc.ini","Switches","ActionSwitch",1 SendCommand "/describe " & Channel & RandomEntry("AbuseMsgs","Defense"," hides!", Nickname) & " [Bot deactivated for " & FloodTimeout & " secs]",ServerNumber SendCommand TimerFormat("ReOpen_timer", 1, FloodTimeout, "/! ReOpenGates " & Channel & " | " & ServerNumber),ServerNumber WriteIniFile "misc.ini","Main","FloodCount",0 Case Else WriteIniFile "misc.ini","Main","FloodCount",(FloodCount+1) End Select End Sub Sub CheckReminders(Channel,ServerNumber) Nicknames = Split(Nicks(Channel,ServerNumber)) For each Nick in Nicknames If GetIniFile("Reminders.ini","Main",Nick,0) > 1 then SendCommand "/msg " & Channel & " " & Nicknames(a) & "! You've got " & GetIniFile("Reminders.ini","Main",Nicknames(a),0) & " messages pending!",ServerNumber If GetIniFile("Reminders.ini","Main",Nick,0) = 1 then SendCommand "/msg " & Channel & " " & Nicknames(a) & "! You've got a message pending!",ServerNumber Next End Sub Sub ReopenGates(Channel,ServerNumber) WriteIniFile "Misc.ini","Switches","PowerSwitch",0 WriteIniFile "Misc.ini","Switches","ActionSwitch",0 SendCommand "/msg " & Channel & " Bot reactivated.",ServerNumber End Sub Function TimerFormat(ID, Repeats, Timeout, Command) Command = Replace(Command,"@",Chr(34)) TimerFormat = "/timer " & ID & " " & Repeats & " " & Timeout & " " & Command End Function Function InList(CheckWord,Section) InList = False Key = 0 For Key = 1 to GetIniFile("Lists.ini","Main",Section,0) BanWord = GetIniFile("Lists.ini",Section,Key,"") If InStr(lcase(CheckWord),lcase(BanWord)) then InList = True WriteIniFile "Misc.ini","LastResults",Section,Key End If Next End Function Function LastResultInt(Section) LastResultInt = GetIniFile("Misc.ini","LastResults",Section,0) End Function Function LastResultStr(Section) LastResultStr = GetIniFile("Lists.ini", Section, LastResultInt(Section), "No last result.") End Function Function RandomNick(Channel,ServerNumber) NickList = Split(Nicks(Channel,ServerNumber)) RandomNick = NickList(Int(Rnd * UBound(Nicklist)) + 1) End Function Sub CheckRyn(Channel,ServerNumber) If InStr(lcase(Nicks(Channel,ServerNumber)),"ryn") Then SendCommand "/describe " & channel & " pokes Kyte. " & Chr(34) & "Hay look. Ryn's here!" & Chr(34),ServerNumber SendCommand "/describe " & channel & " huggles Ryn.",ServerNumber End If End Sub Sub CheckPyro(Channel, ServerNumber) If InStr(lcase(Nicks(Channel,ServerNumber)),"pyro") Then SendCommand "/msg " & channel & " Hai Pyro!",ServerNumber SendCommand "/describe " & channel & " snuggles muchly.",ServerNumber End If End Sub