All pastes #639423 Raw Edit

Stuff

public text v1 · immutable
#639423 ·published 2007-07-30 15:40 UTC
rendered paste body
on *:load:{
  /actualizar-redes-canais 
  echo -a Aqui tens mais um trabalhito :P Um obrigado por me fazeres um user activo. É graças a ti que sou o helper mais activo da minha equipa :P
}

alias actualizar-redes-canais {
  set %presistemstatus Ligado
  set %presistembot AnnounceBot
  set %presistementrada AustIRC
  set %presistemsaida PTnet
  set %presistemsaida2 PTnet
  set %presistemsaidacanal #d&r
  set %presistemsaidacanal2 #d&r
  set %presistementradacanal #pre
}

on *:text:*:#:{
  if ($chan = %presistementradacanal) {
    if (($nick == %presistembot) && ($network == %presistementrada)) {

      if (*PRE* iswm $1-) {
        set %clean $strip($1-,burc)
        set %pre_ $mid(%clean,14,999)

        var %calc $calc($len($gettok(%pre,2-,32)) - 3)
        var %another $mid($gettok(%pre,2-,32),3,999)
        var %another_ $len(%another)
        var %another__ $calc(%another_ - 1)
        set %cor $gettok(%pre,1,32)
        set %cor2 $cor
        set %prename $remove(%another,[,$right(%another,2))
        var %t 1, %z $scid(0)
        while (%t <= %z) {
          if ($scid(%t).network == %presistemsaida) || ($scid(%t).network == %presistemsaida2) {
            if (%presistemstatus = ligado) { scid %t msg $iif($scid(%t).network = %presistemsaida,%presistemsaidacanal,%presistemsaidacanal2) 1512::: [02PRE] 12:: [07 %cor2 ] 12::::  %prename   }

          }
          inc %t
        }
        set %date $date $time
        write -il1 db.txt PRE $strip(%cor2 %prename) %date
        write -l1 DataBase.txt PRE $calc($gettok($read(DataBase.txt,1),2,32) + 1)

        set %ahhetalques $replace($strip(%prename),-,$chr(32))
        set %groupdoahetal $gettok(%ahhetalques,$numtok(%ahhetalques,32),32)
        set %grouprelease $calc($readini(groups.ini,%groupdoahetal,release) + 1)


        if (!$readini(groups.ini,%groupdoahetal,first)) { writeini -n groups.ini %groupdoahetal first PRE $strip(%cor2 %prename) %date }

        writeini -n groups.ini %groupdoahetal last PRE $strip(%cor2 %prename) %date
        writeini -n groups.ini %groupdoahetal release %grouprelease

        write groups\ $+ %groupdoahetal $+ .txt PRE $strip(%cor2 %prename) %date

        inc %pres.count

      }
      if (NUKE == $gettok($1-,2,32)) { 
        echo -a oi
        set %clean $strip($1-,burc)
        set %pre_ $mid(%clean,14,999)
        set %pre $remove(%pre_,$chr(93),$chr(91),$right(%pre_,2),:)
        set %msg %pre
        set %prename $gettok(%msg,1,32)
        set %nukereason $gettok(%msg,2,32)

        var %t 1 , %z $scid(0)
        while (%t <= %z) {
          if ($scid(%t).network = %presistemsaida) || ($scid(%t).network = %presistemsaida2) {

            if (%presistemstatus = ligado) { scid %t msg $iif($scid(%t).network = %presistemsaida,%presistemsaidacanal,%presistemsaidacanal2) 1505::: [04NUKE] 05:::: [ %prename ] 05::[04 %nukereason ] }

          }
          inc %t
        }

        set %ahhetalques $replace($strip($gettok(%msg,1,32)),-,$chr(32))
        set %groupdoahetal $gettok(%ahhetalques,$numtok(%ahhetalques,32),32) 

        set %nukedate * $+ %prename $+ *

        var %date $iif($nukedate,$nukedate,$date $time)

        write -il1 db.txt NUKE $strip(%prename %nukereason) %date

        var %gettoknuke $gettok($read(DataBase.txt,2),2,32)
        write -l2 DataBase.txt NUKE $calc(%gettoknuke + 1)


        set %groupnuke $calc($readini(groups.ini,%groupdoahetal,nuke) + 1)

        write groups\ $+ %groupdoahetal $+ .txt NUKE %categorianuke $strip(%prename %nukereason) %date
        if (!$readini(groups.ini,%groupdoahetal,first)) { writeini -n groups.ini %groupdoahetal first NUKE %categorianuke $strip(%prename %nukereason) %date }
        writeini -n groups.ini %groupdoahetal last NUKE %categorianuke $strip(%prename %nukereason) %date
        writeini -n groups.ini %groupdoahetal nuke %groupnuke

        inc %nuke.count


      }
      if (*UNNUKE* iswm $1-) { 

        set %clean $strip($1-,burc)
        set %pre_ $mid(%clean,16,999)
        set %pre $remove(%pre_,$chr(93),$chr(91),:,$right(%pre_,2))
        set %msg %pre
        set %prename $gettok(%msg,1,32)
        set %nukereason $gettok(%msg,2,32)

        var %t 1 , %z $scid(0)
        while (%t <= %z) {
          if ($scid(%t).network = %presistemsaida) || ($scid(%t).network = %presistemsaida2) {

            if (%presistemstatus = ligado) { scid %t msg $iif($scid(%t).network = %presistemsaida,%presistemsaidacanal,%presistemsaidacanal2) 153::: [09UNNUKE] 3:::: [ %prename ] 3::[09 %nukereason ] }

          }
          inc %t
        }

        set %ahhetalques $replace($strip($gettok(%msg,1,32)),-,$chr(32))
        set %groupdoahetal $gettok(%ahhetalques,$numtok(%ahhetalques,32),32)

        set %nukedate * $+ $gettok(%msg,1,32) $+ *
        var %date $iif($nukedate,$nukedate,$date $time)

        write -il1 db.txt UNNUKE $strip(%prename %nukereason) %date

        var %gettokunnuke $gettok($read(DataBase.txt,3),2,32)
        write -l3 DataBase.txt UNNUKE $calc(%gettokunnuke + 1) 



        set %groupunnuke $calc($readini(groups.ini,%groupdoahetal,unnuke) + 1)

        write groups\ $+ %groupdoahetal $+ .txt UNNUKE %categorianuke $strip(%prename %nukereason) %date
        if (!$readini(groups.ini,%groupdoahetal,first)) { writeini -n groups.ini %groupdoahetal first UNNUKE %categorianuke $strip(%prename %nukereason) %date }
        writeini -n groups.ini %groupdoahetal last UNNUKE %categorianuke $strip(%prename %nukereason) %date

        writeini -n groups.ini %groupdoahetal unnuke %groupunnuke

        inc %unnuke.count

      }
    }
  }
}

