Communauté Eggdrop
[Résolu] fonction channel get - Version imprimable

+- Communauté Eggdrop (https://forum.eggdrop.fr)
+-- Forum : Eggdrop et TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum : Scripts TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=4)
+--- Sujet : [Résolu] fonction channel get (/showthread.php?tid=1778)



fonction channel get - Amand - 14/02/2024

Hello à tous, 

j'ai fait une procédure :

tcl
bind msg o|o addc ::certUser::addc
proc ::certUser::addc { nick host hand arg } {
 
set pseudo [lindex $arg 0]
set chan [lindex $arg 1]
 
if {![channel get $chan cert]} {
return
}
 
...
 
}



quand j'écris un chan qui n'est pas en mode cert, le bot me retourne :

[06:33:13] Tcl error [::certUser::addc]: no such channel record

Normalement, il devrait faire un return, quand le channel mis dans la cmds n'a pas le mode ?

Ou ça veut dire que le channel n'existe pas auprès de l'eggdrop du coup il ne peut pas vérifier si le channel a le mode ou pas?


RE: fonction channel get - CrazyCat - 14/02/2024

Oui, ce message signifie qu'il ne trouve pas le canal dans sa liste de canaux. D'où l'intérêt d'utiliser validchan pour vérifier que le chan est bien connu et s'éviter des erreurs Smile


RE: fonction channel get - Amand - 14/02/2024

parfait j'ai modifié en

tcl
if {![validchan $chan] || ![channel get $chan cert]} {



J'ai plus l'erreur , merci je ne connaissais pas cette fonction Smile