set grab(chan) "#Banana-Island"
set grab(netserv) "X"
set grab(text) ""
set grab(sender) ""
set grab(receiver) ""
set grab(cb) ""
bind msg -|- averti do:msg
bind notc -|- * grab:X:notice
proc do:msg { nick hand chan text } {
global botnick grab
if {![isbotnick $nick]} {
if {[llength $text] < 1} {
puthelp "NOTICE $nick : \2ERROR SYNTAX\2: averti <nickname> <raison>"
return 0
}
if {[llength $text] < 2} {
puthelp "NOTICE $nick : \2Ok Huston, mais où est la \0034raison\0003 \2?"
puthelp "NOTICE $nick : \2ERROR SYNTAX\2: \2Averti <\2nickname\2>\2 \2<\2raison\2>"
return 0
}
set grab(receiver) [lindex [split $text] 0]
set adviser [lrange [split $text] 1 end]
set grab(sender) $nick
if {[onchan $grab(receiver) $grab(chan)]} {
if {[onchan $grab(netserv) $grab(chan)]} {
set grab(text) $adviser
putserv "PRIVMSG $grab(netserv) :status $grab(chan)"
putquick "PRIVMSG $grab(receiver) :Vous venez de recevoir un message de\2 $grab(sender) \2 pour la raison suivante: $adviser"
} else {
putquick "NOTICE $nick :Huston, we have a problem, that empty-headed $grab(netserv) is not on $grab(chan)"
}
} else {
putquick "NOTICE $nick :Huston, we have a problem, $grab(receiver) n'est pas présent sur $grab(chan)"
}
}
}
proc grab:X:notice {nick uhost hand text dest} {
global botnick grab
set auth [lindex [split $text] 0]
set what [lrange [split $text] 1 end]
if {$grab(text) != ""} {
if {[string equal -nocase $auth "Auth:"] == 1} {
set grab(cb) "[expr [llength "$what"] / 2]"
for {set grab(x) "1"} {$grab(x) <= $grab(cb)} {incr grab(x)} {
set who [string map {\2 ""} [lindex [split $what /] $grab(x)]]
set whoGood [lindex [split $who " "] 0]
## set who [string map {\2 ""} [lindex [split [lindex [split $what " "] 1] /] 1]]
if {[onchan $whoGood $grab(chan)] && [string equal -nocase $botnick $whoGood] == 0 && [string equal -nocase $grab(receiver) $whoGood] == 0 && [string equal -nocase $grab(sender) $whoGood] == 0} {
putquick "PRIVMSG $whoGood : $grab(sender) à envoyés un message à $grab(receiver) pour la raison suivante: $grab(text)"
putlog "- $whoGood"
}
if { [string equal -nocase $grab(sender) $whoGood] == 1 } {
putquick "privmsg $whoGood : Votre message a Bien été envoyés à $grab(receiver)."
putquick "PRIVMSG $grab(receiver) :Vous venez de recevoir un message de\2 $grab(sender) \2 pour la raison suivante: $grab(text)"
}
}
}
}
}