| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Aug 25, 2020 6:51 pm Post subject: check banlist for certain banmasks |
|
|
i was wondering how this could be used to check if banmask m:*!*@* is still in the banlist of channel when the timer expires and triggers the check
because we dont want it to remove something wich is no longer there
| Code: |
bind mode - "#% +b" timedmutechecker
proc timedmutechecker {nick uhost hand chan mc ban} {
if {[string match -nocase m:*!*@* $ban]} { after [expr {20*1000*60}] [list pushmode $chan -b m:*!*@*] }
}
|
Last edited by simo on Wed Aug 26, 2020 10:36 am; edited 1 time in total |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Aug 26, 2020 1:24 am Post subject: |
|
|
The idea is if anyone sets this ban:
+b m:*!*@*
to have a timer remove it but if some chan op manually removed it with -b m:*!*@* to stop the previous set timer as the ban mask is no longer there to be removed |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Aug 26, 2020 10:35 am Post subject: |
|
|
i tried using this but it didnt seem to work to stop the timer
| Code: |
bind mode - "#% -b" timedmutecheckerX2
proc timedmutecheckerX2 {nick uhost hand chan mc ban} {
if {[string match -nocase m:*!*@* $ban]} {
foreach thetimer [timers] {
if {[string equal -nocase timedmutechecker [lindex $thetimer 1]]} {
killtimer [lindex $thetimer 2]
break
}
}
}
}
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Aug 26, 2020 11:46 am Post subject: |
|
|
i tried various examples i got here: http://forum.egghelp.org/viewtopic.php?t=9941
but none seems to work for me im not sure if that should work for the kkind of timer i use here the: after |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Aug 27, 2020 2:51 am Post subject: |
|
|
I'm trying to understand your problem...
An op can add a +b m:*!*@* to mute anyone on the channel, and you want the eggdrop to automaticaly remove it after 20 minutes.
BUT if someone removes the ban, you want to kill the timer.
| Code: | bind mode - "#% +b" runban
bind mode - "#% -b" stopban
proc runban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
set ::btimer [list [timer 20 rmban]]
}
}
proc stopban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
rmban
}
}
proc rmban {} {
if { [info exists ::btimer] } {
killtimer $::btimer
unset ::btimer
}
} |
Explanations
The runban proc create the timer, and will run "rmban" at the end of the timer.
The stopban proc directly call the rmban proc
The rmban proc checks if the timer exists, and if it exists, it kills the timer and unset its id. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Aug 27, 2020 12:53 pm Post subject: |
|
|
| tnx for your reply CrazyCat ive tested it but it doesnt seem to remove the banmask after 20 min if nobody has removed it with -b m:*!*!@ |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Aug 27, 2020 2:18 pm Post subject: |
|
|
True, I focused on your trouble and forget to remove the ban
You can try the following code, but I've a small doubt about the ischanban usage and I can't test it right now. Tell me if it doesn't work, I'll look deeper.
| Code: | bind mode - "#% +b" runban
bind mode - "#% -b" stopban
proc runban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
set ::btimer [list [timer 20 rmban $chan]]
}
}
proc stopban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
rmban $chan
}
}
proc rmban {chan} {
if { [info exists ::btimer] } {
killtimer $::btimer
unset ::btimer
}
if { [ischanban m:*!*@* $chan] } {
pushmode $chan -b m:*!*@*
}
} |
Another way is to have a variable to know if the ban is set or not, but it's the ugly way imho  _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Aug 27, 2020 3:32 pm Post subject: |
|
|
getting these errors:
Tcl error in script for 'timer16203':
wrong # args: should be "rmban chan"
Tcl error in script for 'timer16220':
invalid timerID |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri Aug 28, 2020 5:17 am Post subject: |
|
|
I made tests and corrected the script, this one may work
| Code: | bind mode - "#% +b" runban
bind mode - "#% -b" stopban
proc runban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
set ::btimer($chan) [list [timer 20 [rmban $chan]]]
}
}
proc stopban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
rmban $chan
}
}
proc rmban {chan} {
if { [info exists ::btimer($chan)] } {
killtimer $::btimer($chan)
unset ::btimer($chan)
}
if { [ischanban m:*!*@* $chan] } {
pushmode $chan -b m:*!*@*
}
} |
I've changed the timer creation (timer is now set in an array) and the call of rmban _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Fri Aug 28, 2020 1:46 pm Post subject: |
|
|
i tried your latest post and the moment i the ban i get
Tcl error [stopban]: invalid timerID
and it unbans instantly |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Aug 29, 2020 1:44 pm Post subject: |
|
|
Shouldn't it be:
| Code: |
timer sec [list proc $arg1 $arg2 ...]
|
I mean shouldn't:
| Code: |
set ::btimer($chan) [list [timer 20 [rmban $chan]]]
|
be:
| Code: |
set ::btimer($chan) [timer 20 [list rmban $chan]]
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Aug 29, 2020 5:03 pm Post subject: |
|
|
tried that and got the same error caesar:
Tcl error in script for 'timer33938':
invalid timerID |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Aug 30, 2020 10:03 am Post subject: |
|
|
Ok, I think I understand the errors I made...
Try this:
| Code: | bind mode - "#% +b" runban
bind mode - "#% -b" stopban
proc runban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
set ::btimer($chan) [list [timer 20 [list rmban $chan]]]
}
}
proc stopban {nick uhost handle chan mode target} {
if {[string match -nocase m:*!*@* $target]} {
rmban $chan
}
}
proc rmban {chan} {
if { [array exists ::btimer] && [info exists ::btimer($chan)] } {
if { [lsearch -index 2 [timers] $::btimer($chan)] != -1} {
killtimer $::btimer($chan)
}
unset ::btimer($chan)
}
if { [ischanban m:*!*@* $chan] } {
pushmode $chan -b m:*!*@*
}
} |
Errors occured because when timer is ended, it's automaticaly unsetted, so we don't have to manualy kill it.
The 2 difficulties in the script:
- how to well launch the timer and keep its ID. list is the solution
- how to find if the timer exists using its ID. lsearch is the solution  _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Aug 30, 2020 11:22 am Post subject: |
|
|
tried your last post CrazyCat and it seems to work fine tnx alot
i like to thank Caesar too |
|
| Back to top |
|
 |
|