Advertisement
Guest User

Untitled

a guest
May 13th, 2017
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 57.78 KB | None | 0 0
  1.  #------------------------------------------------------#
  2.  #                       Random stuff                          #
  3.  #------------------------------------------------------#
  4.  
  5. require 'ftools'
  6. $botstatus #= 0
  7. $botnick = "|Eclipse|"
  8. $spamon #= 0
  9. $replyed
  10. $idle #= 0
  11. $cws = Array.new
  12. spm = File.new("cwspams.txt","r")
  13. $cws = spm.readlines
  14. spm.close
  15. $sws = Array.new
  16. spm = File.new("server.txt","r")
  17. $sws = spm.readlines
  18. spm.close
  19. $scws = Array.new
  20. spm = File.new("sctfl.txt","r")
  21. $scws = spm.readlines
  22. spm.close
  23. $iws = Array.new
  24. spm = File.new("idlespam.txt","r")
  25. $cws = Array.new
  26. spm = File.new("recspams.txt","r")
  27. $rws = spm.readlines
  28. spm.close
  29. =begin
  30.  
  31.   $adm = File.new("Admins.txt","r")
  32.   $admins = $adm.readlines
  33.   $adm.close
  34. =end  
  35. $adminlog = "eablox"
  36. $record = Array.new
  37. rec = File.open("Record.txt","r")
  38. $record = rec.readlines
  39. rec.close
  40. $record.chomp!
  41.  
  42.  #------------------------------------------------------#
  43.  #                             PING                               #
  44.  #------------------------------------------------------#
  45.    
  46.  def Commands(sock,splitted,channels,mainchan,admins,solsock,text,user,id)
  47.   begin
  48.   if splitted[0] == "PING"
  49.       sock.print("PONG " + splitted[1] + "\r\n")
  50.  
  51.  #------------------------------------------------------#
  52.  #                              Panel                              #
  53.  #------------------------------------------------------#
  54.  
  55. elsif splitted[3] == ":!panel" && splitted[2] == mainchan
  56.   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«]")
  57.   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«]")
  58.  
  59.  #------------------------------------------------------#
  60.  #                            Quotes                             #
  61.  #------------------------------------------------------#
  62.  
  63. #-------------------------!addquote----------------------#
  64.  
  65. elsif splitted[3] == ":!addquote"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  66.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  67.         spamfile = File.new("quotes.txt","a+")
  68.         spamfile.puts text
  69.         spamfile.close
  70.            spm = File.new("quotes.txt","r")
  71.            $qws = spm.readlines
  72.         spm.close
  73.       ircmsg(sock,mainchan,"Quote has been added.")
  74.      
  75. #-------------------------!quote------------------------#
  76.  
  77. elsif splitted[3] == ":!quote" && splitted[2] == mainchan
  78.       ispm = File.new("quotes.txt","r")
  79.       $qws = ispm.readlines
  80.       ispm.close
  81.       $qws.shuffle!
  82.       ircmsg(sock,mainchan,$qws[0])
  83.  
  84.  #------------------------------------------------------#
  85.  #                               News                             #
  86.  #------------------------------------------------------#
  87.  
  88.  elsif splitted[3] == ":!news" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  89.     txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  90.       sock.print("PRIVMSG Q@CServe.quakenet.org :settopic eclipsed \r\n")
  91.     ircmsg(sock,mainchan,"Topic successfully updated.")
  92.  
  93.  #------------------------------------------------------#
  94.  #                            Servers                            #
  95.  #------------------------------------------------------#
  96.  
  97. #-------------------------!addserv----------------------#
  98.  
  99. elsif splitted[3] == ":!addserv"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  100.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  101.         spamfile = File.new("server.txt","a+")
  102.         spamfile.puts text
  103.         spamfile.close
  104.            spm = File.new("server.txt","r")
  105.            $sws = spm.readlines
  106.         spm.close
  107.       ircmsg(sock,mainchan,"Server has been added.")
  108.  
  109. #-------------------------!delserv----------------------#
  110.  
  111. elsif splitted[3] == ":!delserv" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  112.     text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  113.     txt = text.to_i
  114.     $sws.delete_at(txt)
  115.     $sws.compact!
  116.     serv = File.new("server.txt","w+")
  117.     i = 0
  118.     ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
  119.     while($sws[i])
  120.         serv.puts $sws[i]
  121.         i+=1
  122.     end
  123.     serv.close
  124.     serv = File.new("server.txt","r")
  125.     $sws = serv.readlines
  126.     serv.close
  127.     $sws.chomp!
  128.  
  129. #-------------------------!servlist-----------------------#
  130.  
  131. elsif splitted[3] == ":!serverlist" || splitted[3] == ":!servlist" || splitted[3] == ":!server" || splitted[3] == ":!servers" && splitted[2] == mainchan
  132.        i=0
  133.          while($sws[i])
  134.            ircmsg(sock,mainchan,"["+i.to_s+"] "+$sws[i])
  135.        i+=1
  136. end
  137.  
  138.  #------------------------------------------------------#
  139.  #                           !test                                  #
  140.  #------------------------------------------------------#
  141.  
  142. elsif splitted[3] == ":!test"
  143.         ircmsg(sock,mainchan,"$spamon = "+$spamon.to_s+"id = "+id)
  144.  
  145.  #------------------------------------------------------#
  146.  #                      !boton / !botoff                        #
  147.  #------------------------------------------------------#
  148.  
  149.       elsif splitted[3] == ":!boton" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  150.             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
  151.       ircmsg(sock,mainchan,"Clan war spamming on!")
  152.       $spamon = 1
  153.       $botstatus = 0
  154.       elsif splitted[3] == ":!botoff" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  155.       ircmsg(sock, mainchan, "Bot Status: 4OFF")
  156.             $botstatus = 1    
  157.       ircmsg(sock,mainchan,"Clan war spamming off!")
  158.       $spamon =0
  159.  
  160.  
  161.  #------------------------------------------------------#
  162.  #                       !cwon / !cwoff                   #
  163.  #------------------------------------------------------#
  164.  
  165. elsif splitted[3] == ":!cwon" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  166.             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
  167.             $botstatus = 0
  168.   elsif splitted[3] == ":!cwoff" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  169.       ircmsg(sock, mainchan, "Bot Status: 4OFF")
  170.             $botstatus = 1      
  171.  
  172.  #------------------------------------------------------#
  173.  #                       !spamon / !spamoff                   #
  174.  #------------------------------------------------------#
  175.  
  176.   elsif splitted[3] == ":!spamon" && splitted[2] == mainchan
  177.       ircmsg(sock,mainchan,"Clan war spamming on!")
  178.       $spamon = 1
  179.   elsif splitted[3] == ":!spamoff" && splitted[2] == mainchan
  180.       ircmsg(sock,mainchan,"Clan war spamming off!")
  181.       $spamon =0
  182.  
  183.  #------------------------------------------------------#
  184.  #                       Admin Commands                      #
  185.  #------------------------------------------------------#
  186.  
  187. #-----------------------!admlist-----------------------#
  188.  
  189.   elsif splitted[3] == ":!admlist" || splitted[3] ==":!admins" || splitted[3] ==":!adminlist" && splitted[2] == mainchan
  190.       i = 0
  191.       while $admins[i]
  192.          ircmsg(sock,mainchan,"["+i.to_s+"-"+(i+1).to_s+"] ("+$admins[i]+") "+$admins[i+1])
  193.         i+= 2
  194.   end
  195.  
  196. #-------------------------!admin--------------------#
  197.  
  198.   elsif splitted[3] == ":!admin" && isadmi($admins,id) == 1 || splitted[3] == ":!adm" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  199.         text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  200.         sock.print("WHOIS "+ text+"\r\n")
  201.         msg = sock.gets.chomp
  202.         gethm = msg.split(" ")
  203.         hm = gethm[5].to_s
  204.         $adm = File.new("Admins.txt","a+")
  205.         $adm.puts text
  206.         $adm.puts hm
  207.         $adm.close
  208.         $adm = File.new("Admins.txt","r")
  209.         $admins = $adm.readlines
  210.         $adm.close
  211.         $admins.chomp!
  212.         ircmsg(sock,mainchan,"User 7"+text+" 1has been successfully added to admins!")
  213.        
  214. #-----------------------!admindel----------------------#
  215.        
  216.   elsif splitted[3] == ":!deladm" && isadmi($admins,id) == 1 || splitted[3] ==":!deladmin"  && isadmi(admins,id) == 1 && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  217.     text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  218.     txt = text.to_i
  219.     $admins.delete_at(txt)
  220.    
  221.     $admins.delete_at(txt)
  222.     $admins.compact!
  223.     cw = File.new("admins.txt","w+")
  224.     i = 0
  225.     ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
  226.     while($admins[i])
  227.         cw.puts $admins[i]
  228.         i+=1
  229.     end
  230.     cw.close
  231.     cw = File.new("admins.txt","r")
  232.     $admins = cw.readlines
  233.     cw.close
  234.     $admins.chomp!  
  235.  
  236. #-----------------------!recspam----------------------#
  237.  
  238.   # elsif splitted[3] == ":!recspamon" && splitted[2] == mainchan
  239.      # ircmsg(sock,mainchan,"Recuite spamming 9 ON!")
  240.     #  recon = 1
  241.      
  242.    #while recon == 0
  243.    #   ispm = File.new("recspams.txt","r")
  244.     #  $iws = ispm.readlines
  245.    #   ispm.close
  246.   #    $iws.shuffle!
  247.    #   ircmsg(sock,"#eclipse.priv",$iws[0])
  248.   #  ircmsg(sock,"#sna.gather",$iws[0])
  249.     #  ircmsg(sock,"#nasoldat",$iws[0])
  250.      # sleep 30
  251.   #  end
  252.    
  253.  #    elsif splitted[3] == ":!recspamoff" && splitted[2] == mainchan
  254.   #    recon == 0
  255. #      ircmsg(sock,mainchan,"Recuite spamming 4 OFF!")
  256.  
  257.  
  258.        
  259.          
  260.  
  261. #-------------------------!admintest-------------------#
  262.  
  263.   elsif splitted[3] == ":!admtest" && isadmi($admins,id) == 1 || splitted[3] ==":!admintest" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  264.       ircmsg(sock,mainchan,"Admin functional.")
  265.  
  266. #---------------------------!whois----------------------#
  267.  
  268.   elsif splitted[3] == ":!whois" && splitted[2] == mainchan
  269.       ircmsg(sock,mainchan,"id is: "+id)
  270.      
  271.        
  272. #----------------------!roster (private channel)---------------------#
  273.  
  274. elsif splitted[3] == ":!Members" || splitted[3] == ":!Roster" || splitted[3] == ":!roster" && splitted[2] == mainchan
  275.                 l = File.open("leader.txt","r")
  276.         leaders = l.readlines
  277.         l.close
  278.         leaders.chomp!
  279.         roster = "0«]0,1[» 1« 14« 5L14eader:14» 0-4 "
  280.        
  281.         i = 0
  282.        
  283.         while(leaders[i])
  284.             roster += leaders[i]+" 0-4,1 "
  285.             i+= 1
  286.         end
  287.         m = File.open("member.txt","r")
  288.         members = m.readlines
  289.         m.close
  290.         members.chomp!
  291.         roster += "0«]0,1[»1«14«5M14embers:5» 0-4 "
  292.        
  293.         i=0
  294.        
  295.         while(members[i])
  296.             roster += members[i]+" 0-4,1 "
  297.             i+= 1
  298.         end
  299.         t = File.open("trial.txt","r")
  300.         trials = t.readlines
  301.         t.close
  302.         trials.chomp!
  303.         roster += " 0«]0[» 15«5T14rials:15» 0-4 "
  304.        
  305.         i=0
  306.        
  307.         while(trials[i])
  308.             roster += trials[i]+" 0-4,1 "
  309.             i+=1
  310.           end
  311.         i = File.open("inactive.txt","r")
  312.         inactive = i.readlines
  313.         i.close
  314.         inactive.chomp!
  315.         roster += ""
  316.        
  317.         i=0
  318.        
  319.         while(inactive[i])
  320.             roster += inactive[i]+"  "
  321.             i+=1
  322.           end
  323.                 roster += " 0«][» 5«5R14ecruiting:5» 9ON 0«]"
  324.         ircmsg(sock,mainchan, roster)
  325.        
  326.  
  327.        
  328. #----------------------!addleader-----------------#
  329.  
  330. elsif splitted[3] == ":!addleader"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  331.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  332.         spamfile = File.new("leader.txt","a+")
  333.         spamfile.puts text
  334.         spamfile.close
  335.            spm = File.new("leader.txt","r")
  336.            $roslead = spm.readlines
  337.         spm.close
  338.       ircmsg(sock,mainchan,"Leader has been successfully added to roster.")
  339.  
  340. #----------------------!addmember-------------------#
  341.  
  342. elsif splitted[3] == ":!addmember"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  343.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  344.         spamfile = File.new("member.txt","a+")
  345.         spamfile.puts text
  346.         spamfile.close
  347.            spm = File.new("member.txt","r")
  348.            $rosmem = spm.readlines
  349.         spm.close
  350.       ircmsg(sock,mainchan,"Member has been successfully added to roster.")
  351.  
  352. #-------------------------!addtrial-------------------#
  353.  
  354. elsif splitted[3] == ":!addtrial"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  355.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  356.         spamfile = File.new("trial.txt","a+")
  357.         spamfile.puts text
  358.         spamfile.close
  359.            spm = File.new("trial.txt","r")
  360.            $rostri = spm.readlines
  361.         spm.close
  362.       ircmsg(sock,mainchan,"Trial has been successfully added to roster.")
  363.      
  364. #-------------------------!addinactive-------------------#
  365.  
  366. elsif splitted[3] == ":!addinactive"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  367.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  368.         spamfile = File.new("inactive.txt","a+")
  369.         spamfile.puts text
  370.         spamfile.close
  371.            spm = File.new("inactive.txt","r")
  372.            $rostri = spm.readlines
  373.         spm.close
  374.       ircmsg(sock,mainchan,"Inactive has been successfully added to roster.")
  375.  
  376. #-------------------------!delleader------------------#
  377.  
  378. elsif splitted[3] == ":!delleader" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  379.         txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  380.         l = File.open("leader.txt","r")
  381.         leaders = l.readlines
  382.         leaders.chomp!
  383.         l.close
  384.        
  385.         i = 0
  386.           if leaders.include?(txt) == false
  387.             ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
  388.            
  389.           else
  390.             leaders.delete(txt)
  391.             leaders.compact!
  392.             ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
  393.             l = File.new("leader.txt","w+")
  394.             while(leaders[i])
  395.                l.puts leaders[i]
  396.                i+=1
  397.             end
  398.            l.close
  399.           end
  400.        
  401. #-------------------------!delmember------------------#
  402.  
  403. elsif splitted[3] == ":!delmember" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  404.         txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  405.         m = File.open("member.txt","r")
  406.         members = m.readlines
  407.         members.chomp!
  408.         m.close
  409.        
  410.         i = 0
  411.           if members.include?(txt) == false
  412.             ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
  413.            
  414.           else
  415.             members.delete(txt)
  416.             members.compact!
  417.             ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
  418.             m = File.new("member.txt","w+")
  419.             while(members[i])
  420.                m.puts members[i]
  421.                i+=1
  422.             end
  423.            m.close
  424.           end
  425.        
  426. #-------------------------!deltrial--------------------#
  427.  
  428. elsif splitted[3] == ":!deltrial" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  429.         txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  430.         t = File.open("trial.txt","r")
  431.         trials = t.readlines
  432.         trials.chomp!
  433.         t.close
  434.        
  435.         i = 0
  436.           if trials.include?(txt) == false
  437.             ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
  438.            
  439.           else
  440.             trials.delete(txt)
  441.             trials.compact!
  442.             ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
  443.             t = File.new("trial.txt","w+")
  444.             while(trials[i])
  445.                t.puts trials[i]
  446.                i+=1
  447.             end
  448.            t.close
  449.          end
  450.          
  451. #-------------------------!axeinactive--------------------#
  452.  
  453. elsif splitted[3] == ":!delinactive" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  454.         txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  455.         k = File.open("inactive.txt","r")
  456.         inactive = k.readlines
  457.         inactive.chomp!
  458.         k.close
  459.        
  460.         i = 0
  461.           if inactive.include?(txt) == false
  462.             ircmsg(sock,mainchan,"Member '"+txt+"' does not exist.")
  463.            
  464.           else
  465.             inactive.delete(txt)
  466.             inactive.compact!
  467.             ircmsg(sock,mainchan,"Roster member ["+txt+"] has been deleted.")
  468.             k = File.new("inactive.txt","w+")
  469.             while(inactive[i])
  470.                k.puts inactive[i]
  471.                i+=1
  472.             end
  473.            k.close
  474.          end
  475.  
  476.    
  477.      
  478.  #------------------------------------------------------#
  479.  #                             !backup                             #
  480.  #------------------------------------------------------#
  481.  
  482.     elsif splitted[3] == ":!backup" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  483.       File.copy("Commands.rb","CommandsB.rb")
  484.       ircmsg(sock,mainchan,"File Backed up.")
  485.    
  486.  #------------------------------------------------------#
  487.  #                            !remote                             #
  488.  #------------------------------------------------------#
  489.    
  490.     #elsif splitted[3] == ":!remote"  && isadmi($admins,id) == 1  && splitted[2] == mainchan
  491.       #text = text[8, text.length]
  492.                 #solmsg(solsock, text)
  493.      
  494.  #------------------------------------------------------#
  495.  #                       Spam: "SCTFL"                        #
  496.  #------------------------------------------------------#
  497.    
  498.     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
  499.       txt = text[splitted[3].size-1,text.length]
  500.       message = splitted[3]
  501.       message.delete!(":")
  502.       $replyed = user
  503.        if text.empty? == false
  504.           ircmsg(sock,mainchan,"11,01Cw ->(04"+user+"11) (04"+splitted[2]+"11) 00,01"+message + txt)
  505.         else
  506.           ircmsg(sock,mainchan,"11,01Cw ->(04"+user+"11) (04"+splitted[2]+"11) 00,01"+message)
  507.     end
  508.  
  509.  #------------------------------------------------------#
  510.  #                      Private Messaging                     #
  511.  #------------------------------------------------------#
  512.  
  513.     elsif splitted[1] == "PRIVMSG" && splitted[2] == $botnick
  514.             #in case someone tries to login as admin
  515.             if(splitted[3] == ":!adminlog")
  516.                 if isadmi(admins,user) == 0
  517.                     if splitted[4] == $adminlog
  518.                         admins = addadmi(admins,id)
  519.                         ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 was successfuly added to admins list...")
  520.                     else
  521.                         ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 tryed to login with an incorrect password...")
  522.                     end
  523.                 elsif isadmi(admins,user) == 1
  524.                     ircmsg(sock, user, "5(Admin) 4"+user+"1 is already an admin...")
  525.                 end
  526.      
  527.     elsif $botstatus == 1
  528.       ircmsg(sock, user, "Bot Off")    
  529.    
  530.     elsif $botstatus == 0
  531.       # txt = text[(5 + splitted[4].length), text.length]
  532.       $replyed = splitted[4]
  533.       ircmsg(sock, mainchan, "4,1(0PM4) 0"+user+"4:0 "+text+"")
  534.       $replyed = user
  535.       $host = id
  536.     end      
  537.  
  538.  #------------------------------------------------------#
  539.  #                         CW Commands                       #
  540.  #------------------------------------------------------#
  541.  
  542.  #-------------------------!cw-------------------------#
  543.  
  544. elsif splitted[3] == ":!cw" && splitted[2] == mainchan
  545.       ispm = File.new("cwspams.txt","r")
  546.       $cws = ispm.readlines
  547.       ispm.close
  548.       $cws.shuffle!
  549.     ircmsg(sock,"#soldat.match",$cws[0])
  550.      ircmsg(sock,"#nasoldat",$cws[0])
  551.      ircmsg(sock,"#sna.gather",$cws[0])
  552.      ircmsg(sock,"#bro.soldat",$cws[0])
  553.      ircmsg(sock,"#lod.soldat",$cws[0])
  554.      ircmsg(sock,"#oxid",$cws[0])
  555.      ircmsg(sock,"#pz.soldat",$cws[0])
  556.      ircmsg(sock,"#fost.channel",$cws[0])
  557.      ircmsg(sock,"#`v4rl-00ck",$cws[0])
  558.    
  559. #-------------------------!addcw----------------------#
  560.  
  561. elsif splitted[3] == ":!addcw"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  562.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  563.         spamfile = File.new("cwspams.txt","a+")
  564.         spamfile.puts text
  565.         spamfile.close
  566.            spm = File.new("cwspams.txt","r")
  567.            $cws = spm.readlines
  568.         spm.close
  569.       ircmsg(sock,mainchan,"Your spam has been added.")
  570.  
  571. #-------------------------!delcw----------------------#
  572.  
  573. elsif splitted[3] == ":!delcw" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  574.     text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  575.     txt = text.to_i
  576.     $cws.delete_at(txt)
  577.     $cws.compact!
  578.     cw = File.new("cwspams.txt","w+")
  579.     i = 0
  580.     ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
  581.     while($cws[i])
  582.         cw.puts $cws[i]
  583.         i+=1
  584.     end
  585.     cw.close
  586.     cw = File.new("cwspams.txt","r")
  587.     $cws = cw.readlines
  588.     cw.close
  589.     $cws.chomp!
  590.  
  591. #-------------------------!cwlist-----------------------#
  592.  
  593. elsif splitted[3] == ":!cwlist" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  594.        i=0
  595.          while($cws[i])
  596.            ircmsg(sock,mainchan,"["+i.to_s+"] "+$cws[i])
  597.        i+=1
  598.      end
  599.      
  600. #-----------------------------------------------------#
  601. #                    SCTFL commands                       #
  602. #-----------------------------------------------------#
  603.  
  604.  #-------------------------!sctfl-------------------------#
  605.  
  606. elsif splitted[3] == ":!sctfl" && splitted[2] == mainchan
  607.       ispm = File.new("sctfl.txt","r")
  608.       $scws = ispm.readlines
  609.       ispm.close
  610.       $scws.shuffle!
  611.       ircmsg(sock,"#soldat.match",$cws[0])
  612.       ircmsg(sock,"#nasoldat",$cws[0])
  613.       ircmsg(sock,"#sna.gather",$cws[0])
  614.       ircmsg(sock,"#bro.soldat",$cws[0])
  615.       ircmsg(sock,"#lod.soldat",$cws[0])
  616.       ircmsg(sock,"#oxid",$cws[0])
  617.       ircmsg(sock,"#bro.soldat",$cws[0])
  618.       ircmsg(sock,"#pz.soldat",$cws[0])
  619.       ircmsg(sock,"#fost.channel",$cws[0])
  620.       ircmsg(sock,"#soldat.gather.nordic",$cws[0])
  621.       ircmsg(sock,"#soldat.mapping",$cws[0])
  622.       ircmsg(sock,"#`v4rl-00ck",$cws[0])
  623. #-------------------------!addcw----------------------#
  624.  
  625. elsif splitted[3] == ":!addsctfl"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  626.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  627.         spamfile = File.new("sctfl.txt","a+")
  628.         spamfile.puts text
  629.         spamfile.close
  630.            spm = File.new("sctfl.txt","r")
  631.            $scws = spm.readlines
  632.         spm.close
  633.       ircmsg(sock,mainchan,"Your spam has been added.")
  634.  
  635. #-------------------------!delcw----------------------#
  636.  
  637. elsif splitted[3] == ":!delsctfl" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  638.     text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  639.     txt = text.to_i
  640.     $scws.delete_at(txt)
  641.     $scws.compact!
  642.     sc = File.new("sctfl.txt","w+")
  643.     i = 0
  644.     ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
  645.     while($scws[i])
  646.         sc.puts $scws[i]
  647.         i+=1
  648.     end
  649.     sc.close
  650.     sc = File.new("sctfl.txt","r")
  651.     $scws = sc.readlines
  652.     sc.close
  653.     $scws.chomp!
  654.  
  655. #-------------------------!cwlist-----------------------#
  656.  
  657. elsif splitted[3] == ":!sctfllist" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  658.        i=0
  659.          while($scws[i])
  660.            ircmsg(sock,mainchan,"["+i.to_s+"] "+$scws[i])
  661.        i+=1
  662. end
  663.      
  664.  #------------------------------------------------------#
  665.  #                         Idle Commands                       #
  666.  #------------------------------------------------------#
  667.  
  668.  #-------------------------!idle------------------------#
  669.  
  670. elsif splitted[3] == ":!idle" && splitted[2] == mainchan
  671.      ispm = File.new("idlespam.txt","r")
  672.       $iws = ispm.readlines
  673.       ispm.close
  674.       $iws.shuffle!
  675.       ircmsg(sock,"#soldat.match",$iws[0])
  676.       ircmsg(sock,"#sna.gather",$iws[0])
  677.       ircmsg(sock,"#nasoldat",$iws[0])
  678.       ircmsg(sock,"#lod.soldat",$iws[0])
  679.       ircmsg(sock,"#oxid",$iws[0])
  680.       ircmsg(sock,"#pz.soldat",$iws[0])
  681.       ircmsg(sock,"#fost.channel",$iws[0])
  682.       ircmsg(sock,"#soldat.gather.nordic",$iws[0])
  683.       ircmsg(sock,"#soldat.mapping",$iws[0])
  684.  #-------------------------!addidle---------------------#
  685.      
  686. elsif splitted[3] == ":!addidle"&& splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  687.       text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  688.       ispamfile = File.new("idlespam.txt","a+")
  689.       ispamfile.puts text
  690.       ispamfile.close
  691.       ispm = File.new("idlespam.txt","r")
  692.       $iws = ispm.readlines
  693.       ispm.close
  694.       ircmsg(sock,mainchan,"Your spam has been added.")
  695.            
  696.    #-------------------------!delidle---------------------#
  697.    
  698. elsif splitted[3] == ":!delidle" && splitted[2] && isadmi($admins,id) == 1 && splitted[2] == mainchan
  699.     text = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  700.     txt = text.to_i
  701.     $iws.delete_at(txt)
  702.     $iws.compact!
  703.     cw = File.new("idlespam.txt","w+")
  704.     i = 0
  705.     ircmsg(sock,mainchan,"Slot ["+txt.to_s+"] has been deleted.")
  706.       while($iws[i])
  707.         cw.puts $iws[i]
  708.         i+=1
  709. end
  710.     cw.close
  711.     cw = File.new("idlespam.txt","r")
  712.     $iws = cw.readlines
  713.     cw.close
  714.     $iws.chomp!
  715.      
  716.  #-----------------------!idlelist-----------------------#
  717.  
  718. elsif splitted[3] == ":!idlelist" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  719.        i=0
  720.          while($iws[i])
  721.            ircmsg(sock,mainchan,"["+i.to_s+"] "+$iws[i])
  722.        i+=1
  723. end
  724.      
  725.  #------------------------------------------------------#
  726.  #                             Auto-idle                          #
  727.  #------------------------------------------------------#
  728.  
  729.  elsif splitted[3] ==":!idleon" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  730.     $idleon = 1
  731.     $idletime = Time.now
  732.     #$nextidle = $idletime - (1)
  733.     ircmsg(sock,mainchan,"Auto-idle spamming: ON!")
  734.    
  735.     while $idleon == 1
  736.       ircmsg(sock,mainchan,"SUP")
  737.       sleep 10
  738.       $idle == 0
  739.       end
  740.      
  741.     if $idle1 == 1
  742.      ircmsg(sock,mainchan,"SUP2")
  743.       sleep 10
  744.       $idle1 == 0
  745.       $idle2 == 1
  746.       end
  747.      
  748.     if $idle2 == 1
  749.      ircmsg(sock,mainchan,"SUP3")
  750.       sleep 10
  751.       $idle2 == 0
  752.       $idle1 == 1
  753.       end
  754.          
  755. elsif splitted[3] == ":!idleoff" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  756.     $idleon == 0
  757.     $idle1 == 0
  758.     $idle2 == 0
  759.     ircmsg(sock,mainchan,"Auto-idle spamming: OFF!")
  760.      
  761.  #------------------------------------------------------#
  762.  #                         !pm / !reply                           #
  763.  #------------------------------------------------------#
  764.      
  765.         elsif splitted[3] == ":!pm" && splitted[2]  && splitted[2]== mainchan
  766.      
  767.             txt = text[(5 + splitted[4].length), text.length]
  768.       $replyed = splitted[4]
  769.             ircmsg(sock,mainchan ,"2,15[4"+user+"2]4 says to2: [4"+splitted[4]+"2]:4 "+txt+"")
  770.       ircmsg(sock, splitted[4],"2,15[4"+user+"2]4 says2: 4"+txt)
  771.          
  772.     elsif splitted[3] == ":!reply" || splitted[3] ==":!r" && splitted[2] && splitted[2] == mainchan
  773.       txt = text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ]
  774.       ircmsg(sock, $replyed,"2,15[4"+user+"2]4 says2: 4"+txt)
  775.       ircmsg(sock, mainchan,"2,15[4"+user+"2]4 says to2: [4"+$replyed+"2]:4 "+txt+"")
  776.        
  777.  #------------------------------------------------------#
  778.  #                             Record                             #
  779.  #------------------------------------------------------#
  780.      
  781. #-----------------------!record------------------------#
  782.  
  783.  elsif splitted[3] == ":!record" && splitted[2] == "#eclipsed"
  784.         rec = File.open("Record.txt","r")
  785.         $record = rec.readlines
  786.         rec.close
  787.         $record.chomp!
  788.         w = $record[0].to_f
  789.         t = $record[1].to_f
  790.         l = $record[2].to_f
  791.         wr = ((w / (w+t+l))*100).to_i
  792.        
  793.         if wr >= 60
  794.             twr = "9 "+wr.to_s
  795.         elsif wr >= 49 && wr <60
  796.             twr = "8 "+wr.to_s
  797.         elsif wr < 49
  798.             twr = "4 "+wr.to_s
  799.         end
  800.         wr = twr
  801.         wl = ((w / (w+l))*100).to_i
  802.        
  803.         if wl >= 60
  804.             twl = "9 "+wl.to_s
  805.         elsif wl >= 49 && wl <60
  806.             twl = "8 "+wl.to_s
  807.         elsif wl < 49
  808.             twl = "4 "+wl.to_s
  809.         end
  810.         wl = twl
  811.         w = $record[0].to_i
  812.         t = $record[1].to_i
  813.         l = $record[2].to_i
  814.                
  815.         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«]")
  816.        
  817. #-----------------------!record (priv)------------------------#
  818.  
  819.  elsif splitted[3] == ":!record" && splitted[2] == mainchan
  820.         rec = File.open("Record.txt","r")
  821.         $record = rec.readlines
  822.         rec.close
  823.         $record.chomp!
  824.         w = $record[0].to_f
  825.         t = $record[1].to_f
  826.         l = $record[2].to_f
  827.         wr = ((w / (w+t+l))*100).to_i
  828.        
  829.         if wr >= 60
  830.             twr = "9 "+wr.to_s
  831.         elsif wr >= 49 && wr <60
  832.             twr = "8 "+wr.to_s
  833.         elsif wr < 49
  834.             twr = "4 "+wr.to_s
  835.         end
  836.         wr = twr
  837.         wl = ((w / (w+l))*100).to_i
  838.        
  839.         if wl >= 60
  840.             twl = "9 "+wl.to_s
  841.         elsif wl >= 49 && wl <60
  842.             twl = "8 "+wl.to_s
  843.         elsif wl < 49
  844.             twl = "4 "+wl.to_s
  845.         end
  846.         wl = twl
  847.         w = $record[0].to_i
  848.         t = $record[1].to_i
  849.         l = $record[2].to_i
  850.                
  851.         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«]")
  852.        
  853.   #-----------------------!addwinb------------------------#
  854.    
  855.   elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!addwinb"
  856.        win = $record[0].to_f
  857.        win += 1      
  858.        rec = File.open("Record.txt","r+")
  859.        rec.puts win  
  860.        rec.puts $record[1]
  861.        rec.puts $record[2]
  862.        rec.close
  863.        rec = File.open("Record.txt","r")
  864.        $record = rec.readlines
  865.        rec.close
  866.        ircmsg(sock,mainchan, "Win added, record updated.")
  867.        $record.chomp!
  868.      
  869.   #-----------------------!addwin------------------------#
  870.  
  871.   elsif isadmi($admins,id) == 1 && splitted[2]&& splitted[2] == mainchan && splitted[3] == ":!addwin"
  872.         t = "9"
  873.         if text.empty? == true
  874.             txt = (t+"None")
  875.         else        
  876.             txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
  877.         end
  878.        win = $record[0].to_f
  879.        win += 1
  880.        
  881.        rec = File.open("Record.txt","r+")
  882.        rec.puts win  
  883.        rec.puts $record[1]
  884.        rec.puts $record[2]
  885.        rec.puts txt
  886.        rec.close
  887.        rec = File.open("Record.txt","r")
  888.        $record = rec.readlines
  889.        rec.close
  890.        ircmsg(sock,mainchan, "Win added, record updated.")
  891.        $record.chomp!
  892.    
  893.   #-----------------------!addtieb------------------------#
  894.    
  895.     elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addtieb"
  896.        
  897.        
  898.         tie = $record[1].to_f
  899.         tie += 1
  900.         rec = File.open("Record.txt","r+")
  901.         rec.puts $record[0]
  902.         rec.puts tie
  903.         rec.puts $record[2]
  904.         rec.close
  905.         rec = File.open("Record.txt","r")
  906.         $record = rec.readlines
  907.         rec.close
  908.         ircmsg(sock,mainchan, "Tie added, record updated.")
  909.         $record.chomp!
  910.    
  911.   #-----------------------!addtie------------------------#
  912.    
  913.     elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addtie"
  914.         t = "8"
  915.         if text.empty? == true
  916.             txt = (t+"None")
  917.         else        
  918.             txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
  919.         end
  920.        
  921.         tie = $record[1].to_f
  922.         tie += 1
  923.         rec = File.open("Record.txt","r+")
  924.         rec.puts $record[0]
  925.         rec.puts tie
  926.         rec.puts $record[2]
  927.         rec.puts txt
  928.         rec.close
  929.         rec = File.open("Record.txt","r")
  930.         $record = rec.readlines
  931.         rec.close
  932.         ircmsg(sock,mainchan, "Tie added, record updated.")
  933.         $record.chomp!
  934.        
  935.   #-----------------------!addlossb------------------------#
  936.    
  937.     elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addlossb"
  938.        
  939.         loss = $record[2].to_f
  940.         loss += 1
  941.         rec = File.open("Record.txt","r+")
  942.         rec.puts $record[0]
  943.         rec.puts $record[1]
  944.         rec.puts loss
  945.         rec.close
  946.         rec = File.open("Record.txt","r")
  947.         $record = rec.readlines
  948.         rec.close
  949.         ircmsg(sock,mainchan, "Loss added, record updated.")
  950.        $record.chomp!    
  951.      
  952.   #-----------------------!addloss------------------------#
  953.    
  954.     elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addloss"
  955.         t = "4"
  956.         if text.empty? == true
  957.             txt = (t+"None")
  958.         else        
  959.             txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
  960.         end
  961.         loss = $record[2].to_f
  962.         loss += 1
  963.         rec = File.open("Record.txt","r+")
  964.         rec.puts $record[0]
  965.         rec.puts $record[1]
  966.         rec.puts loss
  967.         rec.puts txt
  968.         rec.close
  969.         rec = File.open("Record.txt","r")
  970.         $record = rec.readlines
  971.         rec.close
  972.         ircmsg(sock,mainchan, "Loss added, record updated.")
  973.        $record.chomp!
  974.        
  975.   #-----------------------!delwin------------------------#
  976.        
  977.     elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delwin"
  978.    
  979.        win = $record[0].to_i
  980.        win -= 1
  981.        rec = File.new("Record.txt","r+")
  982.        rec.puts win  
  983.        rec.puts $record[1].to_i
  984.        rec.puts $record[2].to_i
  985.        rec.close
  986.        rec = File.new("Record.txt","r")
  987.        $record = rec.readlines
  988.        rec.close
  989.        ircmsg(sock,mainchan, "Win removed, record updated.")
  990.        $record.chomp!
  991.    
  992.   #-----------------------!deltie------------------------#  
  993.    
  994.     elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!deltie"
  995.         tie = $record[1].to_i
  996.         tie -= 1
  997.         rec = File.new("Record.txt","r+")
  998.         rec.puts $record[0].to_i
  999.         rec.puts tie
  1000.         rec.puts $record[2].to_i
  1001.         rec.close
  1002.         rec = File.new("Record.txt","r")
  1003.         $record = rec.readlines
  1004.         rec.close
  1005.         ircmsg(sock,mainchan, "Tie removed, record updated.")
  1006.         $record.chomp!
  1007.      
  1008.   #-----------------------!delloss------------------------#
  1009.    
  1010.     elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delloss"
  1011.         loss = $record[2].to_i
  1012.         loss -= 1
  1013.         rec = File.new("Record.txt","r+")
  1014.         rec.puts $record[0].to_i
  1015.         rec.puts $record[1].to_i
  1016.         rec.puts loss
  1017.         rec.close
  1018.         rec = File.new("Record.txt","r")
  1019.         $record = rec.readlines
  1020.         rec.close
  1021.         ircmsg(sock,mainchan, "Loss removed, record updated.")
  1022.        $record.chomp!
  1023.  
  1024.  #-----------------------!addtie------------------------#
  1025.  
  1026.     elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addtie"
  1027.         t = "8"
  1028.         if splitted[2].empty? == true
  1029.             txt = (t+"None")
  1030.         else        
  1031.             txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
  1032.         end
  1033.        
  1034.         tie = $record[1].to_f
  1035.         tie += 1
  1036.         rec = File.open("Record.txt","r+")
  1037.         rec.puts $record[0]
  1038.         rec.puts tie
  1039.         rec.puts $record[2]
  1040.         rec.puts txt
  1041.         rec.close
  1042.         rec = File.open("Record.txt","r")
  1043.         $record = rec.readlines
  1044.         rec.close
  1045.         ircmsg(sock,mainchan, "Tie added, record updated.")
  1046.         $record.chomp!
  1047.  
  1048.  #-----------------------!addloss------------------------#
  1049.  
  1050.     elsif isadmi($admins,id) == 1 && splitted[2] && splitted[2] == mainchan && splitted[3] == ":!addloss"
  1051.         t = "4"
  1052.         if splitted[2].empty? == true
  1053.             txt = (t+"None")
  1054.         else        
  1055.             txt = (t+text[( (splitted[3].length)-(mainchan.length)+splitted[2].length), text.length ])
  1056.         end
  1057.         loss = $record[2].to_f
  1058.         loss += 1
  1059.         rec = File.open("Record.txt","r+")
  1060.         rec.puts $record[0]
  1061.         rec.puts $record[1]
  1062.         rec.puts loss
  1063.         rec.puts txt
  1064.         rec.close
  1065.         rec = File.open("Record.txt","r")
  1066.         $record = rec.readlines
  1067.         rec.close
  1068.         ircmsg(sock,mainchan, "Loss added, record updated.")
  1069.        $record.chomp!
  1070.  
  1071.  #-----------------------!delwin------------------------#
  1072.  
  1073.        elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delwin"
  1074.    
  1075.        win = $record[0].to_i
  1076.        win -= 1
  1077.        rec = File.new("Record.txt","r+")
  1078.        rec.puts win  
  1079.        rec.puts $record[1].to_i
  1080.        rec.puts $record[2].to_i
  1081.        rec.close
  1082.        rec = File.new("Record.txt","r")
  1083.        $record = rec.readlines
  1084.        rec.close
  1085.        ircmsg(sock,mainchan, "Win removed, record updated.")
  1086.        $record.chomp!
  1087.  
  1088.  #-----------------------!deltie------------------------#
  1089.  
  1090.     elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!deltie"
  1091.         tie = $record[1].to_i
  1092.         tie -= 1
  1093.         rec = File.new("Record.txt","r+")
  1094.         rec.puts $record[0].to_i
  1095.         rec.puts tie
  1096.         rec.puts $record[2].to_i
  1097.         rec.close
  1098.         rec = File.new("Record.txt","r")
  1099.         $record = rec.readlines
  1100.         rec.close
  1101.         ircmsg(sock,mainchan, "Tie removed, record updated.")
  1102.         $record.chomp!
  1103.  
  1104.  #-----------------------!delloss------------------------#
  1105.  
  1106.     elsif isadmi($admins,id) == 1 && splitted[2] == mainchan && splitted[3] == ":!delloss"
  1107.         loss = $record[2].to_i
  1108.         loss -= 1
  1109.         rec = File.new("Record.txt","r+")
  1110.         rec.puts $record[0].to_i
  1111.         rec.puts $record[1].to_i
  1112.         rec.puts loss
  1113.         rec.close
  1114.         rec = File.new("Record.txt","r")
  1115.         $record = rec.readlines
  1116.         rec.close
  1117.         ircmsg(sock,mainchan, "Loss removed, record updated.")
  1118.        $record.chomp!
  1119.        
  1120. #------------------------------------------------------#
  1121. #-                         !commands                            #
  1122. #------------------------------------------------------#
  1123.  
  1124. 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"
  1125.   ircmsg(sock,"#eclipsed","0,1[» 5«7,1Commands:5» 4!7record 0«]")
  1126.  
  1127. #----------add new commands ABOVE this line -----#
  1128.    
  1129.     end
  1130.     end
  1131.    
  1132.  #------------------------------------------------------#
  1133.  #                    Error: Reload/Backup                  #
  1134.  #------------------------------------------------------#    
  1135.  
  1136.     rescue StandardError, SyntaxError, NameError, NoMethodError, TypeError, Exception => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError
  1137.       puts "Error!: "+error
  1138.       ircmsg(sock,mainchan,"Error!: "+error)
  1139.       ircmsg(sock,mainchan,"Error!: "+error.backtrace.inspect);
  1140.       load("CommandsB.rb")
  1141.       ircmsg(sock,mainchan,"Reloaded Backup file.")
  1142.     else
  1143.      
  1144. end
  1145.  
  1146.  #------------------------------------------------------#
  1147.  #                              !reload                            #
  1148.  #------------------------------------------------------#    
  1149.  
  1150. def Reload(sock,splitted,mainchan,admins,id)
  1151.  
  1152.   if splitted[3] == ":!reload" && isadmi($admins,id) == 1 && splitted[2] == mainchan
  1153.       begin
  1154.           load("Receive.rb")
  1155.           load("Commands.rb")
  1156.           ircmsg(sock,mainchan,"Reloaded!")
  1157.       rescue StandardError, SyntaxError, NameError, NoMethodError, TypeError, Exception => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError => error#StandardError, SyntaxError, NameError, NoMethodError, TypeError
  1158.           puts "Error!: "+error
  1159.           ircmsg(sock,mainchan,"Error!: "+error)
  1160.           ircmsg(sock,mainchan,"Error!: "+error.backtrace.inspect);          
  1161.           load("CommandsB.rb")
  1162.           load("backup.rb")
  1163.           ircmsg(sock,mainchan,"Reloaded Backup file.")
  1164.       ensure
  1165.           load("Receive.rb")
  1166.         end
  1167.   end
  1168. end
  1169.  
  1170.  #------------------------------------------------------#
  1171.  #                Server Commands/Old code               #
  1172.  #------------------------------------------------------#
  1173.  
  1174. =begin
  1175. def Commands(splitted, mainchan)
  1176.    
  1177.    
  1178.        
  1179.         elsif splitted[3] == ":!botoff" && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1180.             ircmsg(sock, mainchan, "Bot Status: 4OFF")
  1181.             botstatus = 1
  1182. =begin
  1183.     elsif splitted[3] == ":!record" && splitted[2] == mainchan
  1184.       ircmsg(sock,mainchan,"0,1 Current record is0 wins:9 "+r1+" 0Ties:8 "+r2+" 0Losses:4 "+r3+" ")
  1185.      
  1186.    
  1187.     elsif isadmi(admins,id) == True && splitted[2] == mainchan && splitted[3] == ":!addwin"
  1188.      
  1189.       win = record[0].to_i
  1190.       win += 1
  1191.       rec = File.new("Record.txt","w+")
  1192.       rec.puts win  
  1193.       rec.puts r2
  1194.       rec.puts r3
  1195.       rec.close
  1196.       rec = File.new("Record.txt","r")
  1197.       record = rec.readlines
  1198.       rec.close
  1199.       ircmsg(sock,mainchan, "Win added, record updated.")
  1200.       r1 = record[0]
  1201.       r2 = record[1]
  1202.       r3 = record[2]
  1203.       record.chomp!
  1204.    
  1205.     elsif isadmi(admins,id) == True && splitted[2] == mainchan && splitted[3] == ":!addtie"
  1206.       tie = record[1].to_i
  1207.       tie += 1
  1208.       rec = File.new("Record.txt","w+")
  1209.       rec.puts r1
  1210.       rec.puts tie
  1211.       rec.puts r3
  1212.       rec.close
  1213.       rec = File.new("Record.txt","r")
  1214.       record = rec.readlines
  1215.       rec.close
  1216.       ircmsg(sock,mainchan, "Tie added, record updated.")
  1217.       r1 = record[0]
  1218.       r2 = record[1]
  1219.       r3 = record[2]
  1220.       record.chomp!
  1221.      
  1222.     elsif isadmi(admins,id) == True && splitted[2] == mainchan && splitted[3] == ":!addloss"
  1223.       loss = record[2].to_i
  1224.       loss += 1
  1225.       rec = File.new("Record.txt","w+")
  1226.       rec.puts r1
  1227.       rec.puts r2
  1228.       rec.puts loss
  1229.       rec.close
  1230.       rec = File.new("Record.txt","r")
  1231.       record = rec.readlines
  1232.       rec.close
  1233.       ircmsg(sock,mainchan, "Loss added, record updated.")
  1234.       r1 = record[0]
  1235.       r2 = record[1]
  1236.       r3 = record[2]
  1237.       record.chomp!
  1238. #=end
  1239. #------------------------------------------------------------------------------------------------------------
  1240. #To auto voice or auto op people that join the chan, need to have op first otherwise bot freaksout.    
  1241. #---------------------------------------------------------------------------------------------------------------
  1242.     #If you are an admin on the bot, the bot will give you +o
  1243.     elsif splitted[1] == "JOIN" && isadmi(admins,id) == 1 && splitted[2] == mainchan && user
  1244.       sock.print("MODE #[DC] +o "+user+"\r\n")
  1245.      
  1246.     #Otherwise the bot gives you +v
  1247.     elsif splitted[1] == "JOIN" && splitted[2] == mainchan && user      
  1248.           sock.print("MODE #[DC] +v " +user+"\r\n")
  1249.  
  1250. #--------------------------------------------------------------
  1251. # System for adding quotes to the bot. Huzzah!
  1252. #--------------------------------------------------------------
  1253.      
  1254.     elsif splitted[3] == ":!addqt" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1255.       text = text[(2 + splitted[2].length), text.length ]
  1256.       quote = File.new("Quote.txt","a+")
  1257.       quote.puts text
  1258.       quote.close
  1259.       quote = File.new("Quote.txt","r")
  1260.       quotes = quote.readlines
  1261.       quote.close
  1262.       ircmsg(sock,mainchan, "Quote has been added!")
  1263.     elsif splitted[3] == ":!quote" && splitted[2] == mainchan
  1264.       quotes.shuffle!
  1265.       ircmsg(sock,mainchan, quotes[0])
  1266.      
  1267.     #----Adds clan war spams to the text file through Irc, no need to hard code into bot anymore!
  1268.     #
  1269.     #-----------------------------------------------------------------------------------------------------
  1270.     elsif splitted[3] == ":!addcw"&& splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1271.       text = text[( 2 +splitted[2].length), text.length ]
  1272.       spamfile = File.new("cwspams.txt","a+")
  1273.       spamfile.puts text
  1274.       spamfile.close
  1275.       spm = File.new("cwspams.txt","r")
  1276.       cws = spm.readlines
  1277.       spm.close
  1278.       ircmsg(sock,mainchan,"Your spam has been added.")
  1279.       #spams.chomp!
  1280.      
  1281.     #----Remotely adds Admins through Irc
  1282.     #
  1283.     #------------------------------------------
  1284.     elsif splitted[3] == ":!admin" && splitted[2] && isadmi(admins,id) == 1&& splitted[2] == mainchan
  1285.       text = text[( 2+splitted[2].length), text.length ]
  1286.       adm = File.new("Admins.txt","a+")
  1287.       adm.puts text
  1288.       adm.close
  1289.       adm = File.new("Admins.txt","r")
  1290.       admins = adm.readlines
  1291.       adm.close
  1292.       admins.chomp!
  1293.       ircmsg(sock,mainchan,"4,1T6he 4U6ser 7"+text+"6 4H6as 4B6een 4A6dded 4A6s 4A6n 4A6uto 4A6dmin")
  1294.      
  1295.     elsif splitted[3] == ":!rosadd"&& splitted[4] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1296.         text = text[2+(splitted[2].length), text.length ]
  1297.         ros = File.new("Roster.txt","w+")
  1298.         ros.puts text
  1299.         ros.close
  1300.         ros = File.new("Roster.txt","r")
  1301.         roster = ros.readlines
  1302.         ros.close
  1303.         ircmsg(sock,mainchan,"7,1U6pdated!")
  1304.    
  1305.       #Request: Send a pm to the define user for an IRC request
  1306.       #
  1307.       #-----------------------------------------------------------------      
  1308.         elsif splitted[3] == ":!request" && splitted[4] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1309.             ircmsg(sock, splitted[4],"4You 1have been 4Request 1on 4IRC 1by 4"+user+" 1!4!")
  1310.             ircmsg(sock, mainchan,"5(Request) 4"+splitted[4]+" 1has been 4Request 1on 4IRC 1by 4"+user+ " 1!4!")
  1311.            
  1312.         elsif splitted[3] == ":!server" && splitted[2] == mainchan
  1313.       ircmsg(sock,mainchan,"soldat://"+solserver+":"+solport+"/"+solpass)
  1314.    
  1315.     #---------spams /amsg to all chans------------------------------------------------------------------
  1316.     #You can use this as a basis for a while loop to spam a message to all chans in the channel array
  1317.     #------------------------------------------------------------------------------------------------------
  1318.     elsif splitted[3] == ":!amsg" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1319.        txt = text[(splitted[2].length), text.length]
  1320.       i=0
  1321.         while (channels[i])        
  1322.           ircmsg(sock, channels[i],txt)
  1323.           i+= 1
  1324.         end
  1325.        
  1326.     #---Spams all chans for cw---------
  1327.     #
  1328.     #------------------------------------    
  1329.     elsif splitted[3] == ":!cw" && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1330.       cws.shuffle!
  1331.       i = 0
  1332.       while (channels[i])
  1333.         ircmsg(sock,channels[i],cws[0])
  1334.         i+=1
  1335.       end
  1336.        
  1337.     elsif splitted[3] == ":!members" || splitted[3] == ":!Members" || splitted[3] == ":!Roster" || splitted[3] == ":!roster" && splitted[2] == mainchan
  1338.         ircmsg(sock,mainchan, roster[0])
  1339.      
  1340.       #Changes server password for soldat server
  1341.       #
  1342.       #------------------------------------------      
  1343.       elsif splitted[3] == ":!pass" && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1344.        pass = pw
  1345.        solpass = pass
  1346.        ircmsg(sock,mainchan,"server pass changed to "+pass+".")
  1347.        solsock.print("/password "+pass+"\r\n")
  1348.        ircmsg(sock,mainchan,"soldat://"+solserver+":"+solport+"/"+solpass)
  1349.        
  1350.       #Resets server pass to default pass
  1351.       #
  1352.       #----------------------------------------
  1353.       elsif splitted[3] == ":!respass" && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1354.         solpass = defpass
  1355.         ircmsg(sock,mainchan,"Pass reset to "+solpass+".")
  1356.         solsock.print("/password "+defpass+"\r\n")
  1357.         ircmsg(sock,mainchan,"soldat://"+solserver+":"+solport+"/"+solpass)
  1358.        
  1359.     #----To Pm the bot with adminlog---------------------
  1360.     #
  1361.     #-------------------------------------------------------
  1362.     elsif splitted[1] == "PRIVMSG" && splitted[2] == botnick
  1363.             #in case someone tries to login as admin
  1364.             if(splitted[3] == ":!adminlog")
  1365.                 if isadmi(admins,user) == 0
  1366.                     if splitted[4] == adminlog
  1367.                         admins = addadmi(admins,id)
  1368.                         ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 was successfuly added to admins list...")
  1369.                     else
  1370.                         ircmsg(sock, mainchan, "5(Admin) 4"+user+"1 tryed to login with an incorrect password...")
  1371.                     end
  1372.                 elsif isadmi(admins,user) == 1
  1373.                     ircmsg(sock, user, "5(Admin) 4"+user+"1 is already an admin...")
  1374.                 end
  1375.        
  1376.     #----------pm functions, displays the recived pm in the main chan---------
  1377.     #
  1378.     #-----------------------------------------------------------------------------
  1379.       elsif botstatus == 1
  1380.                     ircmsg(sock, user, "Bot Off")
  1381.          
  1382.       elsif(line.index(id+"\n"))
  1383.           ircmsg(sock, user, "You have been put on the ignore list. Fuck off.")
  1384.        
  1385.             elsif(botstatus == 0  )
  1386.                 ircmsg(sock, mainchan, "4,1(0PM4) 0"+user+"4:0 "+text+"")
  1387.         replyed = user
  1388.         host = id
  1389.         end
  1390.        
  1391.       #--------------Sends a pm to someone e.g. !pm Grishnak <text>---
  1392.       #
  1393.       #-------------------------------------------------------------------
  1394.         elsif splitted[3] == ":!pm" && splitted[4] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1395.      
  1396.             txt = text[(5 + splitted[4].length), text.length]
  1397.       replyed = splitted[4]
  1398.             ircmsg(sock,mainchan ,"2,15[4"+user+"2]4 says to2: [4"+splitted[4]+"2]:4 "+txt+"")
  1399.       ircmsg(sock, splitted[4],"2,15[4"+user+"2]4 says2: 4"+txt)
  1400.      
  1401.     #----Replys to the last person to pm the bot, or the last person you Pmed--------
  1402.     #
  1403.     #---------------------------------------------------------------------------------------    
  1404.       elsif splitted[3] == ":!r" || splitted[3] ==":!r" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1405.         txt = text[(2 + splitted[2].length), text.length]
  1406.         ircmsg(sock, replyed,"2,15[4"+user+"2]4 says2: 4"+txt)
  1407.         ircmsg(sock, mainchan,"2,15[4"+user+"2]4 says to2: [4"+replyed+"2]:4 "+txt+"")
  1408.        
  1409.     #----Pms the last person to be Pmed, or that PMs the bot, the soldat server information----------
  1410.     #
  1411.     #----------------------------------------------------------------------------------------------------------        
  1412.         elsif splitted[3] == ":!pmserv"&&isadmi(admins,id) == 1 && splitted[2] == mainchan
  1413.           ircmsg(sock,replyed,"soldat://"+solserver+":"+solport+"/"+solpass)
  1414.           ircmsg(sock,mainchan,"The server: soldat://"+solserver+":"+solport+"/"+solpass+" has been sent to " +replyed)
  1415.      
  1416.     #-----Ignore function, adds the last person to pm the bot, or to be pmed to the ignore list------
  1417.     #Need to add an unignore function, and figure out how to make it so you cannot add multiple instances of the same person
  1418.     #------------------------------------------------------------------------------------------------------
  1419.     elsif splitted[3] == ":!ignores" && splitted[2] && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1420.       text = text[(1+splitted[2].length), text.length ]
  1421.       igfile = File.new("Ignorelist.txt","a+")
  1422.       igfile2 = File.new("Ignorelog.txt","a+")
  1423.       igfile.puts text
  1424.       igfile2.puts txt
  1425.       igfile.close
  1426.       igfile2.close
  1427.       ignored = File.new("Ignorelist.txt","r")
  1428.       line = ignored.readlines
  1429.       ignored.close
  1430.       ircmsg(sock,mainchan,"The user "+text+" has been ignored")
  1431.      
  1432.     elsif splitted[3] == ":!ignore" && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1433.       igfile = File.new("Ignorelist.txt","a+")             #Opens the file in a way that it adds information to the end of the file (a+)
  1434.       igfile2 = File.new("Ignorelog.txt","a+")             #Opens the file to log who ignored who.
  1435.       igfile.puts host                                             #Puts the last person to pm, or be pmed by the bot
  1436.       igfile2.puts user +" Ignored "+host                            #Puts in the logfile who ignored who
  1437.       igfile2.close                                                      #Closes the logfile
  1438.       igfile.close                                                       #Closes the ignore file
  1439.       ignored = File.new("Ignorelist.txt","r")          #Opens the file again, in read only, to update the ignore list
  1440.       line = ignored.readlines                                      #runs through the file, adding all lines to the ignored array
  1441.       ignored.close                                                   #closes the file
  1442.       ircmsg(sock,mainchan,replyed+" has been ignored.") #Prints out said user has been ignored.
  1443.      
  1444. =begin
  1445.       #---Does nothing, obviously.
  1446.     elsif splitted[3] == ":!unignore" && isadmi(admins,user) == 1 && splitted[2] == mainchan
  1447.      
  1448.       #-- Not fully working, will flood out the bot
  1449.  
  1450.     elsif splitted[3] == ":!ignored" && isadmi(admins,user) == 1 && splitted[2] == mainchan
  1451.      
  1452.       ignored = File.open("Ignorelist.txt").collect
  1453.       i = 0
  1454.       while(ignored[i])
  1455.         ircmsg(sock,mainchan,ignored[i])
  1456.         i+=1
  1457.       end
  1458. =end
  1459. =begin
  1460.           #----remote. sends a command from IRC to soldat server e.g. !remote /pause
  1461.         elsif splitted[3] == ":!remote" && isadmi(admins,id) == 1 && splitted[2] == mainchan
  1462.             text = text[8, text.length]
  1463.             if text.include?("/say")
  1464.                 solmsg(solsock, "/say ("+ user +") " +text[5,text.length])
  1465.             else
  1466.                 solmsg(solsock, text)
  1467.             end
  1468.    
  1469.     #----playing. shows server information in the IRC channel such as: whos playing, map, current time and scores.
  1470.         elsif splitted[3] == ":!playing" && splitted[2] == mainchan
  1471.                 solsock.print("REFRESH\r\n")
  1472.                 sleep(1)
  1473.                 i = 0
  1474.                 pl = names
  1475.                 while (i < 10)
  1476.                     if names[i] == ""
  1477.                         names[i] = " x"
  1478.                     end
  1479.                     i+= 1
  1480.                 end
  1481.                 i = 0
  1482.                 while (i < 8)
  1483.                     if teams[i] == 1
  1484.                         pl[i] = "4 "+names[i]+"1"
  1485.                     elsif teams[i] == 2
  1486.                         pl[i] = "12 "+names[i]+"1"
  1487.                     elsif teams[i] == 3
  1488.                         pl[i] = "8 "+names[i]+"1"
  1489.                     elsif teams[i] == 4
  1490.                         pl[i] = "9 "+names[i]+"1"
  1491.                     end
  1492.                     i+= 1
  1493.                 end
  1494.                 currenttime = currenttime/60
  1495.                 mins = ((currenttime/60).to_i).to_s
  1496.                 secs = (currenttime%60).to_s
  1497.                 if mins.length == 1
  1498.                     mins = "0"+mins
  1499.                 end
  1500.                 if secs.length == 1
  1501.                     secs = "0"+secs
  1502.                 end
  1503.                 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«")
  1504.                 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«")
  1505.  
  1506. #=end    
  1507.         #---quit. kills the process, in other words, kills the bot :E
  1508.         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"
  1509.             ircmsg(sock, mainchan, "Quitting...")
  1510.             sleep(2)
  1511.        
  1512.             break
  1513.  
  1514.         end
  1515. =end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement