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 

lol.tcl help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
eXtremer
Op


Joined: 07 May 2008
Posts: 138

PostPosted: Tue Jul 22, 2008 9:56 am    Post subject: lol.tcl help Reply with quote

Hi all.
I'm using lol.tcl, please don't tell me to find and ask the Author, I already contacted him once when I had another problem, but he is busy with other things now, he does not offer support anymore.

When I use the ban command, I want the script to add the local time and date to the reason.

I already added the "by $nick" in the reason, now I need the date and time.

Example of what I want:

Code:
<eXtremer> !ban tester
*** Bot sets mode: +b *!*@host.com
*** [Banned]: tester
*** tester was kicked by Bot (Requested, (16:50/22.08.08) by eXtremer)


The CODE:

Code:
### !BAN <nick|mask> [time] [reason]

proc pub_lol_ban {nick host hand chan arg} {
   set arg [charfilter $arg]
   global lol botnick
   if {![check $hand $nick $host]} {
      if {$lol(silent) == 1 || [checksilent $hand]} {return 0}
            puthelp "NOTICE $nick :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
      return 0
   }
   if {[llength $arg] < 1} {
      puthelp "NOTICE $nick :\002Usage:\002 [string trim $lol(cmdchar)]ban <nick|mask> \[time\] \[reason\]"
      return 0
   }
   set who [lindex $arg 0]
   if {[strlwr $who] == [strlwr $botnick]} {
      puthelp "NOTICE $nick :Yeah right, like I'm going to let you ban ME!"
      return 0
   }
   
   set ti [lindex $arg 1]
   if {[isnumber $ti]} {
      set reason [lrange $arg, 2 end]
   } {
      set ti ""
      set reason [lrange $arg, 1 end]
   }

   if {$reason == ""} { set reason "Requested," }
   
   if {[onchan $who $chan]} {
      if { $lol(bantype) == 0 } {
         set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
         set usermask [lindex [split [getchanhost $who $chan] "@"] 0]      
         set banmask *!*$usermask@$ipmask
      } else {
         set banmask [getchanhost $who $chan]
                 set banmask "*!*[string range $banmask [string first @ $banmask] e]"
      }   
   } else {        
      set banmask [lindex $arg 0]
      if {[string first "!" $banmask] == -1 && [string first "@" $banmask] == -1} {
         if {[isnumber [string index $banmask 0]]} {
            set banmask *!*@$banmask
         } else {
             set banmask $banmask*!*@*
         }
      }
      if {[string first "!" $banmask] == -1} { set banmask *!*$banmask }
      if {[string first "@" $banmask] == -1} { set banmask $banmask*@* }
   }
                  
   if {![botisop $chan]} { return 0 }
   putserv "MODE $chan +b $banmask"

     foreach chanuser [chanlist $chan] {
         if {[string match [strlwr $banmask] [strlwr "$chanuser![getchanhost $chanuser $chan]"]] && $chanuser != $botnick } {
         if {[nick2hand $chanuser $chan] != "*"} {
            if {$hand != [nick2hand $chanuser $chan]} {
               if {[matchattr [nick2hand $chanuser $chan] o|o $chan] && ![matchattr $hand o|o $chan]} {
                                 puthelp "NOTICE $nick :Sorry, you must be an operator to ban an operator."
                  return 0
               }
               if {([matchattr [nick2hand $chanuser $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan]} {
                                 puthelp "NOTICE $nick :Sorry, you must be a master to ban a master or a bot."
                  return 0
               }
            }
         }
                putkick $chan $chanuser [join [lappend reason "by $nick"]]
      }
       }   

   switch $ti {
      ""
      {
         newchanban $chan $banmask $nick [join [lappend reason ""]]
         puthelp "NOTICE $nick :New mask added : $banmask"
      }
      0
      {
         newchanban $chan $banmask $nick [join [lappend reason ""]] $ti
         puthelp "NOTICE $nick :New mask added permanently : $banmask"
      }
      default
      {
         newchanban $chan $banmask $nick [join [lappend reason ""]] $ti
         puthelp "NOTICE $nick :New mask added for $ti minutes : $banmask"
      }
   }
   return 0
}
Back to top
View user's profile Send private message
MenzAgitat
Op


Joined: 04 Jul 2006
Posts: 118
Location: France

PostPosted: Sun Jul 27, 2008 8:36 pm    Post subject: Reply with quote

 
Code:
strftime "%H:%M/%d.%m.%Y" [unixtime]
Back to top
View user's profile Send private message Visit poster's website
eXtremer
Op


Joined: 07 May 2008
Posts: 138

PostPosted: Mon Jul 28, 2008 4:47 am    Post subject: Reply with quote

MenzAgitat wrote:

Code:
strftime "%H:%M/%d.%m.%Y" [unixtime]


Hey MenzAgitat thanks, but if you could tell me where to add this line I'll apreciate.
Back to top
View user's profile Send private message
MenzAgitat
Op


Joined: 04 Jul 2006
Posts: 118
Location: France

PostPosted: Mon Jul 28, 2008 10:39 am    Post subject: Reply with quote

 
In each occurence of newchanban :

replace
Code:
lappend reason " "
by
Code:
lappend reason "Requested, ([strftime "%H:%M/%d.%m.%Y" [unixtime]]) by $nick"

 
 
Back to top
View user's profile Send private message Visit poster's website
eXtremer
Op


Joined: 07 May 2008
Posts: 138

PostPosted: Tue Jul 29, 2008 3:20 am    Post subject: Reply with quote

MenzAgitat wrote:

In each occurence of newchanban :

replace
Code:
lappend reason " "
by
Code:
lappend reason "Requested, ([strftime "%H:%M/%d.%m.%Y" [unixtime]]) by $nick"




thanks a lot, it works Wink
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 -> Script Support & Releases 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