Hi, I hope some C expert can help me to change the source codes of +ban dcc command, when we use .+ban <host> <reason> and when we do .bans or .bans all
we can see that bans informations including who set the ban and ban's reason. I was wondering is it possible if kick message can show "who kicked" and "date" with a reason? like "nick was kicked by bot (Apr 23 mm: tesing.)
you could use the FILT bind to caputure all .+ban partyline commands and alter the banreason. that wouldnt require source code changes.
i least this is my interpretation of this:
(28) FILT (stackable)
bind filt <flags> <mask> <proc>
procname <idx> <text>
Description: party line and file system users have their text sent
through filt before being processed. If the proc returns a blank
string, the text is considered parsed. Otherwise, the bot will use
the text returned from the proc and continue parsing that
Module: core
bind filt - ".+ban *" banfilter
proc banfilter {idx text} {
set text [split $text]
if { [string match #* [lindex $text end]] || [string match \%* [lindex $text end]] || [llength $text] == 2 } {
set reason "requested"
set default 1
} else {
set reason [string trim [lindex $text end] "\""]
set default 0
}
set reason "kicked by [idx2hand $idx] ([ctime [unixtime]]: $reason)"
if {$default} {
return "[join [lrange $text 0 end]] $reason"
} else {
return "[join [lrange $text 0 end-1]] $reason"
}
}
I meant something like this. Untested, don't know if it works. maybe you may not split $text, maybe it doesnt trigger when it is supposed to, maybe the bot won't recognize the list elements for +ban right in the end.
the reason change the banreason to something like this, too of course:
append reason " (kicked by [idx2hand $idx] on [ctime [unixtime]])"
maybe your TCL version doesnt support the shortcut of "end", try using "end" instead of "e" (dont forget the one in lrange then). I tested it locally and there it works ^-^.
[09:02:03] tcl: evaluate (.tcl): lindex {one two three} e
Tcl: three
thank you De Kus, it worked fine. the kick message shows like this
was kicked by testbot("kicked by mm (date, time: reason)", how do i remove these quotes?
the reason thing would require some enhancement anyway, if you really need it, I might change the whole thing (currently probably only 1 list element reasons will work).