<Me> !ban Nick test
*** Bot sets mode: +b *!*@host.com
*** Nick was kicked by Bot (test, by Me)
Code: Select all
bind pub o|o [string trim $lol(cmdchar)]ban pub_lol_ban
bind pub o|o +b pub_lol_ban
### !BAN <nick|mask> [time] [reason]
proc pub_lol_ban {nick host hand chan arg} {
set arg [charfilter $arg]
global lol botnick
if {![check $hand $nick $host]} {
if {$lol(silent) == 1 || [checksilent $hand]} {return 0}
puthelp "NOTICE $nick :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
return 0
}
if {[llength $arg] < 1} {
puthelp "NOTICE $nick :\002Usage:\002 [string trim $lol(cmdchar)]ban <nick|mask> \[time\] \[reason\]"
return 0
}
set who [lindex $arg 0]
if {[strlwr $who] == [strlwr $botnick]} {
puthelp "NOTICE $nick :Yeah right, like I'm going to let you ban ME!"
return 0
}
set ti [lindex $arg 1]
if {[isnumber $ti]} {
set reason [lrange $arg, 2 end]
} {
set ti ""
set reason [lrange $arg, 1 end]
}
if {$reason == ""} { set reason "Requested," }
if {[onchan $who $chan]} {
if { $lol(bantype) == 0 } {
set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
set usermask [lindex [split [getchanhost $who $chan] "@"] 0]
set banmask *!*$usermask@$ipmask
} else {
set banmask [getchanhost $who $chan]
set banmask "*!*[string range $banmask [string first @ $banmask] e]"
}
} else {
set banmask [lindex $arg 0]
if {[string first "!" $banmask] == -1 && [string first "@" $banmask] == -1} {
if {[isnumber [string index $banmask 0]]} {
set banmask *!*@$banmask
} else {
set banmask $banmask*!*@*
}
}
if {[string first "!" $banmask] == -1} { set banmask *!*$banmask }
if {[string first "@" $banmask] == -1} { set banmask $banmask*@* }
}
if {![botisop $chan]} { return 0 }
putserv "MODE $chan +b $banmask"
foreach chanuser [chanlist $chan] {
if {[string match [strlwr $banmask] [strlwr "$chanuser![getchanhost $chanuser $chan]"]] && $chanuser != $botnick } {
if {[nick2hand $chanuser $chan] != "*"} {
if {$hand != [nick2hand $chanuser $chan]} {
if {[matchattr [nick2hand $chanuser $chan] o|o $chan] && ![matchattr $hand o|o $chan]} {
puthelp "NOTICE $nick :Sorry, you must be an operator to ban an operator."
return 0
}
if {([matchattr [nick2hand $chanuser $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan]} {
puthelp "NOTICE $nick :Sorry, you must be a master to ban a master or a bot."
return 0
}
}
}
putkick $chan $chanuser [join [lappend reason "by $nick"]]
}
}
switch $ti {
""
{
newchanban $chan $banmask $nick [join [lappend reason "by $nick"]]
puthelp "NOTICE $nick :New mask added : $banmask"
}
0
{
newchanban $chan $banmask $nick [join [lappend reason "by $nick"]] $ti
puthelp "NOTICE $nick :New mask added permanently : $banmask"
}
default
{
newchanban $chan $banmask $nick [join [lappend reason "by $nick"]] $ti
puthelp "NOTICE $nick :New mask added for $ti minutes : $banmask"
}
}
return 0
}
Example:
<Me> !dr Dronenick
*** Bot sets mode: +b *!*@host.net
*** [Banned]: Dronenick
*** Dronenick was kicked by Bot (You are infected join /join #DMSetup for help!, by Me)
This ban should have this reason "You are infected join /join #DMSetup for help!" and ban for ever (permident).
Waiting for replies, thanks in advance.