All pastes #801780 Raw Edit

[XChat] Chr/Asc

public python v1 · immutable
#801780 ·published 2007-11-29 16:16 UTC
rendered paste body
# -*- coding: iso-8859-15 -*-__module_name__ = "Chr/Asc Commande"__module_version__ = "1.0"__module_description__ = "Même commande que $chr() et $asc() en mIRC"__module_author__ = "Xn - dev@0x586e.info"import xchatdef chr_cb(word,word_eol,userdata):    if (str.isdigit(word[1])):        try:            xchat.prnt("Chr : %s" % chr(int(word[1])))        except ValueError:            xchat.prnt(":: Erreur :: Mauvaise valeur, le parametre doit etre un nombre compris entre 0 et 255")     else:        xchat.prnt(":: Erreur :: Mauvaise valeur, le parametre doit etre un nombre compris entre 0 et 255")    return xchat.EAT_ALLdef asc_cb(word,word_eol,userdata):    if (str.isalpha(word[1])):        try:            xchat.prnt("Asc : %i" % ord(word[1]))        except TypeError:            xchat.prnt(":: Erreur :: Mauvaise valeur, le parametre doit etre un charactere.")    else:        xchat.prnt(":: Erreur :: Mauvaise valeur, le parametre doit etre un charactere.")    return xchat.EAT_ALLxchat.hook_command('chr',chr_cb,help=":: /chr num :: Retourne un charactere (Doit etre compris entre 0 et 255")xchat.hook_command('asc',asc_cb,help=":: /asc char :: Retourne la valeure de char")xchat.prnt('%s - %s' % (__module_author__,__module_name__))