I wonder if it is possible and not to difficult to convert the votetcl ( wich is using public commands) into a votetcl in dcc chat commands ( not public and not seen in the channel )
thanks for any help
Code: Select all
####################################################
# aVote 1.1b fr par arcane (arc-76024@web.de)
# (#k13, #Prophecy @euIRC)
# (traduction par alamaz, #stflou @Undernet)
#
# (Traduction francaise de la traduction anglaise. la version originale est allemande)
#
# Script de vote avec rŽponses prŽdŽfinies
#
# Si vous souhaitez utiliser mon script, je serai content d'avoir un petit message :)
#
# Pour l'aide:
# /msg <botnick> vhelp
#
# La syntaxe est: "!vote <temps>|<sujet>|<reponses>" (séparé par des "|").
# Les réponses différentes possibles sont séparées par des ":".
#
# ex. "!vote 10m|Quelle est votre couleur préférée?|aucune:vert:rouge:jaune:bleu"
#
# Le temps est donné de cette facon:
# xxm: xx minutes; xxh: xx heures. N'utilisez pas minutes et heures en meme temps.
#
# Autres commandes:
# /msg $botnick vhelp: montre cette aide
# !vote (sans arguments): montre les informations a propos du vote courant (ou du dernier)"
# Votez en tapant /msg $botnick vote <réponse>"
# La personne qui a débuté le vote peut le forcer a finir avec !endvote."
#
# Fonctionnalités:
#
# - réponses définissables
# - notice pour les utilisateurs rejoignant le channel pour les personnes n'ayant pas voté
# - hostmasks pour les personnes qui votent
# - vote interdit par des bots
# - finir un vote par celui qui l'a commencé
#
# A Faire:
#
# - multiples sessions en mme temps
# - rappeler le vote aux personnes parties (away)
# - commentaires ?
# - limiter a des groupes d'utilisateurs
# - vote libre (pas de réponse définie)
#
# Historique:
#
# - Version 1.0: (10.02.2003)
# - publié seulement sur forum.egghelp.org
# - premiere version
# - publié seulement en allemand
# - Version 1.1: (19.02.2003)
# - quelques problèmes mineurs fixés (merci a stdragon)
# - les statistiques du vote en cours montrées par "!vote" et a l'arrivée sur le chan
# - syntaxe changée en "!vote <temps>|<sujet>|<réponses>"
# - quelques problèmes visuels
# - traduction anglaise disponible
# - Version 1.1b: (24.02.2003)
# - un bug fixé dans la procédure d'arrivée sur le chan
# - traduction francaise disponible
#
#
# Merci a:
#
# - Loki` pour son Channel Voter Script 1.15
# - ppslim @forum.egghelp.org pour son aide
# - stdragon @forum.egghelp.org pour avoir vérifié mon script
####################################################
##################### Params #######################
set aversion "aVote 1.1b fr"
set vvotes "0"
##################### Bindings #####################
bind pub - !vote avote_anyvote
bind msg - vhelp avote_help
bind msg - vote avote_vote
bind pub - !endvote avote_end
bind join - * avote_reminder
##################### Remove old timers ############
if {![info exists vtopic]} {
catch {
killutimer $vtimer
}
}
##################### AnyVote ######################
proc avote_anyvote {nick mask hand chan arg} {
global botnick vchan vnick vpeople vvotes vtopic vanswers vcount vtime aversion vtimestart vtimer vhand
if {$arg == ""} {
if {$vvotes == "0"} {
puthelp "NOTICE $nick :Pas de vote en cours."
if {[info exists vtopic]} {
puthelp "NOTICE $nick :Dernier vote par $vnick:"
puthelp "NOTICE $nick :\"$vtopic\""
puthelp "NOTICE $nick :Resultats:"
for {set number 0} {$number < [llength $vanswers]} {incr number} {
puthelp "NOTICE $nick :\"[lindex $vanswers $number]\": [lindex $vcount $number]"
}
} else {
puthelp "NOTICE $nick :Pas de vote en cours."
}
return 0
} else {
puthelp "NOTICE $nick :Vote en cours par $vnick:"
puthelp "NOTICE $nick :\"$vtopic\""
puthelp "NOTICE $nick :Statistiques:"
for {set number 0} {$number < [llength $vanswers]} {incr number} {
puthelp "NOTICE $nick :\"[lindex $vanswers $number]\": [lindex $vcount $number]"
}
puthelp "NOTICE $nick :Temps restant: [duration [expr (([unixtime] - $vtimestart) - $vtime) * -1]]"
puthelp "NOTICE $nick :Votez en tapant \"/msg $botnick vote <réponse>\""
return 0
}
} else {
if {$vvotes != 0} {
puthelp "NOTICE $nick :Un vote est dŽjˆ en cours."
return 0
}
set parts [split $arg "|"]
set time [lindex $parts 0]
set topic [lindex $parts 1]
set answers [split [lindex $parts 2] :]
if {$time == "" || $topic == "" || [lindex $answers 0] == ""} {
puthelp "NOTICE $nick :La syntaxe est \"!vote <temps>|<sujet>|<réponses>\" (separated by \"|\")."
puthelp "NOTICE $nick :Les différentes rŽponses possibles sont separees par des \":\"."
return 0
}
if {[lindex $answers 1] == ""} {
puthelp "NOTICE $nick :Vous devez definir au minimum deux reponses possibles."
return 0
}
set vtimeleft $time
if [string match "*m" [string tolower $vtimeleft]] {
set vtime [expr [string trimright $vtimeleft m] * 60]
set vtimestart [unixtime]
} elseif [string match "*h" [string tolower $vtimeleft]] {
set vtime [expr [string trimright $vtimeleft h] * 3600]
set vtimestart [unixtime]
} else {
puthelp "NOTICE $nick :$time: Format d'heure incorrect (m: minutes, h: heures)."
return 0
}
set vchan $chan
set vtopic $topic
set vanswers $answers
set vvotes "1"
set vnick $nick
set vhand $hand
set vcount [list]
foreach answer $vanswers {
lappend vcount 0
}
puthelp "PRIVMSG $vchan :\002Vote par $nick:"
puthelp "PRIVMSG $vchan :\"$vtopic\""
puthelp "PRIVMSG $vchan :reponses possibles: [join $vanswers " : "]"
puthelp "PRIVMSG $vchan :Temps: $time"
puthelp "PRIVMSG $vchan :Votez en tapant \"/msg $botnick vote <réponse>\""
if {[info exists vpeople]} { unset vpeople }
set vtimer [utimer $vtime "avote_end \"end of time\" 2 3 4 5"]
}
}
##################### Vote #########################
proc avote_vote {nick mask hand arg} {
global botnick vchan vpeople vvotes vanswers vcount
if {$vvotes == 0} {
puthelp "NOTICE $nick :Pas de vote en cours."
return 0
}
set mask [maskhost $mask]
if {[matchattr $hand b]} {
puthelp "NOTICE $nick :Vous etes un bot sans ame et je ne vous autoriserai pas a voter, car vous n'avez pas assez d'intelligence pour cela."
puthelp "PRIVMSG $vchan :Quelqu'un essaye de voter en utilisant $nick!"
return 0
} elseif {[info exists vpeople($mask)]} {
puthelp "NOTICE $nick :Vous avez déja voté."
return 0
} else {
for {set number 0} {$number < [llength $vanswers]} {incr number} {
if {[string tolower $arg] == [string tolower [lindex $vanswers $number]]} {
puthelp "NOTICE $nick :Votre vote a été compté ([string tolower $arg])."
set vtemp [lindex $vcount $number]
incr vtemp
set vcount [lreplace $vcount $number $number $vtemp]
set vpeople($mask) 1
return 0
}
}
puthelp "NOTICE $nick :$arg: Reponse impossible."
puthelp "NOTICE $nick :Les réponses possibles sont: [join $vanswers " : "]"
}
}
##################### Help #########################
proc avote_help {nick mask hand arg} {
global botnick aversion
puthelp "NOTICE $nick :$aversion par arcane - aide"
puthelp "NOTICE $nick :la syntaxe est \"!vote <temps>|<sujet>|<réponses>\" (séparé par des \"|\")."
puthelp "NOTICE $nick :Les réponses différentes possibles sont séparées par des \":\"."
puthelp "NOTICE $nick :Le temps est donné de cette facon:"
puthelp "NOTICE $nick :xxm: xx minutes; xxh: xx heures. N'utilisez pas minutes et heures en meme temps."
puthelp "NOTICE $nick :Autres commandes:"
puthelp "NOTICE $nick :/msg $botnick vhelp: montre cette aide"
puthelp "NOTICE $nick :!vote (sans arguments): montre les informations a propos du vote courant (ou du dernier)"
puthelp "NOTICE $nick :Votez en tapant /msg $botnick vote <réponse>"
puthelp "NOTICE $nick :La personne qui a débuté le vote peut le forcer a finir avec !endvote."
}
##################### Endvote ######################
proc avote_end {nick mask hand chan arg} {
global botnick vchan vnick vpeople vvotes vtopic vanswers vcount vtime vtimer vhand vtimestart
if {$vvotes == 0} {
puthelp "NOTICE $nick :Pas de vote en cours."
return 0
}
if {$chan == $vchan || $nick == "end of time"} {
if {$hand != $vhand && $nick != "end of time"} {
puthelp "NOTICE $nick :Seule la personne qui a débuté le vote peut le forcer a s'arreter."
return 0
}
if {$nick == "end of time"} {
puthelp "PRIVMSG $vchan :Vote par $vnick sur $vtopic terminé (fin de la période de temps)."
} else {
puthelp "PRIVMSG $vchan :Vote par $vnick sur $vtopic terminé par $nick."
}
puthelp "PRIVMSG $vchan :Resultats:"
for {set number 0} {$number < [llength $vanswers]} {incr number} {
puthelp "PRIVMSG $vchan :\"[lindex $vanswers $number]\": [lindex $vcount $number]"
}
set vvotes "0"
catch {
killutimer $vtimer
}
if {[info exists vpeople]} { unset vpeople }
}
}
##################### OnJoin Reminder ##############
proc avote_reminder {nick mask hand chan} {
global botnick vchan vnick vpeople vvotes vtopic vanswers vcount vtime vtimestart
if {![info exists vchan]} {
return 0
}
set mask [maskhost $mask]
if {$chan == $vchan && [info exists vpeople($mask)] == 0 && $vvotes != 0} {
puthelp "NOTICE $nick :Vote en cours par $vnick"
puthelp "NOTICE $nick :\"$vtopic\""
puthelp "NOTICE $nick :Statistiques:"
for {set number 0} {$number < [llength $vanswers]} {incr number} {
puthelp "NOTICE $nick :\"[lindex $vanswers $number]\": [lindex $vcount $number]"
}
puthelp "NOTICE $nick :Temps restant: [duration [expr (([unixtime] - $vtimestart) - $vtime) * -1]]"
puthelp "NOTICE $nick :Votez avec \"/msg $botnick vote <réponse>\""
}
}
##################### Log Message ##################
putlog "\0033$aversion loaded"