All pastes #1480280 Raw Edit

POG Master Brutallity

public text v1 · immutable
#1480280 ·published 2009-07-01 02:35 UTC
rendered paste body
procedure TFormTakanodanPrincipal.ClientSRead(Sender: TObject; Socket: TCustomWinSocket);
Label
  Resta1;
var
  Chave,KICK, Num, MSG, RecCanal, ErrorCode, RecText, RPing, RecNick, RecMsg, Comando: String;
  P, X, Y, Z, K: Integer;
  LMC,TXT, Lista: TStringList;
begin
  RecText := Socket.ReceiveText;//Texto recebido
  FormLog.RichEdit1.Lines.Add(RecText);
  //Coloca na StringList, isso evita erros se receber linhas juntas
  //Mensagem1#13#10Mensagem2#13#10, fica sendo 1 linha Mensagem1 e outra Mensagem2 =)
  RecList.Text := RecText;
  //Verifica linha por linha na RecList
  if RecList.Count > 0 then
  for X := 0 to RecList.Count -1 do
  begin
    { Verifica se a linha esta vazia }
    if RecList[X] <> '' then
      RecText := RecList[X]
    else
      Continue;
     //Responde pings
     if Pos('PING :', RecText) > 0 then
     begin
      P := Pos(':',RecText);
      RPing := Copy(RecText, P+1, Length(RecText)-P);
      EnviaTexto('PONG ' + RPing);
     end;
    //Verifica Mensagens
    //:Prodigy_-!~prodigy@01zsyQa9sgk.200.157.170.O PRIVMSG #SourceX :!teste
    //Zero_Col!~teste@localhost-32634 PRIVMSG TakanodanBot :aews
    if (Procura(AnsiUpperCase(RecText),AnsiUpperCase(' MODE #'))=True) or (Procura(AnsiUpperCase(RecText),AnsiUpperCase(' NICK :'))=True) or (Procura(AnsiUpperCase(RecText),AnsiUpperCase('JOIN :#'))=True) or (Procura(AnsiUpperCase(RecText),AnsiUpperCase(' QUIT :'))=True) or (Procura(AnsiUpperCase(RecText),AnsiUpperCase('PART #'))=True) then
      begin
        for K:=0 to ListBox1.Items.Count-1 do
          begin
            
            ClientS.Socket.SendText('NAMES '+ListBox1.Items[K]+#13#10);
          end;
      end;
    if Procura(AnsiUpperCase(RecText),AnsiUpperCase(' 353 '))=True then
      begin
        AtualizaLista(PegaUsuarios(RecText));
      end;
    if CopyPalav(RecText, 2) = 'PRIVMSG' then
    begin
       //Nick que enviou
      RecNick := Copy(RecText,2, Pos('!',RecText)-2);
       //Destino - CANAL ou NICK
      RecCanal := CopyPalav(RecText,3);
       //Mensagem recebida
      RecMsg  := Copy(RecText, Pos(RecCanal,RecText) + Length(RecCanal)+2,Length(RecText));
      LMC:=TStringList.Create;
      LMC.Duplicates:=dupIgnore;
      if FileExists(ExtractFilePath(Application.ExeName)+'logs\log_'+ProcuraeSubstitui(DateToStr(Date),'/','_')+'.txt') then
        begin
          LMC.LoadFromFile(ExtractFilePath(Application.ExeName)+'logs\log_'+ProcuraeSubstitui(DateToStr(Date),'/','_')+'.txt');
        end;
      LMC.Add(RecCanal+'<'+RecNick+'>'+RecMsg);
      LMC.SaveToFile(ExtractFilePath(Application.ExeName)+'logs\log_'+ProcuraeSubstitui(DateToStr(Date),'/','_')+'.txt');
      FreeAndNil(LMC);
      if RecCanal[1] <> '#' then//Se foi mensagem no CANAL
        begin
          Comando := AnsiUpperCase( CopyPalav(RecMsg,1) );//1ª palavra paar maiuscula
// Comando !RCON
           if Comando = '!RCON' then
            begin
              for Y:=0 to CheckListBox1.Count-1 do
                begin
                  
                  if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                    begin
                      EnviaTexto(PosCopyPalav(RecMsg,2,'!RCON  '));
                    end;
                end;
            end
          else
            begin
// Comando !Restart
              if Comando = '!RESTART' then
                begin
                  try
                    for Y:=0 to CheckListBox1.Count-1 do
                      begin
                        
                        if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                          begin
                            Button2.Click;
                            Button1.Click;
                          end;
                      end;
                    Abort;
                  except
                    Abort;
                  end;
                end;
// Comando !CHANGESTAT
              if Comando = '!CHANGESTAT' then
               begin
                 try
                   for Y:=0 to CheckListBox1.Count-1 do
                     begin
                       
                       if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                         begin
                           if PosCopyPalav(RecMsg,2,' ')='1' then
                             begin
                               if PosCopyPalav(RecMsg,3,' ')='1' then
                                 begin
                                   CheckBox1.Checked:=True;
                                   BUFFER.Add('NOTICE '+RecNick+' :Abrir Log ao Conectar: Ligado');
                                 end
                               else
                                 begin
                                   CheckBox1.Checked:=False;
                                   BUFFER.Add('NOTICE '+RecNick+' :Abrir Log ao Conectar: Desligado');
                                 end;
                             end;
                           if PosCopyPalav(RecMsg,2,' ')='2' then
                             begin
                               if PosCopyPalav(RecMsg,3,' ')='1' then
                                 begin
                                  CheckBox2.Checked:=True;
                                  BUFFER.Add('NOTICE '+RecNick+' :Reconectar se desconectado: Ligado');
                                 end
                               else
                                 begin
                                   CheckBox2.Checked:=False;
                                   BUFFER.Add('NOTICE '+RecNick+' :Reconectar se desconectado: Desligado');
                                 end;
                             end;
                           if PosCopyPalav(RecMsg,2,' ')='3' then
                             begin
                               if PosCopyPalav(RecMsg,3,' ')='1' then
                                 begin
                                   CheckBox3.Checked:=True;
                                   BUFFER.Add('NOTICE '+RecNick+' :Mostrar no Tray: Ligado');
                                 end
                               else
                                 begin
                                   CheckBox3.Checked:=False;
                                   BUFFER.Add('NOTICE '+RecNick+' :Mostrar no Tray: Desligado');
                                 end;
                             end;
                           if PosCopyPalav(RecMsg,2,' ')='4' then
                             begin
                               if PosCopyPalav(RecMsg,3,' ')='1' then
                                 begin
                                   CheckBox4.Checked:=True;
                                   BUFFER.Add('NOTICE '+RecNick+' :Ocultar ao Iniciar: Ligado');
                                 end
                               else
                                 begin
                                   CheckBox4.Checked:=False;
                                   BUFFER.Add('NOTICE '+RecNick+' :Ocultar ao Iniciar: Desligado');
                                 end;
                             end;
                           if PosCopyPalav(RecMsg,2,' ')='5' then
                             begin
                               if PosCopyPalav(RecMsg,3,' ')='1'then
                                 begin
                                   CheckBox5.Checked:=True;
                                   BUFFER.Add('NOTICE '+RecNick+' :Iniciar com Windows: Ligado');
                                 end
                               else
                                 begin
                                   CheckBox5.Checked:=False;
                                   BUFFER.Add('NOTICE '+RecNick+' :Iniciar com Windows: Desligado');
                                 end;
                             end;
                         end;
                     end;
                 except
                   Abort;
                 end;
               end;
// Comando !STAT
              if Comando = '!STAT' then
                begin
                  try
                    for Y:=0 to CheckListBox1.Count-1 do
                      begin
                        
                        if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                          begin
                            if CheckBox1.Checked then
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Abrir Log ao Conectar: Ligado');
                              end
                            else
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Abrir Log ao Conectar: Desligado');
                              end;
                            if CheckBox2.Checked then
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Reconectar se desconectado: Ligado');
                              end
                            else
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Reconectar se desconectado: Desligado');
                              end;
                            if CheckBox3.Checked then
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Mostrar no Tray: Ligado');
                              end
                            else
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Mostrar no Tray: Desligado');
                              end;
                            if CheckBox4.Checked then
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Ocultar ao Iniciar: Ligado');
                              end
                            else
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Ocultar ao Iniciar: Desligado');
                              end;
                            if CheckBox5.Checked then
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Iniciar com Windows: Ligado');
                              end
                            else
                              begin
                                BUFFER.Add('NOTICE '+RecNick+' :Iniciar com Windows: Desligado');
                              end;
                          end;
                      end;
                  except
                    Abort;
                  end;
                end;
// Comando !DELEXEC
              if Comando = '!DELEXEC' then
                try
                  for Y:=0 to CheckListBox1.Count-1 do
                    begin
                      
                      if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                        begin
                          for Z:= 0 to Memo1.Lines.Count-1 do
                            begin
                              
                              if AnsiUpperCase(PosCopyPalav(RecMsg,2,'!DELEXEC  '))=AnsiUpperCase(Memo1.Lines[Z]) then
                                begin
                                  EnviaPrivMsg(RecNick,': Comando '+PosCopyPalav(RecMsg,2,'!DELEXEC  ')+' Removido da Lista de Auto-EXEC');
                                  Memo1.Lines.Delete(Z);
                                end;
                            end;
                        end;
                    end;
                  Abort;
                except
                  Abort;
                end;
// Comando !AEXEC
              if Comando = '!AEXEC' then
                begin
                  try
                    for Y:=0 to CheckListBox1.Count-1 do
                      begin
                        
                        if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                          begin
                            for Z:=0 to Memo1.Lines.Count-1 do
                              begin
                                
                                BUFFER.Add('NOTICE '+RecNick+' :'+Memo1.Lines[Z]);
                              end;
                            Abort;
                          end;
                      end;
                  except
                    Abort;
                  end;
                end;
// Comando !ADDEXEC
              if Comando = '!ADDEXEC' then
               begin
                 try
                  for Y:=0 to CheckListBox1.Count-1 do
                    begin
                      
                      if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                        begin
                          Memo1.Lines.Add(PosCopyPalav(RecMsg,2,'!ADDEXEC  '));
                          Abort;
                        end;
                    end;
                 except
                   Abort;
                 end;
               end;
            end;
        end;

      if RecCanal[1] = '#' then//Se foi mensagem no CANAL
      begin
        // ***** Comandos *****
       Comando := AnsiUpperCase( CopyPalav(RecMsg,1) );//1ª palavra paar maiuscula
// Comando !ERRO
       if Comando = '!ERRO' then
        try
          ErrorCode:=PosCopyPalav(AnsiUpperCase(RecMsg),2,AnsiUpperCase('!ERRO '));
          if not TestaNumero(ErrorCode) then
          begin
           abort;
          end;
          Lista:=TStringList.Create;
          Lista.Duplicates:=dupIgnore;
          Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\'+'Erros.txt');
          Lista.Text:=Crypt('D',Lista[0]);
          for Z:=0 to Lista.Count-1 do
            begin
              if PosCopyPalav(Lista[Z],1,'=')=ErrorCode then
                begin
                  EnviaPrivMsg(RecCanal,RecNick+': Erro: '+ErrorCode+'= '+PosCopyPalav(Lista[Z],2,'='));
                end;
            end;
          FreeAndNil(Lista);
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !HELP
       if Comando = '!HELP' then
        try
          Lista:=TStringList.Create;
          Lista.Duplicates:=dupIgnore;
          Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\'+'cmd.txt');
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  for Z:=0 to Lista.Count-1 do
                    begin
                      
                      BUFFER.Add('NOTICE '+RecNick+' :'+Lista[Z]);
                    end;
                end;
            end;
          FreeAndNil(Lista);
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !BDEERRO
       if Comando = '!BDEERRO' then
         begin
           try
             ErrorCode:=PosCopyPalav(AnsiUpperCase(RecMsg),2,AnsiUpperCase('!BDEERRO '));
             if not TestaNumero(ErrorCode) then
             begin
              abort;
             end;
             Lista:=TStringList.Create;
             Lista.Duplicates:=dupIgnore;
             Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\'+'BDEErros.txt');
             Lista.Text:=Crypt('D',Lista[0]);
             for Z:=0 to Lista.Count-1 do
               begin
                 if PosCopyPalav(Lista[Z],1,':')=ErrorCode then
                   begin
                     EnviaPrivMsg(RecCanal,RecNick+': Erro: '+ErrorCode+'= '+PosCopyPalav(Lista[Z],2,'='));
                   end;
               end;
             FreeAndNil(Lista);
           except
             EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
           end;
         end;
// Comando !ADMINS
       if Comando = '!ADMINS' then
         begin
           try
             for Y:=0 to CheckListBox1.Count-1 do
               begin
                 
                 if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                   begin
                     for Z:=0 to CheckListBox1.Items.Count-1 do
                       begin
                         
                         BUFFER.Add('NOTICE '+RecNick+' :'+CheckListBox1.Items[Z]);
                       end;
                   end;
               end;
           except
             Abort;
           end;
         end;
// Comando !CHANS
       if Comando = '!CHANS' then
         begin
           try
             for Y:=0 to CheckListBox1.Count-1 do
               begin
                 
                 if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                   begin
                     for Z:=0 to ListBox1.Items.Count-1 do
                       begin
                         
                         BUFFER.Add('NOTICE '+RecNick+' :'+ListBox1.Items[Z]);
                       end;
                   end;
               end;
           except
             Abort;
           end;
         end;
// Comando !DELCHAN
       if Comando = '!DELCHAN' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  for Z:= 0 to ListBox1.Items.Count-1 do
                    begin
                      
                      if (AnsiUpperCase(PosCopyPalav(RecMsg,2,'!DELCHAN  '))=AnsiUpperCase(ListBox1.Items[Z])) then
                        begin
                          EnviaPrivMsg(RecCanal,RecNick+': Canal '+PosCopyPalav(RecMsg,2,'!DELCHAN  ')+' Removido da Lista de Auto-Join');
                          ListBox1.Items.Delete(Z);
                        end;
                    end;
                end;
            end;
        except
          Abort;
        end;
// Comando !ADDCHAN
       if Comando = '!ADDCHAN' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  for Z:= 0 to ListBox1.Items.Count-1 do
                    begin
                      
                      if AnsiUpperCase(PosCopyPalav(RecMsg,2,'!ADDCHAN  '))=AnsiUpperCase(ListBox1.Items[Z]) then
                        begin
                          MessageBeep(16);
                          EnviaPrivMsg(RecCanal,RecNick+': Já exite na lista');
                          Abort;
                        end;
                    end;
                  if PosCopyPalav(RecMsg,2,'!ADDCHAN  ')[1]='#' then
                    begin
                      if ListBox1.Items.Count >= 10 then
                        begin
                          MessageBeep(16);
                          EnviaPrivMsg(RecCanal,RecNick+': Maximo de 10 Canais');
                          Abort;
                        end;
                      EnviaPrivMsg(RecCanal,RecNick+': Canal '+PosCopyPalav(RecMsg,2,'!ADDCHAN  ')+' Adcionado a Lista de Auto-Join');
                      ListBox1.Items.Add(PosCopyPalav(RecMsg,2,'!ADDCHAN  '));
                    end
                  else
                    begin
                      EnviaPrivMsg(RecCanal,RecNick+': Faltou colocar #');
                    end;
                end;
            end;
        except
          Abort;
        end;
// Comando !DELADMIN
       if Comando = '!DELADMIN' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  for Z:= 0 to CheckListBox1.Items.Count-1 do
                    begin
                      
                      if (AnsiUpperCase(PosCopyPalav(RecMsg,2,'!DELADMIN  '))=AnsiUpperCase(CheckListBox1.Items[Z])) and (CheckListBox1.Checked[Z]=False) then
                        begin
                          EnviaPrivMsg(RecCanal,RecNick+': Nick '+PosCopyPalav(RecMsg,2,'!DELADMIN  ')+' Removido da Lista de Administradores');
                          CheckListBox1.Items.Delete(Z);
                        end;
                    end;
                end;
            end;
        except
          Abort;
        end;
// Comando !ADDADMIN
       if Comando = '!ADDADMIN' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  for Z:= 0 to CheckListBox1.Items.Count-1 do
                    begin
                      
                      if AnsiUpperCase(PosCopyPalav(RecMsg,2,'!ADDADMIN  '))=AnsiUpperCase(CheckListBox1.Items[Z]) then
                        begin
                          MessageBeep(16);
                          EnviaPrivMsg(RecCanal,RecNick+': Já exite na lista');
                          Abort;
                        end;
                    end;
                  EnviaPrivMsg(RecCanal,RecNick+': Nick '+PosCopyPalav(RecMsg,2,'!ADDADMIN  ')+' Adcionado a Lista de Administradores');
                  CheckListBox1.Items.Add(PosCopyPalav(RecMsg,2,'!ADDADMIN  '));
                end;
            end;
        except
          Abort;
        end;
       if Comando = '!DELIA' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              if (AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y])) or ((AnsiUpperCase(RecCanal+'=@'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (ADDDFOP)) or ((AnsiUpperCase(RecCanal+'=+'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (ADDDFVOICE)) then
                begin
                  EnviaPrivMsg(RecCanal,RecNick+': '+DELAI(PosCopyPalav(RecMsg,2,'!DELIA  ')));
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !KICK
       if Comando = '!KICK' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  Lista:=TStringList.Create;
                  Lista.Duplicates:=dupIgnore;
                  Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\kicks.txt');
                  Randomize;
                  KICK:=Lista[Random(Lista.Count)];
                  if AnsiUpperCase(PosCopyPalav(RecMsg,2,'!KICK  '))<>AnsiUpperCase(Edit3.Text) then
                    begin
                      if PosCopyPalav(RecMsg,2,'!KICK  ')<>'' then
                        begin
                          EnviaTexto('KICK '+RecCanal+' '+PosCopyPalav(RecMsg,2,'!KICK  ')+' :'+KICK);
                        end
                      else
                        begin
                          EnviaPrivMsg(RecCanal,RecNick+': Especifique um Nick');
                        end;
                    end;
                  FreeAndNil(Lista);
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !KB
       if Comando = '!KB' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  Lista:=TStringList.Create;
                  Lista.Duplicates:=dupIgnore;
                  Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\kicks.txt');
                  Randomize;
                  KICK:=Lista[Random(Lista.Count)];
                  if AnsiUpperCase(PosCopyPalav(RecMsg,2,'!KB  '))<>AnsiUpperCase(Edit3.Text) then
                    begin
                      if PosCopyPalav(RecMsg,2,'!KB  ')<>'' then
                        begin
                          EnviaTexto('MODE '+RecCanal+' +b *'+RecNick+'*');
                          EnviaTexto('KICK '+RecCanal+' '+PosCopyPalav(RecMsg,2,'!KB  ')+' :'+KICK);
                        end
                      else
                        begin
                          EnviaPrivMsg(RecCanal,RecNick+': Especifique um Nick');
                        end;
                    end;
                  FreeAndNil(Lista);
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !OP
       if Comando = '!OP' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  if PosCopyPalav(RecMsg,2,'!OP  ')='' then
                    begin
                      EnviaTexto('MODE '+RecCanal+' +o '+RecNick);
                    end
                  else
                    begin
                      EnviaTexto('MODE '+RecCanal+' +o '+PosCopyPalav(RecMsg,2,'!OP  '));
                    end;
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !DEOP
       if Comando = '!DEOP' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  if PosCopyPalav(RecMsg,2,'!DEOP  ')='' then
                    begin
                      EnviaTexto('MODE '+RecCanal+' -o '+RecNick);
                    end
                  else
                    begin
                      EnviaTexto('MODE '+RecCanal+' -o '+PosCopyPalav(RecMsg,2,'!DEOP  '));
                    end;
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !VOICE
       if Comando = '!VOICE' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  if PosCopyPalav(RecMsg,2,'!VOICE  ')='' then
                    begin
                      EnviaTexto('MODE '+RecCanal+' +v '+RecNick);
                    end
                  else
                    begin
                      EnviaTexto('MODE '+RecCanal+' +v '+PosCopyPalav(RecMsg,2,'!VOICE  '));
                    end;
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !DEVOICE
       if Comando = '!DEVOICE' then
        try
          for Y:=0 to CheckListBox1.Count-1 do
            begin
              
              if AnsiUpperCase(RecNick) = AnsiUpperCase(CheckListBox1.Items[Y]) then
                begin
                  if PosCopyPalav(RecMsg,2,'!DEVOICE  ')='' then
                    begin
                      EnviaTexto('MODE '+RecCanal+' -v '+RecNick);
                    end
                  else
                    begin
                      EnviaTexto('MODE '+RecCanal+' -v '+PosCopyPalav(RecMsg,2,'!DEVOICE  '));
                    end;
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !FRASE
       if Comando = '!FRASE' then
        try
          Num:=PosCopyPalav(PosCopyPalav(RecMsg,2,'!FRASE  '),1,' ');
          if not TestaNumero(Num) then
            begin
              MSG:=Fraseexibir(PosCopyPalav(RecMsg,2,'!FRASE  '));
              Chave:=PosCopyPalav(RecMsg,2,'!FRASE  ');
              BUFFER.Add('NOTICE '+RecNick+' :'+MSG);
              SepararTotalFraze(0);
            end
          else
            begin
              MSG:=Fraseexibir(PosCopyPalav(RecMsg,2,'!FRASE  '+Num+' '));
              Chave:=PosCopyPalav(RecMsg,2,'!FRASE  '+Num+' ');
              BUFFER.Add('NOTICE '+RecNick+' :'+MSG);
              SepararTotalFraze(StrToInt(Num));
            end;
            Lista:=TStringList.Create;
            Lista.Duplicates:=dupIgnore;
            Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\achadas.txt');
            Lista.Text:=Crypt('D',Lista[0]);
            if MSG<>'Nada Encontrado com '+Chave+'!!!' then
              begin
                for Y:= 0 to Lista.Count-1 do
                  begin
                    
                    BUFFER.Add('NOTICE '+RecNick+' :'+'6,0'+ Lista[Y]);
                  end;
              end;
            FreeAndNil(Lista);
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !DELFRASE
        if Comando = '!DELFRASE' then
        try
          for Y:=0 to ListBox2.Count-1 do
            begin
              if ((AnsiUpperCase(RecCanal+'=@'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (DelDFAIOP))  or ((AnsiUpperCase(RecCanal+'=+'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (DelDFAIVOICE)) then
                begin
                  Num:=PosCopyPalav(PosCopyPalav(RecMsg,2,'!DELFRASE  '),1,' ');
                  if TestaNumero(Num) then
                    begin
                      EnviaPrivMsg(RecCanal, RecNick +': '+ Fraseremove(StrToInt(PosCopyPalav(RecMsg,2,'!DELFRASE  '))));
                    end
                  else
                    begin
                      EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
                    end;
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !ADDFRASE
        if Comando = '!ADDFRASE' then
        try
          for Y:=0 to ListBox2.Count-1 do
            begin
              if ((AnsiUpperCase(RecCanal+'=@'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (ADDDFOP))  or ((AnsiUpperCase(RecCanal+'=+'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (ADDDFVOICE))  then
                begin
                  EnviaPrivMsg(RecCanal, RecNick +': '+ addFrase(PosCopyPalav(RecMsg,2,'!ADDFRASE  ')));
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !DICA
        if Comando = '!DICA' then
        try
          Num:=PosCopyPalav(PosCopyPalav(RecMsg,2,'!DICA  '),1,' ');
          if not TestaNumero(Num) then
            begin
              MSG:=dicaexibir(PosCopyPalav(RecMsg,2,'!DICA  '));
              Chave:=PosCopyPalav(RecMsg,2,'!DICA  ');
              BUFFER.Add('NOTICE '+RecNick+' :'+MSG);
              SepararTotalDica(0);
            end
          else
            begin
              MSG:=dicaexibir(PosCopyPalav(RecMsg,2,'!DICA  '+Num+' '));
              Chave:=PosCopyPalav(RecMsg,2,'!DICA  '+Num+' ');
              BUFFER.Add('NOTICE '+RecNick+' :'+MSG);
              SepararTotalDica(StrToInt(Num));
            end;
            Lista:=TStringList.Create;
            Lista.Duplicates:=dupIgnore;
            Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\achadas.txt');
            Lista.Text:=Crypt('D',Lista[0]);
            if MSG<>'Nada Encontrado com '+Chave+'!!!' then
              begin
                for Y:= 0 to Lista.Count-1 do
                  begin
                    
                    BUFFER.Add('NOTICE '+RecNick+' :'+'6,0'+ Lista[Y]);
                  end;
              end;
            FreeAndNil(Lista);
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !DELDICA
        if Comando = '!DELDICA' then
        try
          for Y:=0 to ListBox2.Count-1 do
            begin
              if ((AnsiUpperCase(RecCanal+'=@'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (DelDFAIOP))  or ((AnsiUpperCase(RecCanal+'=+'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (DelDFAIVOICE))  then
                begin
                  Num:=PosCopyPalav(PosCopyPalav(RecMsg,2,'!DELDICA  '),1,' ');
                  if TestaNumero(Num) then
                    begin
                      EnviaPrivMsg(RecCanal, RecNick +': '+ dicaremove(StrToInt(PosCopyPalav(RecMsg,2,'!DELDICA  '))));
                    end
                  else
                    begin
                      EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
                    end;
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !ADDDICA
        if Comando = '!ADDDICA' then
        try
          for Y:=0 to ListBox2.Count-1 do
            begin
              if ((AnsiUpperCase(RecCanal+'=@'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (ADDDFOP))  or ((AnsiUpperCase(RecCanal+'=+'+RecNick) = AnsiUpperCase(ListBox2.Items[Y])) and (ADDDFVOICE))  then
                begin
                  EnviaPrivMsg(RecCanal, RecNick +': '+ adddica('Por 15,0'+RecNick+'1,0 - '+PosCopyPalav(RecMsg,2,'!ADDDICA  ')));
                end;
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
//Inteligencia Artificial
//Responde Conversa
        if Procura(AnsiUpperCase(StripIRCColor(RecMsg)),AnsiUpperCase(Edit3.Text))=True then
          begin
            try
              TXT:=TStringList.Create;
              TXT.Duplicates:=dupIgnore;
              TXT.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\AI.txt');
              TXT.Text:=Crypt('D',TXT[0]);
              MSG:=AI(RecMsg,TXT);
              EnviaPrivMsg(RecCanal, RecNick+': '+MSG);
              FreeAndNil(TXT);
            except
              EnviaPrivMsg(RecCanal, RecNick+': '+'Não Sei :\');
            end;
// Assimila Conversa
            try
              Lista:=TStringList.Create;
              Lista.Duplicates:=dupIgnore;
              Lista.LoadFromFile(ExtractFilePath(Application.ExeName)+'bin\AI.txt');
              Lista.Text:=Crypt('D',Lista[0]);
              if Procura(AnsiUpperCase(Lista.Text),AnsiUpperCase(PosCopyPalav(StripIRCColor(RecMsg),2,Edit3.Text+' ')))=False then
                begin
                   if Procura(AnsiUpperCase(PosCopyPalav(StripIRCColor(RecMsg),2,Edit3.Text)),AnsiUpperCase(Edit3.Text))=False then
                     begin
                       Lista.Add(ProcuraeSubstitui(PosCopyPalav(StripIRCColor(RecMsg),2,Edit3.Text+' '),': ',''));
                       Lista.Text:=Crypt('C',Lista.Text);
                       Lista.SaveToFile(ExtractFilePath(Application.ExeName)+'bin\AI.txt');
                     end;
                end;
              FreeAndNil(Lista);
            except
              on E : Exception do
                begin
                  MSG:='Erro: '+E.Message;
                  EnviaPrivMsg(RecCanal, RecNick+': '+MSG);
                end;
            end;
          end;
// Comando !HORA
        if Comando = '!HORA' then
          begin
            if (Time>=StrToTime('00:00:00')) and (Time<=StrToTime('11:59:00')) then
              begin
                EnviaPrivMsg(RecCanal, RecNick +': '+ Copy(TimeToStr(Time),1,2)+' Hora(s)'+', '+Copy(TimeToStr(Time),4,2)+' Minuto(s)'+' e '+Copy(TimeToStr(Time),7,2)+' Segundo(s)'+' Bom-Dia 0,3 0,7:1,3D1,0 0,3 0,4:1,3D1,0 0,3 0,6:1,3D1,0 0,3 0,12:1,3D');
              end;
            if (Time>=StrToTime('12:00:00')) and (Time<=StrToTime('17:59:00')) then
              begin
                EnviaPrivMsg(RecCanal, RecNick +': '+ Copy(TimeToStr(Time),1,2)+' Hora(s)'+', '+Copy(TimeToStr(Time),4,2)+' Minuto(s)'+' e '+Copy(TimeToStr(Time),7,2)+' Segundo(s)'+' Boa-Tarde 0,3 0,7:1,3D1,0 0,3 0,4:1,3D1,0 0,3 0,6:1,3D1,0 0,3 0,12:1,3D');
              end;
            if (Time>=StrToTime('18:00:00')) and (Time<=StrToTime('23:59:00')) then
              begin
                EnviaPrivMsg(RecCanal, RecNick +': '+ Copy(TimeToStr(Time),1,2)+' Hora(s)'+', '+Copy(TimeToStr(Time),4,2)+' Minuto(s)'+' e '+Copy(TimeToStr(Time),7,2)+' Segundo(s)'+' Boa-Noite 0,3 0,7:1,3D1,0 0,3 0,4:1,3D1,0 0,3 0,6:1,3D1,0 0,3 0,12:1,3D');
              end;
          end;
// Comando !EXTENSO Numero
        if Comando = '!EXTENSO' then
        try
          if Length(Extenso(CopyPalav(RecMsg,2)))>= 451 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': Valor Muito Alto');
            end
          else
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+ Extenso(CopyPalav(RecMsg,2)));
            end;
        except
          EnviaPrivMsg(RecCanal, RecNick +': Valor inválido ou Nulo');
        end;
// Comando !INFOHOST Site
        if Comando = '!INFOHOST' then
        try
          if Length(infohost(CopyPalav(RecMsg,2)))>= 451 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': Link Muito Grande');
            end
          else
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+ infohost(CopyPalav(RecMsg,2)));
            end;
        except
          on E : Exception do
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+E.Message);
            end;
        end;
// Comando !ACHAR site
        if Comando = '!ACHAR' then
        try
          if Length(filtra(PosCopyPalav(RecMsg,2,'!ACHAR '))) <= 450 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+ filtra(PosCopyPalav(RecMsg,2,'!ACHAR ')));
            end
          else
            begin
              EnviaPrivMsg(RecCanal, RecNick +': Link Muito Grande');
            end
        except
          on E : Exception do
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+E.Message);
            end;
        end;
// Comando !INFO CS
        if Comando = '!INFO' then
        try
          if Length(infoip(CopyPalav(RecMsg,2)))>= 451 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': Informação Muito Grande');
            end
          else
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+ Infoip(CopyPalav(RecMsg,2)));
              BUFFER.Add('NOTICE '+RecNick+' :'+'Jogadores no Servidor:0,3 '+ InfoPlayer(CopyPalav(RecMsg,2)))
            end;
        except
          on E : Exception do
            begin
              EnviaPrivMsg(RecCanal, RecNick +': '+E.Message);
            end;
        end;
// Comando Versão :D
        if Comando = '!VERSÃO' then
          EnviaPrivMsg(RecCanal, RecNick +': Bot Versão '+GetBuildInfo+' Criado e Programado por Jocélio Pergentino (81) 8828-5355');
// Comando !ASCII
        if Comando = '!ASCII' then
        try
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('Del') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 7');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('Delete') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 7');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('BackSpace') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 8');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('Tab') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 9');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('Enter') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 13');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('Shift') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 16');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('CTRL') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 17');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('ALT') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 18');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('CapsLock') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 20');
              Abort;
            end;
          if AnsiUpperCase(CopyPalav(RecMsg,2)) = AnsiUpperCase('Espaço') then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': 32');
              Abort;
            end;
          EnviaPrivMsg(RecCanal, RecNick +': '+ IntToStr(Ord(CopyPalav(RecMsg,2)[1])));
        except
          Abort;
        end;
// Comando !CHR
        if AnsiUpperCase(Comando) = AnsiUpperCase('!CHR') then
        try
          if StrToInt(CopyPalav(RecMsg,2)) = 7 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {Delete}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 8 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {BackSpace}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 9 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {Tab}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 13 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {Enter}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 16 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {Shift}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 17 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {CTRL}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 18 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {ALT}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 20 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {CapsLock}');
              Abort;
            end;
          if StrToInt(CopyPalav(RecMsg,2)) = 32 then
            begin
              EnviaPrivMsg(RecCanal, RecNick +': {Espaço}');
              Abort;
            end;
          EnviaPrivMsg(RecCanal, RecNick +': '+ Char(StrToInt(CopyPalav(RecMsg,2))) );
        except
          Abort;
        end;
      end;

    end;


  end;//Fim for X := 0 to RecList.Count -1 do
end;