| View previous topic :: View next topic |
| Author |
Message |
BCyo+8C4 Voice
Joined: 03 Sep 2006 Posts: 24
|
Posted: Sat Jan 27, 2007 8:07 pm Post subject: first warn, then kick |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
BCyo+8C4 Voice
Joined: 03 Sep 2006 Posts: 24
|
Posted: Sun Jan 28, 2007 7:49 am Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jan 28, 2007 8:01 am Post subject: |
|
|
| 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 |
|
 |
BCyo+8C4 Voice
Joined: 03 Sep 2006 Posts: 24
|
Posted: Sun Jan 28, 2007 8:41 am Post subject: |
|
|
| 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 |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Sun Jan 28, 2007 8:42 am Post subject: |
|
|
| I wouldn't count on it. It will work fine. |
|
| Back to top |
|
 |
BCyo+8C4 Voice
Joined: 03 Sep 2006 Posts: 24
|
Posted: Sun Jan 28, 2007 9:27 am Post subject: |
|
|
i tried it and cpu usage went up 2% 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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jan 28, 2007 10:08 am Post subject: |
|
|
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 |
|
 |
BCyo+8C4 Voice
Joined: 03 Sep 2006 Posts: 24
|
Posted: Sun Jan 28, 2007 3:27 pm Post subject: |
|
|
thanks, that one works better  |
|
| Back to top |
|
 |
|