alias nukedate {
  var %lines $lines(groups\ $+ %groupdoahetal $+ .txt)
  var %linhacontador 1
  set %categorianuke None
  while (%linhacontador <= %lines) {
    set %readnukedate $read(groups\ $+ %groupdoahetal $+ .txt,%linhacontador)

    if ((pre* iswm %readnukedate) && (%nukedate iswm %readnukedate)) {
      set %categorianuke $gettok(%readnukedate,2,32)
      return $gettok(%readnukedate,4,32) $gettok(%readnukedate,5,32)
      halt
    }
    inc %linhacontador
  }
}

alias categorianuke {
  var %lines $lines(groups\ $+ %groupdoahetal $+ .txt)
  var %linhacontador 1
  set %categorianuke None
  while (%linhacontador <= %lines) {
    set %readnukedate $read(groups\ $+ %groupdoahetal $+ .txt,%linhacontador)

    if ((pre* iswm %readnukedate) && (%nukedate iswm %readnukedate)) {
      set %categorianuke $gettok(%readnukedate,2,32)
      return %categorianuke
      halt
    }
    inc %linhacontador
  }
  return %categorianuke
}

alias cor {
  if (%cor = XXX) {
    return 08 $+ %cor 
  }
  if (%cor = MP3) {
    return 13 $+ %cor 
  }
  if (%cor = SVCD) {
    return 03 $+ %cor 
  }
  if (%cor = 0-Day) {
    return 09 $+ %cor 
  }
  if (%cor = TV-DVDRIP) {
    return 06 $+ %cor 
  }
  if (%cor = TV) {
    return 06 $+ %cor 
  }
  if (%cor = DVDR) {
    return 03 $+ %cor 
  }
  if (%cor = XviD) {
    return 07 $+ %cor 
  }
  if (%cor = MviD) {
    return 11 $+ %cor 
  }
  if (%cor = Games) {
    return 06 $+ %cor 
  }
  if (%cor = Apps) {
    return 05 $+ %cor 
  }
  if (%cor = Covers) {
    return 05 $+ %cor 
  }
  if (%cor = AudioBook) {
    return 05 $+ %cor 
  }
  if (%cor = EBook) {
    return 05 $+ %cor 
  }
  if (%cor = VCD) {
    return 02 $+ %cor 
  }
  if (%cor = MDVD-R) {
    return 11 $+ %cor 
  }
  if (%cor = Dox) {
    return 06 $+ %cor 
  }
  if (%cor = Anime) {
    return 11 $+ %cor 
  }
  if (%cor = PSP) {
    return 12 $+ %cor 
  }
  if (%cor = PS2) {
    return 12 $+ %cor 
  }
  if (%cor = XBOX) {
    return 09 $+ %cor 
  }
  if (%cor = Unknown) {
    return 09 $+ %cor 
  }
  if (%cor = 0DAY) {
    return 06 $+ %cor 
  }
  if (%cor = WII) {
    return 00 $+ %cor 
  }
  if (%cor = PRE) {
    return 08 $+ %cor 
  }
  if (%cor = X264) {
    return 11 $+ %cor 
  }
  else {
    return 00 $+ %cor
  }
}


alias actualizar {
  if (!$exists(groups)) {
    echo -a Cria a pasta groups para poder funcionar!!!
    halt
  }

  echo -a a actualizar....
  remove groups.ini
  remove DataBase.txt

  var %count.database $lines(db.txt)
  while (%count.database >= 1) {
    set %linha $read(db.txt,%count.database)
    var %tok1 $gettok(%linha,1,32)
    If (%tok1 == PRE) {
      write -l1 DataBase.txt PRE $calc($gettok($read(DataBase.txt,1),2,32) + 1)
      set %ahhetalques $replace($gettok(%linha,3,32),-,$chr(32))
      set %groupdoahetal $gettok(%ahhetalques,$numtok(%ahhetalques,32),32)
      set %grouprelease $calc($readini(groups.ini,%groupdoahetal,release) + 1)

      write groups\ $+ %groupdoahetal $+ .txt PRE  $gettok(%linha,2-,32) %date

      writeini -n groups.ini %groupdoahetal release %grouprelease

    }
    Elseif (%tok1 == NUKE) {


      set %nukedate * $+ $gettok(%linha,2,32) $+ *

      write -l2 DataBase.txt NUKE $calc($gettok($read(DataBase.txt,2),2,32) + 1)

      set %ahhetalques $replace($gettok(%linha,2,32),-,$chr(32))
      set %groupdoahetal $gettok(%ahhetalques,$numtok(%ahhetalques,32),32)           
      set %groupnuke $calc($readini(groups.ini,%groupdoahetal,nuke) + 1)



      write groups\ $+ %groupdoahetal $+ .txt NUKE $categorianuke $gettok(%linha,2-,32)

      writeini -n groups.ini %groupdoahetal nuke %groupnuke



    }
    Elseif (%tok1 == UNNUKE) {


      set %nukedate * $+ $gettok(%linha,2,32) $+ *

      write -l3 DataBase.txt UNNUKE $calc($gettok($read(DataBase.txt,3),2,32) + 1)

      set %ahhetalques $replace($gettok(%linha,2,32),-,$chr(32))
      set %groupdoahetal $gettok(%ahhetalques,$numtok(%ahhetalques,32),32)           
      set %groupnuke $calc($readini(groups.ini,%groupdoahetal,unnuke) + 1)

      write groups\ $+ %groupdoahetal $+ .txt UNNUKE $categorianuke $gettok(%linha,2-,32)


      writeini -n groups.ini %groupdoahetal unnuke %groupnuke

    }
    dec %count.database
  }

  set %contador 1
  set %ngroups $ini(groups.ini,0) 
  while (%contador <= %ngroups) {

    set %groupdoahetal $ini(groups.ini,%contador)
    set %lines $lines(groups\ $+ %groupdoahetal $+ .txt)

    writeini -n groups.ini %groupdoahetal first  $read(groups\ $+ %groupdoahetal $+ .txt,1)

    writeini -n groups.ini %groupdoahetal last $read(groups\ $+ %groupdoahetal $+ .txt,%lines)
    inc %contador
  }



  echo -a acabou de actualizar!

}

menu channel,menubar {
  -
  Sistema Pre
  .Estado $+ $chr(58) $chr(9) %presistemstatus :halt
  .-
  .$iif(%presistemstatus = Ligado,$style(2) Ligar,Ligar):set %presistemstatus Ligado
  .$iif(%presistemstatus = Desligado,$style(2) Desligar,Desligar):set %presistemstatus Desligado
  .-
  .Definir
  ..Nick do bot $+ $chr(58) $chr(9) %presistembot :halt
  ..Definir: set %presistembot $$?="Digita o nome para o BOT"
  ..-
  ..Rede/Canal1 de entrada de info $+ $chr(58) $chr(9) %presistementrada $+ / $+ %presistementradacanal :halt
  ..Definir: set %presistementrada $$?="Digita a REDE de entrada da Informação" | set %presistementradacanal #$$?="Digita o CANAL de entrada da Informação"
  ..-
  ..Rede/Canal2 de saida de info $+ $chr(58) $chr(9) %presistemsaida2 $+ / $+ %presistemsaidacanal2 :halt
  ..Definir: set %presistemsaida2 $$?="Digita a REDE de saida da Informação" | set %presistemsaidacanal2 #$$?="Digita o CANAL de saida da Informação"
  .-
  .Actualizar: /actualizar 
  .Actualizar Canais/Redes: /actualizar-redes-canais 
}