| View previous topic :: View next topic |
| Author |
Message |
DaRkOoO Halfop
Joined: 27 Sep 2008 Posts: 67
|
Posted: Mon Mar 30, 2009 6:09 pm Post subject: topic script |
|
|
Hello everyone..
I'm using this tcl for topic:
| Code: | bind pub - !topic holm-pub_topic
proc holm-pub_topic {nick uhost handle channel text} {
global botnick voice_chan voice_flag
if {[isvoice $nick $channel]} {
if {$text == ""} {
puthelp "NOTICE $nick :Usage: !topic <topic>"
return 0
}
if {[isop $botnick $channel] == "0"} {
puthelp "NOTICE $nick :Sorry, I'm not a op on $channel."
return 0
}
if {[isop $botnick $channel] == "1"} {
putserv "TOPIC $channel :$nick: $text"
putlog "#$nick# !topic $text"
}
}
} |
Now,I need : If someone try to use !topic with word channel or http or www or #,bot should ban him(and don't set that one topic ofc)
Regards,
Darko. |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Mon Mar 30, 2009 7:44 pm Post subject: |
|
|
I haven't tested it but should be OK. Give it a try please
| Code: |
set vHolmBanTime 10
set vHolmBadTopic {
"html"
"#"
"www"
"channel"
}
bind PUB - !topic pHolmTopic
proc pHolmTopic {nick uhost hand channel txt} {
global botnick vHolmBadTopic vHolmBanTime
if {([isvoice $nick $channel]) || ([isop $nick $channel])} {
set topic [string trim $txt]
if {[llength [split $topic]]] != 0} {
if {[botisop $channel]} {
foreach word $vHolmBadTopic {
if {[string match -nocase "*$word*" $topic]} {
newchanban $channel $nick!*@* $botnick "bad topic *$word*" $vHolmBanTime
return 0
}
}
putserv "TOPIC $channel :$nick \:$topic"
putlog "#$nick# !topic $topic"
} else {puthelp "NOTICE $nick :-error- Bot needs to be an op on $channel to change the topic"}
} else {puthelp "NOTICE $nick :-error- Correct syntax is !topic <topic>"}
} else {puthelp "NOTICE $nick :-error- Only channel voices or above are allowed to change the topic"}
return 0
}
|
_________________ I must have had nothing to do |
|
| Back to top |
|
 |
DaRkOoO Halfop
Joined: 27 Sep 2008 Posts: 67
|
Posted: Tue Mar 31, 2009 9:02 am Post subject: |
|
|
Works,just this line | Code: | | if {[llength [split $topic]]] != 0} { | should be | Code: | | if {[llength [split $topic]] != 0} { |
And now I need to be able to specify it just for one,or two channels,and to make bot dont kick/ban his owner[s].. )) |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Mar 31, 2009 11:27 am Post subject: |
|
|
Please excuse the extra close bracket in my earlier code. My editor should have picked up on that.
Now will work only in channels with the special flag set in the bot's partyline as follows :-
.chanset #channelname +topic
Now will exempt users with whatever global bot flag is set in the configuration section
| Code: |
# *** Configuration *** #
# duration of bans in minutes
set vHolmBanTime 10
# global bot flag to exempt from bad topic ban
# o = global operator
# m = global master
# n = global owner
set vHolmExemptFlag n
# list of bad topic words/phrases
set vHolmBadTopic {
"html"
"#"
"www"
"channel"
}
# *** Code *** #
setudef flag topic
bind PUB - !topic pHolmTopic
proc pHolmTopic {nick uhost handle channel txt} {
global botnick vHolmBadTopic vHolmBanTime vHolmExemptFlag
if {[channel get $channel topic]} {
if {([isvoice $nick $channel]) || ([isop $nick $channel])} {
set topic [string trim $txt]
if {[llength [split $topic]] != 0} {
if {[botisop $channel]} {
if {![matchattr $handle $vHolmExemptFlag]} {
foreach word $vHolmBadTopic {
if {[string match *$word* $txt]} {
newchanban $channel $nick!*@* $botnick "bad topic *$word*" $vHolmBanTime
return 0
}
}
}
putserv "TOPIC $channel :$nick \:$topic"
putlog "#$nick# !topic $topic"
} else {puthelp "NOTICE $nick :-error- I need to be an op on $channel to change the topic"}
} else {puthelp "NOTICE $nick :-error- Correct syntax is !topic <topic>"}
} else {puthelp "NOTICE $nick :-error- Only channel voices or above are allowed to change the topic"}
}
return 0
}
|
I'm sure stuff like this has been written before in the vast Tcl archive on this site. I sort of feel I'm reinventing the wheel. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
DaRkOoO Halfop
Joined: 27 Sep 2008 Posts: 67
|
Posted: Tue Mar 31, 2009 12:20 pm Post subject: |
|
|
Works fine,thanks  |
|
| Back to top |
|
 |
|