Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #------------------------------------------------------#
- # Random stuff #
- #------------------------------------------------------#
- require 'ftools'
- $botstatus #= 0
- $botnick = "|Eclipse|"
- $spamon #= 0
- $replyed
- $idle #= 0
- $cws = Array.new
- spm = File.new("cwspams.txt","r")
- $cws = spm.readlines
- spm.close
- $sws = Array.new
- spm = File.new("server.txt","r")
- $sws = spm.readlines
- spm.close
- $scws = Array.new
- spm = File.new("sctfl.txt","r")
- $scws = spm.readlines
- spm.close
- $iws = Array.new
- spm = File.new("idlespam.txt","r")
- $cws = Array.new
- spm = File.new("recspams.txt","r")
- $rws = spm.readlines
- spm.close
- =begin
- $adm = File.new("Admins.txt","r")
- $admins = $adm.readlines
- $adm.close
- =end
- $adminlog = "eablox"
- $record = Array.new
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- $record.chomp!
- #------------------------------------------------------#
- # PING #
- #------------------------------------------------------#
- def Commands(sock,splitted,channels,mainchan,admins,solsock,text,user,id)
- begin
- if splitted[0] == "PING"
- sock.print("PONG " + splitted[1] + "\r\n")
- #------------------------------------------------------#
- # Panel #
- #------------------------------------------------------#
- elsif splitted[3] == ":!panel" && splitted[2] == mainchan
- ircmsg(sock,mainchan, "0,1[» 5«7,1Panel:5» 8!admin 9!adminlist 8!admindel !admintest !backup !boton !botoff 11!commands 9!cw 8!addcw !delcw !cwlist 9!idle 8!addidle !delidle !idlelist 9!panel !pm !reply 11!record 8!addwin !addtie !addloss !delwin !deltie !delloss 8!reload 4!remote 11!roster 4!rosadd 8!spamon !spamoff 9!test !whois 0«]")
- ircmsg(sock,mainchan, "0,1[» 5«7,1Access Key:5» 4[4,11 4,1] = Public 4[4,9 4,1] = Normal 4[4,8 4,1] = Admin 4[4,4 4,1] = Broken 0«]")
- #------------------------------------------------------#
- # Quotes #
- #------------------------------------------------------#
- #-------------------------!addquote----------------------#
- elsif splitted[3] == ":!addquote"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("quotes.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("quotes.txt","r")
- $qws = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Quote has been added.")
- #-------------------------!quote------------------------#
- elsif splitted[3] == ":!quote" && splitted[2] == mainchan
- ispm = File.new("quotes.txt","r")
- $qws = ispm.readlines
- ispm.close
- $qws.shuffle!
- ircmsg(sock,mainchan,$qws[0])
- #------------------------------------------------------#
- # News #
- #------------------------------------------------------#
- elsif splitted[3] == ":!news" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- sock.print("PRIVMSG Q@CServe.quakenet.org :settopic eclipsed \r\n")
- ircmsg(sock,mainchan,"Topic successfully updated.")
- #------------------------------------------------------#
- # Servers #
- #------------------------------------------------------#
- #-------------------------!addserv----------------------#
- elsif splitted[3] == ":!addserv"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("server.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("server.txt","r")
- $sws = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Server has been added.")
- #-------------------------!delserv----------------------#
- elsif splitted[3] == ":!delserv" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- txt = text.to_i
- $sws.delete_at(txt)
- $sws.compact!
- serv = File.new("server.txt","w+")
- i = 0
- ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
- while($sws[i])
- serv.puts $sws[i]
- i+=1
- end
- serv.close
- serv = File.new("server.txt","r")
- $sws = serv.readlines
- serv.close
- $sws.chomp!
- #-------------------------!servlist-----------------------#
- elsif splitted[3] == ":!serverlist" || splitted[3] == ":!servlist" || splitted[3] == ":!server" || splitted[3] == ":!servers" && splitted[2] == mainchan
- i=0
- while($sws[i])
- ircmsg(sock,mainchan,"["+i.to_s+"] "+$sws[i])
- i+=1
- end
- #------------------------------------------------------#
- # !test #
- #------------------------------------------------------#
- elsif splitted[3] == ":!test"
- ircmsg(sock,mainchan,"$spamon = "+$spamon.to_s+"id = "+id)
- #------------------------------------------------------#
- # !boton / !botoff #
- #------------------------------------------------------#
- elsif splitted[3] == ":!boton" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock, mainchan, "Bot Status: 9ON") #For messages to display to irc you need to do this. ircmsg(sock, channelname, "message") You can either put in the name of the channel, or use a variable
- ircmsg(sock,mainchan,"Clan war spamming on!")
- $spamon = 1
- $botstatus = 0
- elsif splitted[3] == ":!botoff" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock, mainchan, "Bot Status: 4OFF")
- $botstatus = 1
- ircmsg(sock,mainchan,"Clan war spamming off!")
- $spamon =0
- #------------------------------------------------------#
- # !cwon / !cwoff #
- #------------------------------------------------------#
- elsif splitted[3] == ":!cwon" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock, mainchan, "Bot Status: 9ON") #For messages to display to irc you need to do this. ircmsg(sock, channelname, "message") You can either put in the name of the channel, or use a variable
- $botstatus = 0
- elsif splitted[3] == ":!cwoff" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock, mainchan, "Bot Status: 4OFF")
- $botstatus = 1
- #------------------------------------------------------#
- # !spamon / !spamoff #
- #------------------------------------------------------#
- elsif splitted[3] == ":!spamon" && splitted[2] == mainchan
- ircmsg(sock,mainchan,"Clan war spamming on!")
- $spamon = 1
- elsif splitted[3] == ":!spamoff" && splitted[2] == mainchan
- ircmsg(sock,mainchan,"Clan war spamming off!")
- $spamon =0
- #------------------------------------------------------#
- # Admin Commands #
- #------------------------------------------------------#
- #-----------------------!admlist-----------------------#
- elsif splitted[3] == ":!admlist" || splitted[3] ==":!admins" || splitted[3] ==":!adminlist" && splitted[2] == mainchan
- i = 0
- while $admins[i]
- ircmsg(sock,mainchan,"["+i.to_s+"-"+(i+1).to_s+"] ("+$admins[i]+") "+$admins[i+1])
- i+= 2
- end
- #-------------------------!admin--------------------#
- elsif splitted[3] == ":!admin" && isadmi($admins,id) == 1 || splitted[3] == ":!adm" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- sock.print("WHOIS "+ text+"\r\n")
- msg = sock.gets.chomp
- gethm = msg.split(" ")
- hm = gethm[5].to_s
- $adm = File.new("Admins.txt","a+")
- $adm.puts text
- $adm.puts hm
- $adm.close
- $adm = File.new("Admins.txt","r")
- $admins = $adm.readlines
- $adm.close
- $admins.chomp!
- ircmsg(sock,mainchan,"User 7"+text+" 1has been successfully added to admins!")
- #-----------------------!admindel----------------------#
- elsif splitted[3] == ":!deladm" && isadmi($admins,id) == 1 || splitted[3] ==":!deladmin" && isadmi(admins,id) == 1 && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- txt = text.to_i
- $admins.delete_at(txt)
- $admins.delete_at(txt)
- $admins.compact!
- cw = File.new("admins.txt","w+")
- i = 0
- ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
- while($admins[i])
- cw.puts $admins[i]
- i+=1
- end
- cw.close
- cw = File.new("admins.txt","r")
- $admins = cw.readlines
- cw.close
- $admins.chomp!
- #-----------------------!recspam----------------------#
- # elsif splitted[3] == ":!recspamon" && splitted[2] == mainchan
- # ircmsg(sock,mainchan,"Recuite spamming 9 ON!")
- # recon = 1
- #while recon == 0
- # ispm = File.new("recspams.txt","r")
- # $iws = ispm.readlines
- # ispm.close
- # $iws.shuffle!
- # ircmsg(sock,"#eclipse.priv",$iws[0])
- # ircmsg(sock,"#sna.gather",$iws[0])
- # ircmsg(sock,"#nasoldat",$iws[0])
- # sleep 30
- # end
- # elsif splitted[3] == ":!recspamoff" && splitted[2] == mainchan
- # recon == 0
- # ircmsg(sock,mainchan,"Recuite spamming 4 OFF!")
- #-------------------------!admintest-------------------#
- elsif splitted[3] == ":!admtest" && isadmi($admins,id) == 1 || splitted[3] ==":!admintest" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock,mainchan,"Admin functional.")
- #---------------------------!whois----------------------#
- elsif splitted[3] == ":!whois" && splitted[2] == mainchan
- ircmsg(sock,mainchan,"id is: "+id)
- #----------------------!roster (private channel)---------------------#
- elsif splitted[3] == ":!Members" || splitted[3] == ":!Roster" || splitted[3] == ":!roster" && splitted[2] == mainchan
- l = File.open("leader.txt","r")
- leaders = l.readlines
- l.close
- leaders.chomp!
- roster = "0«]0,1[» 1« 14« 5L14eader:14» 0-4 "
- i = 0
- while(leaders[i])
- roster += leaders[i]+" 0-4,1 "
- i+= 1
- end
- m = File.open("member.txt","r")
- members = m.readlines
- m.close
- members.chomp!
- roster += "0«]0,1[»1«14«5M14embers:5» 0-4 "
- i=0
- while(members[i])
- roster += members[i]+" 0-4,1 "
- i+= 1
- end
- t = File.open("trial.txt","r")
- trials = t.readlines
- t.close
- trials.chomp!
- roster += " 0«]0[» 15«5T14rials:15» 0-4 "
- i=0
- while(trials[i])
- roster += trials[i]+" 0-4,1 "
- i+=1
- end
- i = File.open("inactive.txt","r")
- inactive = i.readlines
- i.close
- inactive.chomp!
- roster += ""
- i=0
- while(inactive[i])
- roster += inactive[i]+" "
- i+=1
- end
- roster += " 0«][» 5«5R14ecruiting:5» 9ON 0«]"
- ircmsg(sock,mainchan, roster)
- #----------------------!addleader-----------------#
- elsif splitted[3] == ":!addleader"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("leader.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("leader.txt","r")
- $roslead = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Leader has been successfully added to roster.")
- #----------------------!addmember-------------------#
- elsif splitted[3] == ":!addmember"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("member.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("member.txt","r")
- $rosmem = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Member has been successfully added to roster.")
- #-------------------------!addtrial-------------------#
- elsif splitted[3] == ":!addtrial"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("trial.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("trial.txt","r")
- $rostri = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Trial has been successfully added to roster.")
- #-------------------------!addinactive-------------------#
- elsif splitted[3] == ":!addinactive"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("inactive.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("inactive.txt","r")
- $rostri = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Inactive has been successfully added to roster.")
- #-------------------------!delleader------------------#
- elsif splitted[3] == ":!delleader" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- l = File.open("leader.txt","r")
- leaders = l.readlines
- leaders.chomp!
- l.close
- i = 0
- if leaders.include?(txt) == false
- ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
- else
- leaders.delete(txt)
- leaders.compact!
- ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
- l = File.new("leader.txt","w+")
- while(leaders[i])
- l.puts leaders[i]
- i+=1
- end
- l.close
- end
- #-------------------------!delmember------------------#
- elsif splitted[3] == ":!delmember" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- m = File.open("member.txt","r")
- members = m.readlines
- members.chomp!
- m.close
- i = 0
- if members.include?(txt) == false
- ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
- else
- members.delete(txt)
- members.compact!
- ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
- m = File.new("member.txt","w+")
- while(members[i])
- m.puts members[i]
- i+=1
- end
- m.close
- end
- #-------------------------!deltrial--------------------#
- elsif splitted[3] == ":!deltrial" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- t = File.open("trial.txt","r")
- trials = t.readlines
- trials.chomp!
- t.close
- i = 0
- if trials.include?(txt) == false
- ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
- else
- trials.delete(txt)
- trials.compact!
- ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
- t = File.new("trial.txt","w+")
- while(trials[i])
- t.puts trials[i]
- i+=1
- end
- t.close
- end
- #-------------------------!axeinactive--------------------#
- elsif splitted[3] == ":!delinactive" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- k = File.open("inactive.txt","r")
- inactive = k.readlines
- inactive.chomp!
- k.close
- i = 0
- if inactive.include?(txt) == false
- ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
- else
- inactive.delete(txt)
- inactive.compact!
- ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
- k = File.new("inactive.txt","w+")
- while(inactive[i])
- k.puts inactive[i]
- i+=1
- end
- k.close
- end
- #------------------------------------------------------#
- # !backup #
- #------------------------------------------------------#
- elsif splitted[3] == ":!backup" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- File.copy("Commands.rb","CommandsB.rb")
- ircmsg(sock,mainchan,"File Backed up.")
- #------------------------------------------------------#
- # !remote #
- #------------------------------------------------------#
- #elsif splitted[3] == ":!remote" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- #text = text[8, text.length]
- #solmsg(solsock, text)
- #------------------------------------------------------#
- # Spam: "SCTFL" #
- #------------------------------------------------------#
- elsif splitted.include?("SCTFL") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?("sctfl") == true && $spamon == 1 && splitted[2] != mainchan ||splitted.include?(":SCTFL") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?(":sctfl") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?("cw") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?("CW") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?("fcw") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?("FCW") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?(":cw") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?(":CW") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?(":fcw") == true && $spamon == 1 && splitted[2] != mainchan || splitted.include?(":FCW") == true && $spamon == 1 && splitted[2] != mainchan
- txt = text[splitted[3].size-1,text.length]
- message = splitted[3]
- message.delete!(":")
- $replyed = user
- if text.empty? == false
- ircmsg(sock,mainchan,"11,01Cw ->(04"+user+"11) (04"+splitted[2]+"11) 00,01"+message + txt)
- else
- ircmsg(sock,mainchan,"11,01Cw ->(04"+user+"11) (04"+splitted[2]+"11) 00,01"+message)
- end
- #------------------------------------------------------#
- # Private Messaging #
- #------------------------------------------------------#
- elsif splitted[1] == "PRIVMSG" && splitted[2] == $botnick
- #in case someone tries to login as admin
- if(splitted[3] == ":!adminlog")
- if isadmi(admins,user) == 0
- if splitted[4] == $adminlog
- admins = addadmi(admins,id)
- ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 was successfuly added to admins list...")
- else
- ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 tryed to login with an incorrect password...")
- end
- elsif isadmi(admins,user) == 1
- ircmsg(sock, user, "5(Admin) 4"+user+"1 is already an admin...")
- end
- elsif $botstatus == 1
- ircmsg(sock, user, "Bot Off")
- elsif $botstatus == 0
- # txt = text[(5 + splitted[4].length), text.length]
- $replyed = splitted[4]
- ircmsg(sock, mainchan, "4,1(0PM4) 0"+user+"4:0 "+text+"")
- $replyed = user
- $host = id
- end
- #------------------------------------------------------#
- # CW Commands #
- #------------------------------------------------------#
- #-------------------------!cw-------------------------#
- elsif splitted[3] == ":!cw" && splitted[2] == mainchan
- ispm = File.new("cwspams.txt","r")
- $cws = ispm.readlines
- ispm.close
- $cws.shuffle!
- ircmsg(sock,"#soldat.match",$cws[0])
- ircmsg(sock,"#nasoldat",$cws[0])
- ircmsg(sock,"#sna.gather",$cws[0])
- ircmsg(sock,"#bro.soldat",$cws[0])
- ircmsg(sock,"#lod.soldat",$cws[0])
- ircmsg(sock,"#oxid",$cws[0])
- ircmsg(sock,"#pz.soldat",$cws[0])
- ircmsg(sock,"#fost.channel",$cws[0])
- ircmsg(sock,"#`v4rl-00ck",$cws[0])
- #-------------------------!addcw----------------------#
- elsif splitted[3] == ":!addcw"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("cwspams.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("cwspams.txt","r")
- $cws = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Your spam has been added.")
- #-------------------------!delcw----------------------#
- elsif splitted[3] == ":!delcw" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- txt = text.to_i
- $cws.delete_at(txt)
- $cws.compact!
- cw = File.new("cwspams.txt","w+")
- i = 0
- ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
- while($cws[i])
- cw.puts $cws[i]
- i+=1
- end
- cw.close
- cw = File.new("cwspams.txt","r")
- $cws = cw.readlines
- cw.close
- $cws.chomp!
- #-------------------------!cwlist-----------------------#
- elsif splitted[3] == ":!cwlist" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- i=0
- while($cws[i])
- ircmsg(sock,mainchan,"["+i.to_s+"] "+$cws[i])
- i+=1
- end
- #-----------------------------------------------------#
- # SCTFL commands #
- #-----------------------------------------------------#
- #-------------------------!sctfl-------------------------#
- elsif splitted[3] == ":!sctfl" && splitted[2] == mainchan
- ispm = File.new("sctfl.txt","r")
- $scws = ispm.readlines
- ispm.close
- $scws.shuffle!
- ircmsg(sock,"#soldat.match",$cws[0])
- ircmsg(sock,"#nasoldat",$cws[0])
- ircmsg(sock,"#sna.gather",$cws[0])
- ircmsg(sock,"#bro.soldat",$cws[0])
- ircmsg(sock,"#lod.soldat",$cws[0])
- ircmsg(sock,"#oxid",$cws[0])
- ircmsg(sock,"#bro.soldat",$cws[0])
- ircmsg(sock,"#pz.soldat",$cws[0])
- ircmsg(sock,"#fost.channel",$cws[0])
- ircmsg(sock,"#soldat.gather.nordic",$cws[0])
- ircmsg(sock,"#soldat.mapping",$cws[0])
- ircmsg(sock,"#`v4rl-00ck",$cws[0])
- #-------------------------!addcw----------------------#
- elsif splitted[3] == ":!addsctfl"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- spamfile = File.new("sctfl.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("sctfl.txt","r")
- $scws = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Your spam has been added.")
- #-------------------------!delcw----------------------#
- elsif splitted[3] == ":!delsctfl" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- txt = text.to_i
- $scws.delete_at(txt)
- $scws.compact!
- sc = File.new("sctfl.txt","w+")
- i = 0
- ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
- while($scws[i])
- sc.puts $scws[i]
- i+=1
- end
- sc.close
- sc = File.new("sctfl.txt","r")
- $scws = sc.readlines
- sc.close
- $scws.chomp!
- #-------------------------!cwlist-----------------------#
- elsif splitted[3] == ":!sctfllist" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- i=0
- while($scws[i])
- ircmsg(sock,mainchan,"["+i.to_s+"] "+$scws[i])
- i+=1
- end
- #------------------------------------------------------#
- # Idle Commands #
- #------------------------------------------------------#
- #-------------------------!idle------------------------#
- elsif splitted[3] == ":!idle" && splitted[2] == mainchan
- ispm = File.new("idlespam.txt","r")
- $iws = ispm.readlines
- ispm.close
- $iws.shuffle!
- ircmsg(sock,"#soldat.match",$iws[0])
- ircmsg(sock,"#sna.gather",$iws[0])
- ircmsg(sock,"#nasoldat",$iws[0])
- ircmsg(sock,"#lod.soldat",$iws[0])
- ircmsg(sock,"#oxid",$iws[0])
- ircmsg(sock,"#pz.soldat",$iws[0])
- ircmsg(sock,"#fost.channel",$iws[0])
- ircmsg(sock,"#soldat.gather.nordic",$iws[0])
- ircmsg(sock,"#soldat.mapping",$iws[0])
- #-------------------------!addidle---------------------#
- elsif splitted[3] == ":!addidle"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- ispamfile = File.new("idlespam.txt","a+")
- ispamfile.puts text
- ispamfile.close
- ispm = File.new("idlespam.txt","r")
- $iws = ispm.readlines
- ispm.close
- ircmsg(sock,mainchan,"Your spam has been added.")
- #-------------------------!delidle---------------------#
- elsif splitted[3] == ":!delidle" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
- text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- txt = text.to_i
- $iws.delete_at(txt)
- $iws.compact!
- cw = File.new("idlespam.txt","w+")
- i = 0
- ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
- while($iws[i])
- cw.puts $iws[i]
- i+=1
- end
- cw.close
- cw = File.new("idlespam.txt","r")
- $iws = cw.readlines
- cw.close
- $iws.chomp!
- #-----------------------!idlelist-----------------------#
- elsif splitted[3] == ":!idlelist" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- i=0
- while($iws[i])
- ircmsg(sock,mainchan,"["+i.to_s+"] "+$iws[i])
- i+=1
- end
- #------------------------------------------------------#
- # Auto-idle #
- #------------------------------------------------------#
- elsif splitted[3] ==":!idleon" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- $idleon = 1
- $idletime = Time.now
- #$nextidle = $idletime - (1)
- ircmsg(sock,mainchan,"Auto-idle spamming: ON!")
- while $idleon == 1
- ircmsg(sock,mainchan,"SUP")
- sleep 10
- $idle == 0
- end
- if $idle1 == 1
- ircmsg(sock,mainchan,"SUP2")
- sleep 10
- $idle1 == 0
- $idle2 == 1
- end
- if $idle2 == 1
- ircmsg(sock,mainchan,"SUP3")
- sleep 10
- $idle2 == 0
- $idle1 == 1
- end
- elsif splitted[3] == ":!idleoff" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- $idleon == 0
- $idle1 == 0
- $idle2 == 0
- ircmsg(sock,mainchan,"Auto-idle spamming: OFF!")
- #------------------------------------------------------#
- # !pm / !reply #
- #------------------------------------------------------#
- elsif splitted[3] == ":!pm" && splitted[2] && splitted[2]== mainchan
- txt = text[(5 + splitted[4].length), text.length]
- $replyed = splitted[4]
- ircmsg(sock,mainchan ,"2,15[4"+user+"2]4 says to2: [4"+splitted[4]+"2]:4 "+txt+"")
- ircmsg(sock, splitted[4],"2,15[4"+user+"2]4 says2: 4"+txt)
- elsif splitted[3] == ":!reply" || splitted[3] ==":!r" && splitted[2] && splitted[2] == mainchan
- txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
- ircmsg(sock, $replyed,"2,15[4"+user+"2]4 says2: 4"+txt)
- ircmsg(sock, mainchan,"2,15[4"+user+"2]4 says to2: [4"+$replyed+"2]:4 "+txt+"")
- #------------------------------------------------------#
- # Record #
- #------------------------------------------------------#
- #-----------------------!record------------------------#
- elsif splitted[3] == ":!record" && splitted[2] == "#eclipsed"
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- $record.chomp!
- w = $record[0].to_f
- t = $record[1].to_f
- l = $record[2].to_f
- wr = ((w / (w+t+l))*100).to_i
- if wr >= 60
- twr = "9 "+wr.to_s
- elsif wr >= 49 && wr <60
- twr = "8 "+wr.to_s
- elsif wr < 49
- twr = "4 "+wr.to_s
- end
- wr = twr
- wl = ((w / (w+l))*100).to_i
- if wl >= 60
- twl = "9 "+wl.to_s
- elsif wl >= 49 && wl <60
- twl = "8 "+wl.to_s
- elsif wl < 49
- twl = "4 "+wl.to_s
- end
- wl = twl
- w = $record[0].to_i
- t = $record[1].to_i
- l = $record[2].to_i
- ircmsg(sock,"#eclipsed","0,1[» 5«7,1Record:5,1»9,1 "+w.to_s+" 0,1-8,1 "+t.to_s+" 0,1-4,1 "+l.to_s+" 0,1«]0,1[» 5«7,1Most recent:5,1» "+$record[3].to_s+" 0,1«]0,1[» 5«7,1Win %:5,1»0"+wr.to_s+"% 0,1«]0,1[» 5«7,1Win/Loss:5,1»0"+wl.to_s+"% 0,1«]")
- #-----------------------!record (priv)------------------------#
- elsif splitted[3] == ":!record" && splitted[2] == mainchan
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- $record.chomp!
- w = $record[0].to_f
- t = $record[1].to_f
- l = $record[2].to_f
- wr = ((w / (w+t+l))*100).to_i
- if wr >= 60
- twr = "9 "+wr.to_s
- elsif wr >= 49 && wr <60
- twr = "8 "+wr.to_s
- elsif wr < 49
- twr = "4 "+wr.to_s
- end
- wr = twr
- wl = ((w / (w+l))*100).to_i
- if wl >= 60
- twl = "9 "+wl.to_s
- elsif wl >= 49 && wl <60
- twl = "8 "+wl.to_s
- elsif wl < 49
- twl = "4 "+wl.to_s
- end
- wl = twl
- w = $record[0].to_i
- t = $record[1].to_i
- l = $record[2].to_i
- ircmsg(sock,mainchan,"0,1[» 5«7,1Record:5,1»9,1 "+w.to_s+" 0,1-8,1 "+t.to_s+" 0,1-4,1 "+l.to_s+" 0,1«]0,1[» 5«7,1Most recent:5,1» "+$record[3].to_s+" 0,1«]0,1[» 5«7,1Win %:5,1»0"+wr.to_s+"% 0,1«]0,1[» 5«7,1Win/Loss:5,1»0"+wl.to_s+"% 0,1«]")
- #-----------------------!addwinb------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!addwinb"
- win = $record[0].to_f
- win += 1
- rec = File.open("Record.txt","r+")
- rec.puts win
- rec.puts $record[1]
- rec.puts $record[2]
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Win added, record updated.")
- $record.chomp!
- #-----------------------!addwin------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2]&& splitted[2] == mainchan && splitted[3] == ":!addwin"
- t = "9"
- if text.empty? == true
- txt = (t+"None")
- else
- txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
- end
- win = $record[0].to_f
- win += 1
- rec = File.open("Record.txt","r+")
- rec.puts win
- rec.puts $record[1]
- rec.puts $record[2]
- rec.puts txt
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Win added, record updated.")
- $record.chomp!
- #-----------------------!addtieb------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addtieb"
- tie = $record[1].to_f
- tie += 1
- rec = File.open("Record.txt","r+")
- rec.puts $record[0]
- rec.puts tie
- rec.puts $record[2]
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Tie added, record updated.")
- $record.chomp!
- #-----------------------!addtie------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addtie"
- t = "8"
- if text.empty? == true
- txt = (t+"None")
- else
- txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
- end
- tie = $record[1].to_f
- tie += 1
- rec = File.open("Record.txt","r+")
- rec.puts $record[0]
- rec.puts tie
- rec.puts $record[2]
- rec.puts txt
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Tie added, record updated.")
- $record.chomp!
- #-----------------------!addlossb------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addlossb"
- loss = $record[2].to_f
- loss += 1
- rec = File.open("Record.txt","r+")
- rec.puts $record[0]
- rec.puts $record[1]
- rec.puts loss
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Loss added, record updated.")
- $record.chomp!
- #-----------------------!addloss------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addloss"
- t = "4"
- if text.empty? == true
- txt = (t+"None")
- else
- txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
- end
- loss = $record[2].to_f
- loss += 1
- rec = File.open("Record.txt","r+")
- rec.puts $record[0]
- rec.puts $record[1]
- rec.puts loss
- rec.puts txt
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Loss added, record updated.")
- $record.chomp!
- #-----------------------!delwin------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delwin"
- win = $record[0].to_i
- win -= 1
- rec = File.new("Record.txt","r+")
- rec.puts win
- rec.puts $record[1].to_i
- rec.puts $record[2].to_i
- rec.close
- rec = File.new("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Win removed, record updated.")
- $record.chomp!
- #-----------------------!deltie------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!deltie"
- tie = $record[1].to_i
- tie -= 1
- rec = File.new("Record.txt","r+")
- rec.puts $record[0].to_i
- rec.puts tie
- rec.puts $record[2].to_i
- rec.close
- rec = File.new("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Tie removed, record updated.")
- $record.chomp!
- #-----------------------!delloss------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delloss"
- loss = $record[2].to_i
- loss -= 1
- rec = File.new("Record.txt","r+")
- rec.puts $record[0].to_i
- rec.puts $record[1].to_i
- rec.puts loss
- rec.close
- rec = File.new("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Loss removed, record updated.")
- $record.chomp!
- #-----------------------!addtie------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addtie"
- t = "8"
- if splitted[2].empty? == true
- txt = (t+"None")
- else
- txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
- end
- tie = $record[1].to_f
- tie += 1
- rec = File.open("Record.txt","r+")
- rec.puts $record[0]
- rec.puts tie
- rec.puts $record[2]
- rec.puts txt
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Tie added, record updated.")
- $record.chomp!
- #-----------------------!addloss------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addloss"
- t = "4"
- if splitted[2].empty? == true
- txt = (t+"None")
- else
- txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
- end
- loss = $record[2].to_f
- loss += 1
- rec = File.open("Record.txt","r+")
- rec.puts $record[0]
- rec.puts $record[1]
- rec.puts loss
- rec.puts txt
- rec.close
- rec = File.open("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Loss added, record updated.")
- $record.chomp!
- #-----------------------!delwin------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delwin"
- win = $record[0].to_i
- win -= 1
- rec = File.new("Record.txt","r+")
- rec.puts win
- rec.puts $record[1].to_i
- rec.puts $record[2].to_i
- rec.close
- rec = File.new("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Win removed, record updated.")
- $record.chomp!
- #-----------------------!deltie------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!deltie"
- tie = $record[1].to_i
- tie -= 1
- rec = File.new("Record.txt","r+")
- rec.puts $record[0].to_i
- rec.puts tie
- rec.puts $record[2].to_i
- rec.close
- rec = File.new("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Tie removed, record updated.")
- $record.chomp!
- #-----------------------!delloss------------------------#
- elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delloss"
- loss = $record[2].to_i
- loss -= 1
- rec = File.new("Record.txt","r+")
- rec.puts $record[0].to_i
- rec.puts $record[1].to_i
- rec.puts loss
- rec.close
- rec = File.new("Record.txt","r")
- $record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Loss removed, record updated.")
- $record.chomp!
- #------------------------------------------------------#
- #- !commands #
- #------------------------------------------------------#
- elsif splitted[3] == ":!commands" && splitted[2] == "#eclipsed" || splitted[3] == ":!Commands" && splitted[2] == "#eclipsed" || splitted[3] == ":!Info" && splitted[2] == "#eclipsed" || splitted[3] == ":!info" && splitted[2] == "#eclipsed" || splitted[3] == ":!menu" && splitted[2] == "#eclipsed" || splitted[3] == ":!Menu" && splitted[2] == "#eclipsed" || splitted[3] == ":!help" && splitted[2] == "#eclipsed" || splitted[3] == ":!Help" && splitted[2] == "#eclipsed"
- ircmsg(sock,"#eclipsed","0,1[» 5«7,1Commands:5» 4!7record 0«]")
- #----------add new commands ABOVE this line -----#
- end
- end
- #------------------------------------------------------#
- # Error: Reload/Backup #
- #------------------------------------------------------#
- rescue StandardError, SyntaxError, NameError, NoMethodError, TypeError, Exception => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError
- puts "Error!: "+error
- ircmsg(sock,mainchan,"Error!: "+error)
- ircmsg(sock,mainchan,"Error!: "+error.backtrace.inspect);
- load("CommandsB.rb")
- ircmsg(sock,mainchan,"Reloaded Backup file.")
- else
- end
- #------------------------------------------------------#
- # !reload #
- #------------------------------------------------------#
- def Reload(sock,splitted,mainchan,admins,id)
- if splitted[3] == ":!reload" && isadmi($admins,id) == 1 && splitted[2] == mainchan
- begin
- load("Receive.rb")
- load("Commands.rb")
- ircmsg(sock,mainchan,"Reloaded!")
- rescue StandardError, SyntaxError, NameError, NoMethodError, TypeError, Exception => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError
- puts "Error!: "+error
- ircmsg(sock,mainchan,"Error!: "+error)
- ircmsg(sock,mainchan,"Error!: "+error.backtrace.inspect);
- load("CommandsB.rb")
- load("backup.rb")
- ircmsg(sock,mainchan,"Reloaded Backup file.")
- ensure
- load("Receive.rb")
- end
- end
- end
- #------------------------------------------------------#
- # Server Commands/Old code #
- #------------------------------------------------------#
- =begin
- def Commands(splitted, mainchan)
- elsif splitted[3] == ":!botoff" && isadmi(admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock, mainchan, "Bot Status: 4OFF")
- botstatus = 1
- =begin
- elsif splitted[3] == ":!record" && splitted[2] == mainchan
- ircmsg(sock,mainchan,"0,1 Current record is0 wins:9 "+r1+" 0Ties:8 "+r2+" 0Losses:4 "+r3+" ")
- elsif isadmi(admins,id) == True && splitted[2] == mainchan && splitted[3] == ":!addwin"
- win = record[0].to_i
- win += 1
- rec = File.new("Record.txt","w+")
- rec.puts win
- rec.puts r2
- rec.puts r3
- rec.close
- rec = File.new("Record.txt","r")
- record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Win added, record updated.")
- r1 = record[0]
- r2 = record[1]
- r3 = record[2]
- record.chomp!
- elsif isadmi(admins,id) == True && splitted[2] == mainchan && splitted[3] == ":!addtie"
- tie = record[1].to_i
- tie += 1
- rec = File.new("Record.txt","w+")
- rec.puts r1
- rec.puts tie
- rec.puts r3
- rec.close
- rec = File.new("Record.txt","r")
- record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Tie added, record updated.")
- r1 = record[0]
- r2 = record[1]
- r3 = record[2]
- record.chomp!
- elsif isadmi(admins,id) == True && splitted[2] == mainchan && splitted[3] == ":!addloss"
- loss = record[2].to_i
- loss += 1
- rec = File.new("Record.txt","w+")
- rec.puts r1
- rec.puts r2
- rec.puts loss
- rec.close
- rec = File.new("Record.txt","r")
- record = rec.readlines
- rec.close
- ircmsg(sock,mainchan, "Loss added, record updated.")
- r1 = record[0]
- r2 = record[1]
- r3 = record[2]
- record.chomp!
- #=end
- #------------------------------------------------------------------------------------------------------------
- #To auto voice or auto op people that join the chan, need to have op first otherwise bot freaksout.
- #---------------------------------------------------------------------------------------------------------------
- #If you are an admin on the bot, the bot will give you +o
- elsif splitted[1] == "JOIN" && isadmi(admins,id) == 1 && splitted[2] == mainchan && user
- sock.print("MODE #[DC] +o "+user+"\r\n")
- #Otherwise the bot gives you +v
- elsif splitted[1] == "JOIN" && splitted[2] == mainchan && user
- sock.print("MODE #[DC] +v " +user+"\r\n")
- #--------------------------------------------------------------
- # System for adding quotes to the bot. Huzzah!
- #--------------------------------------------------------------
- elsif splitted[3] == ":!addqt" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- text = text[(2 + splitted[2].length), text.length ]
- quote = File.new("Quote.txt","a+")
- quote.puts text
- quote.close
- quote = File.new("Quote.txt","r")
- quotes = quote.readlines
- quote.close
- ircmsg(sock,mainchan, "Quote has been added!")
- elsif splitted[3] == ":!quote" && splitted[2] == mainchan
- quotes.shuffle!
- ircmsg(sock,mainchan, quotes[0])
- #----Adds clan war spams to the text file through Irc, no need to hard code into bot anymore!
- #
- #-----------------------------------------------------------------------------------------------------
- elsif splitted[3] == ":!addcw"&& splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- text = text[( 2 +splitted[2].length), text.length ]
- spamfile = File.new("cwspams.txt","a+")
- spamfile.puts text
- spamfile.close
- spm = File.new("cwspams.txt","r")
- cws = spm.readlines
- spm.close
- ircmsg(sock,mainchan,"Your spam has been added.")
- #spams.chomp!
- #----Remotely adds Admins through Irc
- #
- #------------------------------------------
- elsif splitted[3] == ":!admin" && splitted[2] && isadmi(admins,id) == 1&& splitted[2] == mainchan
- text = text[( 2+splitted[2].length), text.length ]
- adm = File.new("Admins.txt","a+")
- adm.puts text
- adm.close
- adm = File.new("Admins.txt","r")
- admins = adm.readlines
- adm.close
- admins.chomp!
- ircmsg(sock,mainchan,"4,1T6he 4U6ser 7"+text+"6 4H6as 4B6een 4A6dded 4A6s 4A6n 4A6uto 4A6dmin")
- elsif splitted[3] == ":!rosadd"&& splitted[4] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- text = text[2+(splitted[2].length), text.length ]
- ros = File.new("Roster.txt","w+")
- ros.puts text
- ros.close
- ros = File.new("Roster.txt","r")
- roster = ros.readlines
- ros.close
- ircmsg(sock,mainchan,"7,1U6pdated!")
- #Request: Send a pm to the define user for an IRC request
- #
- #-----------------------------------------------------------------
- elsif splitted[3] == ":!request" && splitted[4] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock, splitted[4],"4You 1have been 4Request 1on 4IRC 1by 4"+user+" 1!4!")
- ircmsg(sock, mainchan,"5(Request) 4"+splitted[4]+" 1has been 4Request 1on 4IRC 1by 4"+user+ " 1!4!")
- elsif splitted[3] == ":!server" && splitted[2] == mainchan
- ircmsg(sock,mainchan,"soldat://"+solserver+":"+solport+"/"+solpass)
- #---------spams /amsg to all chans------------------------------------------------------------------
- #You can use this as a basis for a while loop to spam a message to all chans in the channel array
- #------------------------------------------------------------------------------------------------------
- elsif splitted[3] == ":!amsg" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- txt = text[(splitted[2].length), text.length]
- i=0
- while (channels[i])
- ircmsg(sock, channels[i],txt)
- i+= 1
- end
- #---Spams all chans for cw---------
- #
- #------------------------------------
- elsif splitted[3] == ":!cw" && isadmi(admins,id) == 1 && splitted[2] == mainchan
- cws.shuffle!
- i = 0
- while (channels[i])
- ircmsg(sock,channels[i],cws[0])
- i+=1
- end
- elsif splitted[3] == ":!members" || splitted[3] == ":!Members" || splitted[3] == ":!Roster" || splitted[3] == ":!roster" && splitted[2] == mainchan
- ircmsg(sock,mainchan, roster[0])
- #Changes server password for soldat server
- #
- #------------------------------------------
- elsif splitted[3] == ":!pass" && isadmi(admins,id) == 1 && splitted[2] == mainchan
- pass = pw
- solpass = pass
- ircmsg(sock,mainchan,"server pass changed to "+pass+".")
- solsock.print("/password "+pass+"\r\n")
- ircmsg(sock,mainchan,"soldat://"+solserver+":"+solport+"/"+solpass)
- #Resets server pass to default pass
- #
- #----------------------------------------
- elsif splitted[3] == ":!respass" && isadmi(admins,id) == 1 && splitted[2] == mainchan
- solpass = defpass
- ircmsg(sock,mainchan,"Pass reset to "+solpass+".")
- solsock.print("/password "+defpass+"\r\n")
- ircmsg(sock,mainchan,"soldat://"+solserver+":"+solport+"/"+solpass)
- #----To Pm the bot with adminlog---------------------
- #
- #-------------------------------------------------------
- elsif splitted[1] == "PRIVMSG" && splitted[2] == botnick
- #in case someone tries to login as admin
- if(splitted[3] == ":!adminlog")
- if isadmi(admins,user) == 0
- if splitted[4] == adminlog
- admins = addadmi(admins,id)
- ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 was successfuly added to admins list...")
- else
- ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 tryed to login with an incorrect password...")
- end
- elsif isadmi(admins,user) == 1
- ircmsg(sock, user, "5(Admin) 4"+user+"1 is already an admin...")
- end
- #----------pm functions, displays the recived pm in the main chan---------
- #
- #-----------------------------------------------------------------------------
- elsif botstatus == 1
- ircmsg(sock, user, "Bot Off")
- elsif(line.index(id+"\n"))
- ircmsg(sock, user, "You have been put on the ignore list. Fuck off.")
- elsif(botstatus == 0 )
- ircmsg(sock, mainchan, "4,1(0PM4) 0"+user+"4:0 "+text+"")
- replyed = user
- host = id
- end
- #--------------Sends a pm to someone e.g. !pm Grishnak <text>---
- #
- #-------------------------------------------------------------------
- elsif splitted[3] == ":!pm" && splitted[4] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- txt = text[(5 + splitted[4].length), text.length]
- replyed = splitted[4]
- ircmsg(sock,mainchan ,"2,15[4"+user+"2]4 says to2: [4"+splitted[4]+"2]:4 "+txt+"")
- ircmsg(sock, splitted[4],"2,15[4"+user+"2]4 says2: 4"+txt)
- #----Replys to the last person to pm the bot, or the last person you Pmed--------
- #
- #---------------------------------------------------------------------------------------
- elsif splitted[3] == ":!r" || splitted[3] ==":!r" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- txt = text[(2 + splitted[2].length), text.length]
- ircmsg(sock, replyed,"2,15[4"+user+"2]4 says2: 4"+txt)
- ircmsg(sock, mainchan,"2,15[4"+user+"2]4 says to2: [4"+replyed+"2]:4 "+txt+"")
- #----Pms the last person to be Pmed, or that PMs the bot, the soldat server information----------
- #
- #----------------------------------------------------------------------------------------------------------
- elsif splitted[3] == ":!pmserv"&&isadmi(admins,id) == 1 && splitted[2] == mainchan
- ircmsg(sock,replyed,"soldat://"+solserver+":"+solport+"/"+solpass)
- ircmsg(sock,mainchan,"The server: soldat://"+solserver+":"+solport+"/"+solpass+" has been sent to " +replyed)
- #-----Ignore function, adds the last person to pm the bot, or to be pmed to the ignore list------
- #Need to add an unignore function, and figure out how to make it so you cannot add multiple instances of the same person
- #------------------------------------------------------------------------------------------------------
- elsif splitted[3] == ":!ignores" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
- text = text[(1+splitted[2].length), text.length ]
- igfile = File.new("Ignorelist.txt","a+")
- igfile2 = File.new("Ignorelog.txt","a+")
- igfile.puts text
- igfile2.puts txt
- igfile.close
- igfile2.close
- ignored = File.new("Ignorelist.txt","r")
- line = ignored.readlines
- ignored.close
- ircmsg(sock,mainchan,"The user "+text+" has been ignored")
- elsif splitted[3] == ":!ignore" && isadmi(admins,id) == 1 && splitted[2] == mainchan
- igfile = File.new("Ignorelist.txt","a+") #Opens the file in a way that it adds information to the end of the file (a+)
- igfile2 = File.new("Ignorelog.txt","a+") #Opens the file to log who ignored who.
- igfile.puts host #Puts the last person to pm, or be pmed by the bot
- igfile2.puts user +" Ignored "+host #Puts in the logfile who ignored who
- igfile2.close #Closes the logfile
- igfile.close #Closes the ignore file
- ignored = File.new("Ignorelist.txt","r") #Opens the file again, in read only, to update the ignore list
- line = ignored.readlines #runs through the file, adding all lines to the ignored array
- ignored.close #closes the file
- ircmsg(sock,mainchan,replyed+" has been ignored.") #Prints out said user has been ignored.
- =begin
- #---Does nothing, obviously.
- elsif splitted[3] == ":!unignore" && isadmi(admins,user) == 1 && splitted[2] == mainchan
- #-- Not fully working, will flood out the bot
- elsif splitted[3] == ":!ignored" && isadmi(admins,user) == 1 && splitted[2] == mainchan
- ignored = File.open("Ignorelist.txt").collect
- i = 0
- while(ignored[i])
- ircmsg(sock,mainchan,ignored[i])
- i+=1
- end
- =end
- =begin
- #----remote. sends a command from IRC to soldat server e.g. !remote /pause
- elsif splitted[3] == ":!remote" && isadmi(admins,id) == 1 && splitted[2] == mainchan
- text = text[8, text.length]
- if text.include?("/say")
- solmsg(solsock, "/say ("+ user +") " +text[5,text.length])
- else
- solmsg(solsock, text)
- end
- #----playing. shows server information in the IRC channel such as: whos playing, map, current time and scores.
- elsif splitted[3] == ":!playing" && splitted[2] == mainchan
- solsock.print("REFRESH\r\n")
- sleep(1)
- i = 0
- pl = names
- while (i < 10)
- if names[i] == ""
- names[i] = " x"
- end
- i+= 1
- end
- i = 0
- while (i < 8)
- if teams[i] == 1
- pl[i] = "4 "+names[i]+"1"
- elsif teams[i] == 2
- pl[i] = "12 "+names[i]+"1"
- elsif teams[i] == 3
- pl[i] = "8 "+names[i]+"1"
- elsif teams[i] == 4
- pl[i] = "9 "+names[i]+"1"
- end
- i+= 1
- end
- currenttime = currenttime/60
- mins = ((currenttime/60).to_i).to_s
- secs = (currenttime%60).to_s
- if mins.length == 1
- mins = "0"+mins
- end
- if secs.length == 1
- secs = "0"+secs
- end
- ircmsg(sock, mainchan, "4»1|| Map1: 14"+mapname+" 1|| Current time1: 14"+mins+":"+secs+" 1|| 4Alpha» 14"+teamscore[0].to_s+" 1- 14"+teamscore[1].to_s+" 12«Bravo 1||4«")
- ircmsg(sock, mainchan, "4»1|| Players: 14"+pl[0]+" -"+pl[1]+" -"+pl[2]+" -"+pl[3]+" -"+pl[4]+" -"+pl[5]+" -"+pl[6]+" -"+pl[7]+" -"+pl[8]+" -"+pl[9]+" 1||4«")
- #=end
- #---quit. kills the process, in other words, kills the bot :E
- elsif splitted[3] == ":!botquit" && isadmi(admins,id) == 1 && splitted[2] == mainchan #you can specifally make it so only you can turn the bot off, or use certain commands by adding this inplace of isadmi: &&user == "namehere"
- ircmsg(sock, mainchan, "Quitting...")
- sleep(2)
- break
- end
- =end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement