Unban Niubot..
#2
Il y a une légère optimisation que je ferais: contrôler que la victime est bannie avant le reste.
D'autant plus qu'il me semble voir une erreur: si un autre utilisateur que Niubot pose un ban, tu débannis (et deop le poseur) sans vérifier si la victime doit être bannie.
Voici comment j'agencerais ton code:
tcl
namespace eval ::niuban {
   variable niubotchan "#salon"
   bind MODE - "* +b" [namespace current]::unban_niubot
   proc unban_niubot { nick uhost hand chan mc target } {
      variable niubotchan
      if {[isbotnick $nick]} { return 0 }
      if {[isban $target $chan]} { return 0 }
 
      if {[string match -nocase niubot?? $nick]} {
         putquick "PRIVMSG $niubotchan :unban $target $chan"
      } else {
         putquick "mode $chan -ob $nick $target"
         puthelp "privmsg $niubotchan :\037\0034Seuls les bans via $::botnick sont autorisés !\037\0034"
      }
   }
}


Répondre


Messages dans ce sujet
Unban Niubot.. - par aliasangelius - 11/11/2012, 18:35
RE: Unban Niubot.. - par CrazyCat - 12/11/2012, 10:16
RE: Unban Niubot.. - par aliasangelius - 12/11/2012, 10:21
RE: Unban Niubot.. - par CrazyCat - 12/11/2012, 18:20
RE: Unban Niubot.. - par aliasangelius - 13/11/2012, 09:58

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté