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 

Op time counter

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Cr0ntab
Voice


Joined: 26 Mar 2010
Posts: 22

PostPosted: Tue Aug 06, 2013 6:06 am    Post subject: Op time counter Reply with quote

Hello. I would like to request a script but i dont know how easy it is to make.

The script i need is one that counts how many hours per day/week each of the users that match the +C flag ops in a channel. To make it more clear:

All the ops in my channel let's say #channel have the global +C flag on the bot. I want the script to count how many hours each person has opped in one day and in the week. As for how the bot will give me the hours can it create a webpage or let me know on request by a command i send in pvt?

For example if the report is given by command i type in pvt: !optimes and the bot will respond:

Oper1: Opped today: 1hr 23mins Opped this week: 14hrs 23mins.
Oper2: Opped today: 1hr 23mins Opped this week: 14hrs 23mins.

But please make it look ONLY #channel!!! cause bot sits in many chans irrelevant to #channel or perhaps the ops channel.

I appreciate if anyone takes the time to deal with this request
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue Aug 06, 2013 7:18 am    Post subject: Reply with quote

Modifyed this version of mine to look only on channels where +timespent is set and the users have +C channel flag

Code:

#### ++++ Author: MadaliN <madalinmen28@yahoo.com>
### +++ Website: www.Ascenture.ro
## +++ TCL Name: TimeSpent
# +++ Version: 2.0
#
# Commands:
#   /msg BOTNICK timespent activate <$chan>          (local or global owner)
#   /msg BOTNICK timespent deactivate <$chan>      (local or global owner)
#   /msg BOTNICK timespent <$nickname> <$chan>      (local or global owner)
#

####
# +++ Created: 6/8/2013
####

bind MSGM - * timespent:msg

setudef flag timespent

proc egghelp:timespent {min hour day month year} {
   global timespent announce noa

   set list ""
   foreach chan [channels] {
      if {[channel get $chan timespent]} {
         foreach u [chanlist $chan] {
            if {[matchattr $u -|C $chan] && [isop $u $chan]} {
               putlog "Found \002$u"
               set host [lindex [split [getchanhost $u $chan] @] 1]

               if {![info exists timespent($chan,$host)]} {
                  set timespent($chan,$host) "60 $u"
                  timespent:save
               } else {
                  set timespent($chan,$host) "[expr [lindex [split $timespent($chan,$host)] 0] + 60] $u"
                  timespent:save
               }
            }
         }
      }
   }
}

proc timespent:msg {nick uhost hand arg} {
   global timespent

   if {[lindex [split $arg] 2] != ""} {
      set chan [lindex [split $arg] 2]
      set host [lindex [split [getchanhost [lindex [split $arg] 1] $chan] @] 1]
   }

   switch -exact -- [lindex [split $arg] 0] {
      timespent {
         switch -exact -- [lindex [split $arg] 1] {
            activate {
               if {[matchattr $hand n]} {
                  channel set $chan +timespent

                  putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00312activated\003 succesfully"
               }
            }
            deactivate {
               if {[matchattr $hand n]} {
                  channel set $chan -timespent

                  putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00304deactivated\003 succesfully"
               }
            }
            reset {
               if {[matchattr $hand n]} {
                  unset -nocomplain timespent

                  putserv "PRIVMSG $nick :\002$nick\002 - Timespent with @ was RESET for everyone"
               }
            }
            default {
               if {[matchattr $hand n]} {
                  if {[string match -nocase "#*" [lindex [split $arg] 2]]} {
                     if {![info exists timespent([lindex [split $arg] 2],$host)]} {
                        putserv "PRIVMSG $nick :\002$nick\002 - Nickname \00303[lindex [split $arg] 1]\003 has no info on \00312[lindex [split $arg] 2]"
                     } else {
                        putserv "PRIVMSG $nick :\002$nick\002 - Nickname \00303[lindex [split $arg] 1]\003 idled with @ on \00312[lindex [split $arg] 2]\003 for \00303[duration [lindex [split $timespent([lindex [split $arg] 2],$host)] 0]]"
                     }
                  }
               }
            }
         }
      }
   }
}

proc timespent:save {} {
   global timespent

   set ofile [open timespent w]
   puts $ofile "array set timespent [list [array get timespent]]"
   close $ofile
}

catch {source timespent}

putlog "+++ Succesfully loaded: \00312Timpespent TCL Script"


Original script can be found at http://forum.egghelp.org/viewtopic.php?t=19314
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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