All pastes #491891 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-16 22:10 UTC
rendered paste body
;================================================
;  Simple Helpbot
;  Version 1.3 FR
;  Ecrit par: xDaeMoN
;  Email: xdaemon@xdaemon.us
;  Version Francais Par MarcGap ([Marc])
;  MarcGap@gmail.com
;  Undernet (irc.undernet.org) #Musique-Tech
;
;    Commands:  (OPÉRATEUR SEULEMENT)
;
;    !help on/off = activer ou désactiver le script
;    !next = voice le prochain user a aider
;    !helped <nick> = utiliser après avoir aidé le user
;    !list = list des users en attente
;    !clist = list des users aidés
;
;================================================

on !*:JOIN:%help.chan: {
  if ( $readini(uhelp.ini,config,stat) ) {
    writeini uhelp.ini $chan $_n1($nick) help
    .notice $nick Please wait $nick We are currently busy or already with a customer. You will be voiced as soon as possible Your are the $ini(uhelp.ini,$chan,0) online. Thanks #spxHost
  }
}

on *:TEXT:!*:%help.chan: {
  if ( $nick isop $chan ) {
    if ( !aide == $1 ) {
      if ( $2 == on ) {
        if (!$readini(uhelp.ini,config,stat)) {
          writeini uhelp.ini config stat 1
          .notice $nick ** Helpdesk activated
          .msg $chan The help desk for #spxHost has been activated.
        }
        else .notice $nick The help desk is already activated
      }
      elseif ( $2 == off ) {
        if ($readini(uhelp.ini,config,stat)) {
          .remove uhelp.ini
          .notice $nick ** Helpdesk closed
          .msg $chan The help desk for #spxHost has been closed.
        }
        else .notice $nick The help desk is already closed.
      }
    }
    elseif ( $1 == !suivant ) {
      if ($readini(uhelp.ini,config,stat)) {
        nextuser $nick $chan
      }
      else .notice $nick The helpdesk isnt activated.
    }
    elseif ( $1 == !aidé ) {
      if ( $readini(uhelp.ini,config,stat) ) {
        if ( $2 ison $chan ) { 
          if ( $readini(uhelp.ini,current,$_n1($2)) ) {
            mode $chan -v $2
            remini uhelp.ini current $_n1($2)
            .notice $2 You have been helped. Thank you for your interest about #spxHost.
          }
          else .notice $nick ** Bad commands: !helped <nick>
        }
        else .notice $nick ** Bad commands: $2 isnt on $chan $+ .
      }
      else .notice $nick The helpdesk isnt activated
    }
    elseif ( $1 == !list ) {
      if ( $readini(uhelp.ini,config,stat) ) {
        if ($ini(uhelp.ini,$chan,0) ) {
          .notice $nick ** $v1 User(s) on the waiting list **
          var %hc = 1
          while $ini(uhelp.ini,$chan,%hc) {
            .notice $nick $_n2($v1) 
            inc %hc
          }
          .notice $nick ** End of the waiting list**
        }
        else .notice $nick empty list.
      }
      else .notice $nick The helpdesk isnt activated.
    }
    elseif ( $1 == !clist ) {
      if ( $readini(uhelp.ini,config,stat) ) {
        if ( $ini(uhelp.ini,current,0) ) {
          .notice $nick ** $v1 User(s) has been helped **
          var %h = 1
          while $ini(uhelp.ini,current,%h) {
            .notice $nick $readini(uhelp.ini,current,$_n2($v1)) is currently helping $_n2($v1)
            inc %h
          }
          .notice $nick ** End of the helped customers **
        }
        else .notice $nick empty list.
      }
      else .notice $nick The helpdesk isnt activated.
    }
  }
}

alias nextuser {
  if ( $ini(uhelp.ini,$2,0) ) {
    if ( $_n2($ini(uhelp.ini,$2,1)) ison $2 ) {
      mode $2 +v $v1
      .notice $v1 $1 will pm you ! Go check your private message
      remini uhelp.ini $2 $_n1($v1)
      writeini uhelp.ini current $_n1($v1) $1
    }
    else {
      remini uhelp.ini $2 $_n1($v1)
      .timer 1 1 nextuser $1 $2
    }
  }
  else .notice $1 empty list.
}

alias _n1 { return $replace($1,[,«,],») }

alias _n2 { return $replace($1,«,[,»,]) }

on !*:PART:%help.chan: {
  if ( $readini(uhelp.ini,current,$_n1($nick)) ) remini uhelp.ini current $_n1($nick)
  elseif ( $readini(uhelp.ini,$chan,$_n1($nick)) ) remini uhelp.ini $chan $_n1($nick)
}

on !*:OP:%help.chan: {
  if ( $readini(uhelp.ini,$chan,$_n1($opnick)) ) remini uhelp.ini $chan $_n1($opnick)
}

on *:SERVEROP:%help.chan: {
  if ( $readini(uhelp.ini,$chan,$_n1($opnick)) ) remini uhelp.ini $chan $_n1($opnick)
}

on !*:QUIT: {
  if ( $readini(uhelp.ini,current,$_n1($nick)) ) remini uhelp.ini current $_n1($nick)
  elseif ($readini(uhelp.ini,%help.chan,$_n1($nick))) remini uhelp.ini %help.chan $_n1($nick)
}

on !*:KICK:%help.chan: {
  if ( $readini(uhelp.ini,current,$_n1($knick)) ) remini uhelp.ini current $_n1($knick)
  elseif ($readini(uhelp.ini,$chan,$_n1($knick))) remini uhelp.ini $chan $_n1($knick)
}

on !*:VOICE:%help.chan: {
  if ( $readini(uhelp.ini,$chan,$_n1($vnick)) ) {
    remini uhelp.ini $chan $_n1($vnick)
  }
} 

menu menubar,channel {
  Canal d'aide $iif(%help.chan, $+($chr(40),$v1,$chr(41)), (NONE))
  .$iif(%help.chan,Changer, Changer le canal d'aide):set -s %help.chan #$$?="#spxhost:"
}