| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Apr 07, 2015 8:50 pm Post subject: check channel modes and unlock channel if locked |
|
|
greetings, im using this tcl at the moment it checks for the modes that lock channel incase some OP forgot to remove them i was wondering if it could be modified to only remove the actuall modes that are set and detected unlike as it is now where it removes the modes anyway regardless if they are set or not
| Code: | ########################################################################
### checklock.tcl v.1.0 ###
### checklock.tcl v1.0 has been made and development ###
### BY ###
### (c) SnowBot (ha0) Script Team Development (c) ###
### *** Copyright (C) 1999-2002 Clovis #Mania @ DalNet *** ###
### The purpose from this script is for educational only ###
### Not available for commercial purpose ###
### For contact you can email me at hendra_asianto@hotmail.com ###
### Our Homepage on www.snowbot.s5.com or visit our chan on #mania ###
########################################################################
#######################################################################
## --- Don't change anything below here if you don't know how ! --- ###
## ---------------------------------------------------------------- ###
## NOTE : THIS SCRIPT CAN SET BECOME AUTO AWAY .TCL WITH RANDOM AWAY MSG :)
## DEPEND'S YOUR IDEAL :)NOW... I JUST CAN GIVE A LITTLE WAY
# Set how long that bot must check modelock back again.
set timechks 30
# Version number - DON'T TOUCH!
### Start Call Command
timer $timechks snowbotchk
proc snowbotchk {} {
global timechks
foreach chan [channels] {
if {[botisop $chan]} {
if {[string match +*m* [lindex [getchanmode $chan] 0]] || [string match +*i* [lindex [getchanmode $chan] 0]] || [string match +*N* [lindex [getchanmode $chan] 0]] || [string match +*R* [lindex [getchanmode $chan] 0]] || [string match +*M* [lindex [getchanmode $chan] 0]] || [string match +*c* [lindex [getchanmode $chan] 0]]} {
putserv "MODE $chan -cimMNR"
}
}
}
timer $timechks snowbotchk
}
putlog " . . : : checklock . T C L : : . .Loaded Successfuly..."
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Apr 07, 2015 10:10 pm Post subject: |
|
|
Try this. | Code: |
########################################################################
### checklock.tcl v.1.0 ###
### checklock.tcl v1.0 has been made and development ###
### BY ###
### (c) SnowBot (ha0) Script Team Development (c) ###
### *** Copyright (C) 1999-2002 Clovis #Mania @ DalNet *** ###
### The purpose from this script is for educational only ###
### Not available for commercial purpose ###
### For contact you can email me at hendra_asianto@hotmail.com ###
### Our Homepage on www.snowbot.s5.com or visit our chan on #mania ###
########################################################################
#######################################################################
## --- Don't change anything below here if you don't know how ! --- ###
## ---------------------------------------------------------------- ###
## NOTE : THIS SCRIPT CAN SET BECOME AUTO AWAY .TCL WITH RANDOM AWAY MSG :)
## DEPEND'S YOUR IDEAL :)NOW... I JUST CAN GIVE A LITTLE WAY
# Set how long that bot must check modelock back again.
set timechks 30
# Version number - DON'T TOUCH!
### Start Call Command (made safe from rehash starting double loops)
if {![info exists chklock_running]} {
timer $timechks [list snowbotchk]
set chklock_running 1
}
proc snowbotchk {} {
global timechks
foreach chan [channels] {
if {[botisop $chan]} { set modes ""
set chanmode [lindex [split [getchanmode $chan]] 0]
if {[string match +*c* $chanmode]} { append modes c }
if {[string match +*i* $chanmode]} { append modes i }
if {[string match +*m* $chanmode]} { append modes m }
if {[string match +*M* $chanmode]} { append modes M }
if {[string match +*N* $chanmode]} { append modes N }
if {[string match +*R* $chanmode]} { append modes R }
if {$modes ne ""} { putserv "MODE $chan -$modes" }
}
}
timer $timechks [list snowbotchk]
}
putlog " . . : : checklock . T C L : : . .Loaded Successfuly..."
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Apr 07, 2015 11:09 pm Post subject: |
|
|
| oh that one seems working too tnx spike^^ |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Apr 08, 2015 6:11 am Post subject: |
|
|
Honestly I would rather rely on a bind time of one minute or whatever suits your need than to use timers.
| Code: |
namespace eval lockCheck {
setudef str lockModes
bind time * * [namespace current]::check
proc check {args} {
foreach chan [channels] {
if {![botisop $chan]} continue
set modes [split [channel get $chan lockModes] ""]
set cm [lindex [split [getchanmode $chan] +] 1]
if {[string first k $cm] != -1} {
scan $cm {%s%s} cm key
}
foreach m [split $cm ""] {
if {[lsearch -nocase $modes $m] != -1} {
if {$m eq "k"} {
pushmode $chan -k $key
} else {
pushmode $chan -$m
}
}
}
}
}
}
|
Difference between mine and yours?
- can have different lock modes to be removed for each channel in particular, just .chanset #channel lockModes mki for #channel and .chanset #anotherchannel lockModes for #anotherchannel for instance, or to be more specific .chanset #channel lockModes cimMNR
- supports removal of a channel key if such a mode is desired to be removed
- doesn't require any change of the actual script file so all changes in channel lock modes are on-the-fly
- by using pushmode it will push all mode changes in just one line rather than spamming with multiple mode changes _________________ 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: Wed Apr 08, 2015 6:22 pm Post subject: |
|
|
| nice tnx caesar |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sat Apr 25, 2015 10:26 am Post subject: |
|
|
hi SpiKe^^
but its tcl lacks some ways that should be
example: k l S
it is possible to add these modes ??? _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Apr 26, 2015 3:34 am Post subject: |
|
|
The one I posted takes care of that as well. _________________ 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: Mon Jan 23, 2017 5:33 am Post subject: |
|
|
i tried yours caesar it seems to not make difference between lower and upper case while there is a difference for example we want to use N not n and use T not t as they both are default modes and shouldnt be removed ever
.chanset * lockModes cimMRcSNk
resulted in:
10:24:23 +ctcp Sets Mode on #Cappuccino to: +imk kjhffd
10:25:01 &Hawk Sets Mode on #Cappuccino to: -imCnk kjhffd
10:25:02 &ChanServ Sets Mode on #Cappuccino to: +n
10:26:01 &Hawk Sets Mode on #Cappuccino to: -n
10:26:02 &ChanServ Sets Mode on #Cappuccino to: +n
10:27:01 &Hawk Sets Mode on #Cappuccino to: -n
10:27:01 &ChanServ Sets Mode on #Cappuccino to: +n
is there a way to use with pub cmd like
!checklock NRMcSk |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Jan 23, 2017 11:47 am Post subject: |
|
|
| Code: |
namespace eval lockCheck {
setudef str lockModes
bind time * * [namespace current]::timedCheck
bind pub m|m !checklock [namespace current]::chanCheck
proc check {chan {modes ""}} {
if {![string length $modes]} {
set modes [split [channel get $chan lockModes] ""]
}
set cm [lindex [split [getchanmode $chan] +] 1]
if {[string first k $cm] != -1} {
scan $cm {%s%s} cm key
}
foreach m [split $cm ""] {
if {[string first $m $modes] != -1} {
if {$m eq "k"} {
pushmode $chan -k $key
} else {
pushmode $chan -$m
}
}
}
}
proc timedCheck {args} {
foreach chan [channels] {
if {![botisop $chan]} continue
check $chan
}
}
proc chanCheck {nick uhost hand chan text} {
if {[scan $text {%s} modes] != 1} {
puthelp "NOTICE $nick :Usage: !checklock <modes>"
} else {
check $chan $modes
}
}
}
|
Changed the above code to make it case sensitive and got the !checklock inside. Haven't tested but in theory should work as expected.
PS: You should restart the bot to remove the old binds cos have been changed in the new code. _________________ 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: Tue Jan 24, 2017 7:38 am Post subject: |
|
|
tested some modes it doesnt seem to react to i did like
LockModes: cimMSNROAk
yet when setting like +A on channel it didnt remove |
|
| Back to top |
|
 |
|