egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Logger TCL

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Ashoq
Voice


Joined: 17 Jul 2010
Posts: 11

PostPosted: Wed Sep 15, 2010 2:12 pm    Post subject: Logger TCL Reply with quote

hi everyone Smile

i have a Logger TCL Script it works fine

i just need to add a REFRESH every 60 secondes plz

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) "~/public_html/irc/"

#;;; 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) "Day"

# Modes
set logger(color1) "<font color='#FF0000'>"
# Text
set logger(color2) "<font color='#008080'>"
# Action
set logger(color3) "<font color='#9C009C'>"
# Notice / other
set logger(color4) "<font color='#7F0000'>"
# Timestamps
set logger(color5) "<font color='#0000FF'>"
# Topic
set logger(color6) "<font color='#D889B8'>"
# Join
set logger(color7) "<font color='#FFCC00'>"
# Part
set logger(color8) "<font color='#669900'>"
# Nick
set logger(color9) "<font color='#AA0078'>"
# Quit
set logger(color10) "<font color='#CCCCCC'>"


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


bind raw - "MODE" logger:raw

proc logger:raw { from keyword text } {
   global logger
   set nick [lindex [split $from "!"] 0]
   set chan [lindex [split $text] 0]
   set mode [lindex [split $text] 1]
   set arguments [lrange [split $text] 2 end]
   if {[validchan $chan] && [string tolower $chan] == "#maroc-love" } {
      logger:save $chan "$logger(color1)* $nick sets mode: $mode $arguments"
   }
}


### Events
bind join - "#maroc-love *!*@*" logger:join
bind part - "#maroc-love *!*@*" logger:part
bind sign - "#maroc-love *!*@*" logger:quit
bind pubm - "#maroc-love *" logger:text
bind nick - "#maroc-love *" logger:nick
bind kick - "#maroc-love *" logger:kick
# bind mode - "#maroc-love *" logger:mode
bind topc - "#maroc-love *" logger:topic
bind raw - "333" logger:topic-author
bind ctcp - "ACTION" logger:action
bind notc - * logger:notice
bind rejn - "#maroc-love *!*@*" logger:rejn
bind splt - "#maroc-love *!*@*" logger:split


### Primary Commands
proc logger:join {nick uhost handle chan} {
  global logger botnick
  if {$nick == $botnick} {
    if {[file exists "$logger(dir)$chan.html"] == "0" } {
      set log "[open "$logger(dir)$chan.html" a]"
      puts $log "<html><head><title>$chan [strftime "%d%b%G"]</title></head>"
      puts $log "<body bgcolor=\"#000000\"><tt>"
      close $log
#      putquick "TOPIC $chan"
    }
    set log "[open "$logger(dir)$chan.html" a]"
    puts $log "<br>"
    puts $log "$logger(color5)Session Start: [strftime "%a %b %d %T %Y"]</font><br>"
    puts $log "$logger(color5)Session Ident: $chan</font><br>"
    puts $log "$logger(color5)\[[strftime "%a%d%b.%H:%M:%S"]\]</font> $logger(color1)* Now talking in $chan</font><br>"
    close $log
  } else {
    logger:save $chan "$logger(color7)* Joins: $nick ($uhost)"
  }
}

proc logger:rejn { nick uhost handle chan } {
   global logger
   logger:save $chan "$logger(color7)* Rejoin from split: $nick ($uhost)"
}

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

proc logger:quit {nick uhost handle chan reason} {
  global logger
  logger:save $chan "$logger(color10)* Quits: $nick ($uhost) ($reason)"
  #logger:save $chan "$logger(color1)* $nick ($uhost) Quit ($reason)"
}

proc logger:split { nick uhost handle chan } {
   global logger
   logger:save $chan "$logger(color10)* Lost in the netsplit: $nick ($uhost)"
}

proc logger:text {nick uhost handle chan text} {
  global logger
  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 "$logger(color2)($nick) $text"
}

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

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

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

proc logger:topic {nick uhost handle chan topic} {
  global logger
  if {[string tolower $chan] == "#maroc-love" } {
    if {$nick == "*"} {
      logger:save $chan "$logger(color6)* Topic is '$topic'"
    } else {
      logger:save $chan "$logger(color6)* $nick changes topic to '$topic'"
    }
  }
}

proc logger:topic-author {from keyword text} {
  global logger
  set chan [lindex [split $text] 0]
  if {[validchan $chan] && [string tolower $chan] == "#maroc-love" } {
    logger:save [lindex $text 1] "$logger(color6)* Set by [lindex $text 2] on [strftime "%a %b %d %T" [lindex $text 3]]"
  }
}

proc logger:action {nick uhost handle dest keyword text} {
  global logger
  if {[validchan $dest] == "1" && [string tolower $dest] == "#maroc-love" } {
    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 "$logger(color3)* $nick $text"
  }
}

proc logger:notice { nick uhost handle text dest } {
        global logger
   if {[validchan $dest] && [string tolower $dest] == "#maroc-love" } {
      logger:save $dest "$logger(color4)-$nick:$dest- $text"
   }
}


### Secondary Commands
proc logger:save {chan text} {
  global logger
   set log "[open "$logger(dir)[string tolower $chan.html]" a]"
   puts $log "$logger(color5)\[[strftime "%a%d%b.%H:%M:%S"]\]</font> [logger:strip $text]</font><br>"
  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
  if {[file exists "$logger(dir)#maroc-love.html"] == "1" } {
    if {[file exists "$logger(dir)[lindex [split #maroc-love "#"] 1]"] == "0" } {
      file mkdir $logger(dir)[lindex [split #maroc-love "#"] 1]
    }
    file rename -force "$logger(dir)#maroc-love.html" "$logger(dir)[lindex [split #maroc-love "#"] 1]/#maroc-love.[strftime "%G%b%d" [expr [unixtime] - 3600]].html"
  }
  set log "[open "$logger(dir)#maroc-love.html" w]"
  puts $log "<html><head><title>#maroc-love [strftime "%d%b%G"]</title></head>"
  puts $log "<body bgcolor=\'#000000\'><tt>"
  puts $log "<br>"
  puts $log "$logger(color5)Session Start: [strftime "%a %b %d %T %Y"]</font><br>"
  puts $log "$logger(color5)Session Ident: #maroc-love</font><br>"
  puts $log "$logger(color5)\[[strftime "%a%d%b.%H:%M:%S"]\]</font> $logger(color1)* Now talking in #maroc-love</font><br>"
  close $log
  putquick "TOPIC #maroc-love"
  logger:time
}


logger:time


putlog "TCL Logger.tcl Loaded!"
Back to top
View user's profile Send private message
DarkRaptor
Voice


Joined: 15 Apr 2006
Posts: 36
Location: Trois-Rivières, Qc

PostPosted: Thu Sep 16, 2010 12:00 am    Post subject: Reply with quote

Hi Ashoq,

I found this
_________________
DarkRaptor @ irc.undernet.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber