Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


[Question] Logger.tcl
#1
Salutations,

J'utilise le script Logger afin de créer des logs pour mes statistiques.
Seulement je constate qu'il ne log pas ce que le bot 'dit' et j'aimerai bien que les phrase dites par le bot soient loggée aussi.

Vous pouvez m'aidez?
Voici le script :


Code:
########################################################
#        Eggdrop Logger 2.0 - www.mircstats.com        #
#        Logging in mIRC 6.17 format. 27/04/2006       #
#                                                      #
#   Make sure you have created the dir 'logger(dir)'   #
#                                                      #
#         Created by Lanze <simon@freeworld.dk>        #
#         Improved by zowtar <zowtar@gmail.com>        #
#                                                      #
########################################################


### Configuration


#;;; Where the logs will be saved.
set logger(dir) "logs/"

#;;; Strip codes?
#;;; 0 = save codes\colors
#;;; 1 = no save codes\colors
set logger(strip) "1"

#;;; Save by Day, Week, Month or Disable?
set logger(time) "Month"



# # # # # # # # # # # # # # # #   DO NOT CHANGE ANYTHING BELOW HERE   # # # # # # # # # # # # # # # #



### Events
bind join - "#* *!*@*" logger:join
bind part - "#* *!*@*" logger:part
bind sign - "#* *!*@*" logger:quit
bind pubm - "#* *" logger:text
bind nick - "#* *" logger:nick
bind kick - "#* *" logger:kick
bind mode - "#* *" logger:mode
bind topc - "#* *" logger:topic
bind raw - "333" logger:topic-author
bind ctcp - "ACTION" logger:action


### Primary Commands
proc logger:join {nick uhost handle chan} {
  global logger botnick
  if {$nick == $botnick} {
    set log "[open "$logger(dir)$chan.log" a]"
    puts $log "\r"
    puts $log "Session Start: [strftime "%a %b %d %T %Y"]\r"
    puts $log "Session Ident: $chan\r"
    puts $log "\[[strftime "%H:%M"]\] * Now talking in $chan\r"
    close $log
  } else {
    logger:save $chan "* $nick ($uhost) has joined $chan"
  }
}

proc logger:part {nick uhost handle chan msg} {
  if {$msg == ""} {
    logger:save $chan "* $nick ($uhost) has left $chan"
  } else {
    logger:save $chan "* $nick ($uhost) has left $chan ($msg)"
  }
}

proc logger:quit {nick uhost handle chan reason} {
  logger:save $chan "* $nick ($uhost) Quit ($reason)"
}

proc logger:text {nick uhost handle chan text} {
  if {[isop $nick $chan] == "1"} {
    set nick "@$nick"
  } elseif {[ishalfop $nick $chan] == "1"} {
    set nick "%$nick"
  } elseif {[isvoice $nick $chan] == "1"} {
    set nick "+$nick"
  }
  logger:save $chan "<$nick> $text"
}

proc logger:nick {nick uhost handle chan newnick} {
  logger:save $chan "* $nick is now known as $newnick"
}

proc logger:kick {nick uhost handle chan target reason} {
  logger:save $chan "* $target was kicked by $nick ($reason)"
}

proc logger:mode {nick uhost handle chan mode victim} {
  logger:save $chan "* $nick sets mode: $mode $victim"
}

proc logger:topic {nick uhost handle chan topic} {
  if {$nick == "*"} {
    logger:save $chan "* Topic is '$topic'"
  } else {
    logger:save $chan "* $nick changes topic to '$topic'"
  }
}

proc logger:topic-author {from keyword text} {
  logger:save [lindex $text 1] "* Set by [lindex $text 2] on [strftime "%a %b %d %T" [lindex $text 3]]"
}

proc logger:action {nick uhost handle dest keyword text} {
  if {[validchan $dest] == "1"} {
    if {[isop $nick $dest] == "1"} {
      set nick "@$nick"
    } elseif {[ishalfop $nick $dest] == "1"} {
      set nick "%$nick"
    } elseif {[isvoice $nick $dest] == "1"} {
      set nick "+$nick"
    }
    logger:save $dest "* $nick $text"
  }
}


### Secondary Commands
proc logger:save {chan text} {
  global logger
  set log "[open "$logger(dir)$chan.log" a]"
  puts $log "\[[strftime "%H:%M"]\] [logger:strip $text]\r"
  close $log
}


### Tertiary Commands
proc logger:strip {text} {
  global logger numversion
  if {$logger(strip) == "1"} {
    if {$numversion >= "1061700"} {
      set text "[stripcodes bcruag $text]"
    } else {
      regsub -all -- {\002,\003([0-9][0-9]?(,[0-9][0-9]?)?)?,\017,\026,\037} $text "" text
    }
  }
  return $text
}


### Time
proc logger:time {} {
  global logger
  foreach bind [binds time] {
    if {[string match "time * logger:time-save" $bind] == "1"} {
      unbind time - "[lindex $bind 2]" logger:time-save
    }
  }
  switch [string toupper $logger(time)] {
    DAY {
      bind time - "00 00 [strftime "%d" [expr [unixtime] + 86400]] * *" logger:time-save
    }
    WEEK {
      bind time - "00 00 [strftime "%d" [expr [unixtime] + ((7 - [strftime "%w"]) * 86400)]] * *" logger:time-save
    }
    MONTH {
      bind time - "00 00 01 [strftime "%m" [expr [unixtime] + ((32 - [strftime "%d"]) * 86400)]] *" logger:time-save
    }
  }
}

proc logger:time-save {minute hour day month year} {
  global logger
  foreach channel [channels] {
    if {[file exists "$logger(dir)$channel.log"] == "1"} {
      file rename -force "$logger(dir)$channel.log" "$logger(dir)${channel}_\[[strftime "%Y.%m.%d"]\].log"
    }
    set log "[open "$logger(dir)$channel.log" w]"
    puts $log "\r"
    puts $log "Session Start: [strftime "%a %b %d %T %Y"]\r"
    puts $log "Session Ident: $channel\r"
    puts $log "\[[strftime "%H:%M"]\] * Now talking in $channel\r"
    close $log
    putquick "TOPIC $channel"
  }
  logger:time
}


logger:time


putlog "TCL Logger.tcl Loaded!"


Messages In This Thread
[Question] Logger.tcl - by Utas - 22/02/2010, 19:45
RE: [Question] Logger.tcl - by Marc - 24/02/2010, 04:10
RE: [Question] Logger.tcl - by Artix - 02/03/2010, 14:08
RE: [Question] Logger.tcl - by Utas - 08/03/2010, 19:28

Possibly Related Threads…
Thread Author Replies Views Last Post
  petit soucis avec logger lesny 54 33,885 12/08/2011, 18:52
Last Post: lesny
  Probleme repetitions de question trivia.tcl athor69 1 3,282 14/05/2011, 13:35
Last Post: Helias
  plusieurs question en 1 tedcampa 7 5,402 22/03/2011, 11:45
Last Post: djkenny
  Question sur le onchan fedora 4 3,899 23/02/2011, 17:29
Last Post: fedora
  question debutant marawam 8 4,384 02/11/2009, 16:52
Last Post: marawam
  question sur shoutcast1.03.tcl willshar 2 2,774 11/04/2009, 22:17
Last Post: MorDenX
  Question sur les timers MewT 3 4,091 29/06/2008, 15:47
Last Post: DaV34

Forum Jump:


Users browsing this thread: 1 Guest(s)