Dim AbuseArray, dbLoaded
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)
If InStr(lcase(channel),"#aosg") AND InStr(lcase(mode),"+v") AND InStr(lcase(mode),"mcdrunk") Then SendCommand "/msg #aosg McDrunk has voice!",ServerNumber
If InStr(lcase(channel),"#aosg") AND InStr(lcase(mode),"-h") AND InStr(lcase(mode),"player_1") Then SendCommand "/mode #aosg +h Player_1",ServerNumber
End Sub
Sub ONKICK(Nickname,Host,Channel,WhoKicked,Reason,ServerNumber)
SendCommand "/join " & channel,ServerNumber
If Nickname = MyNickname(ServerNumber) then SendCommand "/msg " & channel & " " & WhoKicked & ": " & RandomEntry("Misc", "KickMsgs", "LAME.", WhoKicked),ServerNumber
End Sub
Sub ONQUERY(Message,Nickname,Host,ServerNumber)
CmdTxt = Split(Message)
Chan = CmdTxt(0)
CmdTxt(0) = Empty
RcvMessage = Trim(Join(CmdTxt))
Call ONTEXT(RcvMessage,Chan,Nickname,Host,ServerNumber)
End Sub
REM Chr(2,3,22,31) = Bold, Color, Reverse, Underline
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
Rem Trigger Control
If InList(Nickname,"Banlist") = True <> 0 OR InList(Host,"Banlist") = True <> 0 then exit sub
PowerSwitch = GetIniFile("Misc.ini","Main","PowerSwitch",0)
If PowerSwitch = 1 AND InStr(lcase(Nickname),"kyte") = 0 AND InStr(lcase(Nickname),"chileanbot") = 0 then Exit Sub
Rem Trigger Control
CmdTxt = Split(Message)
Select Case lcase(cmdtxt(0))
REM case "!remind"
REM "!remind * in|at * of\: *"
case "!voice"
Call ONTEXT("!globalmode +v",Channel,Nickname,Host,ServerNumber)
case "!alert"
SendCommand "/msg " & Channel & " " & Nicks(Channel,ServerNumber),ServerNumber
case "!localalert"
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 right(a,1) = "0" AND a > 0 then exit for
modelist = modelist & mode
nicknames = nicknames & " " & special & nicklist(a)
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 InStr(lcase(Nickname),"kyte") = 0 then Exit Sub
PowerSwitch = GetIniFile("Misc.ini","Main","PowerSwitch",0)
If PowerSwitch = 1 then
PowerSwitch = 0
Else
PowerSwitch = 1
End If
WriteIniFile "Misc.ini","Main","PowerSwitch",PowerSwitch
SendCommand "/msg " & channel & " Bot Disabled? " & PowerSwitch,ServerNumber
case "!toggleaction"
If InStr(lcase(Nickname),"kyte") = 0 then Exit Sub
ActionSwitch = GetIniFile("Misc.ini","Main","ActionSwitch",0)
If ActionSwitch = 1 then
ActionSwitch = 0
else
ActionSwitch = 1
end if
WriteIniFile "Misc.ini","Main","ActionSwitch",ActionSwitch
SendCommand "/msg " & channel & " Bot Actions Disabled? " & ActionSwitch,ServerNumber
case "!do"
If InStr(lcase(Nickname),"kyte") = 0 AND InStr(lcase(Nickname),"chileanbot") = 0 then Exit Sub
CmdTxt(0) = Empty
TextString = Trim(Join(CmdTxt))
SendCommand TextString, 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 "!roll"
if ubound(cmdtxt) > 2 then
Call ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber)
Exit Sub
elseif ubound(cmdtxt) < 1 then
Call Dice(Channel,"1d20", ServerNumber, False, 0)
elseif Left(CmdTxt(1),1) = "0" then
Call ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber)
Exit Sub
elseif ubound(cmdtxt) = 2 then
if left(cmdtxt(2),1) <> "+" AND left(cmdtxt(2),1) <> "-" then
Call ErrorOut(CmdTxt(0),"Syntax",Channel,ServerNumber)
Exit Sub
end if
Call Dice(Channel, CmdTxt(1), ServerNumber, True, CmdTxt(2))
else
Call Dice(Channel, CmdTxt(1), ServerNumber, False, 0)
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
WriteIniFile "HelpDocs.ini",lcase(cmdtxt(1)),lcase(cmdtxt(2)),TextString
Case "!abuse"
If UBound(CmdTxt) = 0 Then
SendCommand Retaliation(Nickname,Channel),ServerNumber
Exit Sub
End If
If InStr(lcase(Nickname),"kyte") = 0 AND (InList(Message,"ProtectList") = True OR InStr(lcase(Message),"self") <> 0 OR lcase(CmdTxt(1)) = "me" OR InList(Nickname,"Hatelist") OR Int(Rnd * 100) < 21) then
SendCommand Retaliation(Nickname,Channel),ServerNumber
else
CmdTxt(0) = Empty
TextString = Join(CmdTxt)
SendCommand Retaliation(TextString,Channel),ServerNumber
end if
Call FloodControl(Channel,Host,ServerNumber)
case "!dumpabuses"
If InStr(lcase(Nickname),"kyte") = 0 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 InStr(lcase(Nickname),"kyte") <> 0 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 InStr(lcase(Nickname),"kyte") = 0 then Exit Sub
Section = CmdTxt(1)
Word = GetIniFile("Lists.ini","Main",List,0) + 1
CmdTxt(0) = Empty
CmdTxt(1) = Empty
Message = Trim(Join(CmdTxt))
WriteIniFile "Lists.ini","Main",List,NoMessage
WriteIniFile "Lists.ini",Section,Key,Message
SendCommand "/msg " & channel & " Added " & Message & " to " & List,ServerNumber
case "!addto"
If InStr(lcase(Nickname),"kyte") = 0 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
Data = Join(CmdTxt)
CALL AddTo(Filename, Section, Data)
SendCommand "/msg " & Channel & " Data Added to " & Section & " in " & Filename,ServerNumber
case "!dumpcommands"
If InStr(lcase(Nickname),"kyte") = 0 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 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 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
ElseIf Left(CmdTxt(1),1) <> "!" 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 (InStr(lcase(Message),"pop") <> 0 AND InStr(lcase(Message),"corn") <> 0) AND GetIniFile("Misc.ini","Main","Popcorn",0) = 0 then
SendCommand "/describe " & channel & " assumes fetal position, rocking back and forth. " & Chr(34) & "That's not butter..." & Chr(34),ServerNumber
SendCommand TimerFormat("Popcorn_timer", 1, 60, "/! WriteIniFile @Misc.ini@, @Main@, @Popcorn@, 0"),ServerNumber
WriteIniFile "Misc.ini","Main","Popcorn",1
Exit Sub
End If
If Left(Message,1) = "!" AND InList(CmdTxt(0),"Commands") AND Len(CmdTxt(0)) = (Len(LastResultStr("Commands")) + 1) Then
If UBound(CmdTxt) = 0 Then
Target = Nickname
Else
CmdTxt(0) = Empty
Target = Join(CmdTxt)
End If
Answer = RandomEntry("Commands", LastResultStr("Commands"), "/say No responses for this command. Yet.", Target)
AnswerBits = Split(Trim(Answer))
If AnswerBits(0) = "/me" then
AnswerBits(0) = Empty
Answer = " " & Trim(Join(AnswerBits))
SendCommand "/describe " & Channel & Answer,ServerNumber
Elseif AnswerBits(0) = "/say" then
AnswerBits(0) = Empty
Answer = " " & Trim(Join(AnswerBits))
SendCommand "/msg " & Channel & Answer,ServerNumber
End If
End If
End Select
If (InList(Nickname,"Hatelist") = True) AND Int(Rnd*100) < 2 then SendCommand Retaliation(Nickname,Channel),ServerNumber
End Sub
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
If lcase(Nickname) = "player_1" OR lcase(Nickname) = "player1" AND Int(Rnd * 100) < 26 then
SendCommand "/msg " & Channel & " DANGER WILL ROBINSON! PEDO ALERT!",ServerNumber
elseIf lcase(Nickname) = "graystash|swat" AND Int(Rnd * 100) < 51 then
SendCommand "/describe " & Channel & " hides from the bot molester!",ServerNumber
end if
End Sub
Sub ONACTION(Message,Channel,Nickname,Host,ServerNumber)
ActionSwitch = GetIniFile("Misc.ini","Main","ActionSwitch",0)
If ActionSwitch = 1 OR InList(Message,"BanList") then Exit Sub
If InList(Nickname,"Hatelist") AND (Int(Rnd*100) < 15 OR InList(Message,"ProtectList")) then SendCommand Retaliation(Nickname,Channel),ServerNumber
If InList(Message,"ProtectList") AND InList(Message,"Attacks") then
SendCommand Retaliation(Nickname,Channel),ServerNumber
Call FloodControl(Channel,Host,ServerNumber)
End If
If InStr(lcase(Message),"popcorn") <> 0 AND GetIniFile("Misc.ini","Main","Popcorn",0) = 0 then
SendCommand "/describe " & channel & " closes its eyes and claps its hand over its ears, going " & Chr(34) & "LALALANOTHINGWRONGHERE" & Chr(34) & ".",ServerNumber
SendCommand TimerFormat("Popcorn_timer", 1, 60, "/! WriteIniFile @Misc.ini@, @Main@, @Popcorn@, 0"),ServerNumber
WriteIniFile "Misc.ini","Main","Popcorn",1
end if
End Sub
Function RandomEntry(Filename, Section, Default, Target)
Filename = Filename & ".ini"
ItemCount = GetIniFile(Filename, "General", ("Prev" & Section), 0)
ItemPick = Int(Rnd * ItemCount + 1)
Pull = GetIniFile(Filename, Section, ItemPick, Default)
Pull = Replace(Pull,"<target>",Target)
RandomEntry = " " & 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
Function Retaliation(Target, Channel)
If dbLoaded = 0 then CALL LoadAbuses()
ItemPick = Int(Rnd * UBound(AbuseArray) + 1)
Pull = AbuseArray(ItemPick)
Pull = Replace(Pull,"<target>",Target)
Retaliation = "/describe " & Channel & " " & Pull
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 <target>!")
Next
dbLoaded = 1
End Sub
Sub ONCONNECT(ServerNumber)
dbLoaded = 1
CALL LoadAbuses()
End Sub
Sub Dice(Channel, DieParam, ServerNumber, WithMod, Modifier)
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)
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 WithMod = True then
DieParam = DieParam & Modifier
Total = Total + Int(Modifier)
End If
If UBound(DieValue) < 10 AND (UBound(DieValue) > 0 OR WithMod = True) Then
SendCommand "/msg " & channel & " " & DieParam & " = " & Total & " (" & NumberString & ")",ServerNumber
Else
SendCommand "/msg " & channel & " " & DieParam & " = " & Total,ServerNumber
End if
End Sub
Sub ErrorOut(Section,Key,Channel,ServerNumber)
Key = lcase(Key)
Section = lcase(Section)
ErrorMsg = GetIniFile("HelpDocs.ini",Section,Key,"Error found, no documentation for it. Sorry.")
SendCommand "/msg " & channel & " " & ErrorMsg,ServerNumber
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","Main","PowerSwitch",1
WriteIniFile "misc.ini","Main","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
Case Else
WriteIniFile "misc.ini","Main","FloodCount",(FloodCount+1)
End Select
End Sub
Sub ReopenGates(Channel,ServerNumber)
WriteIniFile "Misc.ini","Main","PowerSwitch",0
WriteIniFile "Misc.ini","Main","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)) <> 0 then
InList = True
WriteIniFile "Misc.ini","Main",(Section & "_LastResult"),Key
End If
Next
End Function
Function LastResultInt(Section)
LastResultInt = GetIniFile("Misc.ini","Main",(Section & "_LastResult"),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(Rnd * UBound(Nicklist) + 1)
End Function