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 

first warn, then kick

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


Joined: 03 Sep 2006
Posts: 24

PostPosted: Sat Jan 27, 2007 8:07 pm    Post subject: first warn, then kick Reply with quote

How would I go if I wanted to first warn a user and if he does it again in less then x seconds kick him?
I guess I'd need to create a timer when warning and then check whether such a time exists, but I don't really know how I'd do that. Could someone provide me with an short example please?

Sorry if this was asked before, couldn't find anything
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Jan 27, 2007 8:25 pm    Post subject: Reply with quote

Perhaps this might be useful.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
BCyo+8C4
Voice


Joined: 03 Sep 2006
Posts: 24

PostPosted: Sun Jan 28, 2007 7:49 am    Post subject: Reply with quote

Hi,
I got this to work in some parts, but there's still problems.
I check for certain russian letters and then warn the users. If the line contains only one of those letters it works fine, but if there's more than one in the line the script warns + kicks.

Code:
bind pubm - "*ð*"                  english
bind pubm - "*ó*"                  english
bind pubm - "*ñ*"                  english

proc english {nick host hand chan text} {
   if {([isop $nick $chan]) || ([ishalfop $nick $chan]) || ([isvoice $nick $chan])} {
      return 1;
   }
   if {[throttled $nick,$chan 90]} {
      putkick $chan $nick "speak english (autokick)"
   } else {
      putserv "PRIVMSG $chan :$nick - Please speak english in this channel!"
   }
}

proc throttled {id time} {
   global throttled
   if {[info exists throttled($id)]} {
      return 1;
   } else {
      set throttled($id) [clock sec]
      utimer $time [list unset throttled($id)]
      return 0;
   }
}
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jan 28, 2007 8:01 am    Post subject: Reply with quote

Code:
bind pubm - * english

proc english {nick host hand chan text} {
   if {([isop $nick $chan]) || ([ishalfop $nick $chan]) || ([isvoice $nick $chan])} {
      return 1
   }
   if {![regexp {[ðóñ]} $text]} {return 0}
   if {[throttled $nick,$chan 90]} {
      putkick $chan $nick "speak english (autokick)"
   } else {
      putserv "PRIVMSG $chan :$nick - Please speak english in this channel!"
   }
}

proc throttled {id time} {
   global throttled
   if {[info exists throttled($id)]} {
      return 1
   } else {
      set throttled($id) [clock sec]
      utimer $time [list unset throttled($id)]
      return 0
   }
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
BCyo+8C4
Voice


Joined: 03 Sep 2006
Posts: 24

PostPosted: Sun Jan 28, 2007 8:41 am    Post subject: Reply with quote

won't that require way more ressources as it has to regexp every single line said on chat? it's not like this is a quite chat, a days log is about 1-2mb and i fear this would kill the bot.
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sun Jan 28, 2007 8:42 am    Post subject: Reply with quote

I wouldn't count on it. It will work fine.
Back to top
View user's profile Send private message
BCyo+8C4
Voice


Joined: 03 Sep 2006
Posts: 24

PostPosted: Sun Jan 28, 2007 9:27 am    Post subject: Reply with quote

i tried it and cpu usage went up 2% Sad any other ideas to prevent this? isn't there some setting/command/whatever to tell eggdrop to perform one action per line in chat only?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jan 28, 2007 10:08 am    Post subject: Reply with quote

Although it is fine as is, you can use [string match] instead.
Code:
if {![string match {*[ðóñ]*} $text]} {return 0}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
BCyo+8C4
Voice


Joined: 03 Sep 2006
Posts: 24

PostPosted: Sun Jan 28, 2007 3:27 pm    Post subject: Reply with quote

thanks, that one works better Smile
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