| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Sep 28, 2020 2:27 pm Post subject: timed unset of a channel mode and kill timer if running |
|
|
hey there,
i was curious how this code that was checking for ban +b m:*!*@* could be modified we actually wanted to check for channel mode +U and -U
if +U is set we wanted to have a timer remove it after 20 min
and if some chanops unsets it #channel -U before the timer has expired 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($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:*!*@*
}
}
|
and instead of pushmode we wanted to use a regular mode used |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Sep 28, 2020 5:25 pm Post subject: |
|
|
| so basically if channel mode +U has been set to have a timer unset it in 20 minutes but if a chanop or anything else unsets it manually -U to halt the timer as its no longer needed |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Sep 28, 2020 5:42 pm Post subject: |
|
|
i tried this but it didnt react as it prob doesnt recognize the channel mode +U
-U
| Code: |
bind mode - "#% +U" runbanX5
bind mode - "#% -U" stopbanX5
proc runbanX5 {nick uhost handle chan mode target} {
if {[string first U [getchanmode $target]] ne "-1"} {
set ::btimer($chan) [list [timer 20 [list rmbanX5 $chan]]]
}
}
proc stopbanX5 {nick uhost handle chan mode target} {
if {[string first U [getchanmode $target]] ne "-1"} {
rmbanX5 $chan
}
}
proc rmbanX5 {chan} {
if { [array exists ::btimer] && [info exists ::btimer($chan)] } {
if { [lsearch -index 2 [timers] $::btimer($chan)] != -1} {
killtimer $::btimer($chan)
}
unset ::btimer($chan)
}
if {[string first U [getchanmode $chan]] ne "-1"} {
putnow "mode $chan -U"
}
}
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Oct 05, 2020 9:08 am Post subject: |
|
|
| Is there any way to achieve this? |
|
| Back to top |
|
 |
|