how to block the .say command if SOMEWORD is the first word?

Old posts that have not been replied to for several years.
Locked
C
Calimero

how to block the .say command if SOMEWORD is the first word?

Post by Calimero »

Hi,

My bots are on chatnet. The channel guardian (like X on undernet) is called k9. You can command k9 with public commands starting with "K9 command" (eg: k9 op nick). You can command k9 by private messages too (.msg k9 command #channel ...)

I would like to block my bots commands .msg and .say if k9 is the first word in the sentence.

eg:

.say #mychan k9 op bad-nick (blocked !)
.say #mychan hello all (ok)

Can someone help me about that ? I don't want a "made" script, but I need some help to start coding that (what do you think I should look at to have an idea about what to do ?)

TIA and sorry for my bad english.

__
Calimero
p
psykotrop

Post by psykotrop »

ok... it will be a solution... i made it few years ago for X W .. the notice:dcc:msg proc pemit to send a private to all if $nick isn't X , x or W...

You have to use .msgowner x message to send a message with X and had +n (owner) level.


sincerely,
Psykotrop



Tcl Code :

bind dcc o msg notice:dcc:msg
bind dcc n msgowner notice:dcc:msgowner

proc notice:dcc:msgowner {hand idx arg} {
if { [llength $arg] < 1 } {
putdcc $idx "Usage: msg <nick> <message>"
return 0
}
set sarg [string first " " $arg]
set nick [string range $arg 0 [expr $sarg - 1]]
set msg [string range $arg [expr $sarg + 1] end]

if { [llength $nick] < 1 } {
putdcc $idx "usage : msg <nick> <message>"
return 0
}

putdcc $idx "Msg to $nick: $msg"
putmsg $nick "$msg"
putcmdlog "#$hand# msg $nick $msg"
return 0
}


proc notice:dcc:msg {hand idx arg} {
if { [llength $arg] < 1 } {
putdcc $idx "Usage: msg <nick> <message>"
return 0
}
set sarg [string first " " $arg]
set nick [string range $arg 0 [expr $sarg - 1]]
set msg [string range $arg [expr $sarg + 1] end]

### protection X/W
if {$nick == "X" || $nick == "x" || $nick == "W" || $nick == "w" } {
putdcc $idx "You don't have permission to private X or W by using the bot !"
return 0
}

if { [llength $nick] < 1 } {
putdcc $idx "Usage: msg <nick> <message>"
return 0
}
putdcc $idx "Msg to $nick: $msg"
putmsg $nick "$msg"
putcmdlog "#$hand# msg $nick $msg"
return 0
}
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Check out the FILT bind. It lets you filter text on the partyline.
C
Calimero

Post by Calimero »

thank's guys. I think psykotrop's script will do exactly what I need.

I'm going to test it right now.

Thank's again :)

__
Calimero
Locked