bind o|o !settopic settopic
bind o|o !topic topicchange
proc settopic {nick uhost hand chan topic} {
set ::topicproto($chan) $topic
return 1
}
proc topicchange {nick uhost hand chan topic} {
if {[info exists ::topicproto($chan)]} {
if {[botisop] || [botishalfop]} {
putserv "TOPIC $chan :[string map [list * $topic] $::topicproto($chan)]"
return 1
} else {
puthelp "NOTICE $nick :Sorry, I don't have ops."
}
} else {
puthelp "NOTICE $nick :You must set the prototype with !settopic first."
}
return 0
}
Notes:
if the prototype contains more than one *, every * will be replaced with the same argument. However, you can replace the the * with any other character. You could even use a non readable character or a string like "INSERT HERE".
The prototype gets reset on every restart (not rehash) of the bot, since the array is not saved to disc ^-^.
Change o|o to what every priviliges it should be limited to.
Script is untested and might therefore contain either typos or stupid logical mistakes .