set keychannels "#chan1 #chan2"
set masterchannel "#chanxy"
bind pub m !globalkey keychan
proc keychan {n u h c t} {
if {![string match -nocase $::masterchannel $c]} { return 0 }
foreach i $::keychannels {
if {[botisop $i]} {putserv "MODE $i :$t" -next}
}
savechannels
}
Tested, working.
Includes savechannels (as asked for), however changing the channel record wasn't asked for.
proc keychan {n u h c t} {
if {![string match -nocase $::masterchannel $c]} { return 0 }
foreach i $::keychannels {
if {[botisop $i]} {putserv "MODE $i +k $t" -next}
}
}
proc keychan {n u h c t} {
if {![string match -nocase $::masterchannel $c]} { return 0 }
foreach i $::keychannels {
if {[botisop $i]} {
putserv "MODE $i +k $t"
}
}
}
proc keychan {n u h c t} {
putlog "recieved command from $n on $c"
if {![string match -nocase $::masterchannel $c]} {
putlog "channel does not match $::masterchannel"
return 0
}
foreach i $::keychannels {
if {[botisop $i]} {
putlog "changing key in $c to $t"
putserv "MODE $i +k $t"
}
}
}
The problem is, that you can not change the key if you don't remove it first. And to remove it, you must know the current key, because "mode #chan -k" dont work. Is it possible, that the script check which key is actually set an remove it first with mode "#chan -k key"?
Godzilla wrote:The problem is, that you can not change the key if you don't remove it first. And to remove it, you must know the current key, because "mode #chan -k" dont work. Is it possible, that the script check which key is actually set an remove it first with mode "#chan -k key"?