diff --git a/plugins/FunCommands.py b/plugins/FunCommands.py index e8dcb846e..7b1d72c4e 100644 --- a/plugins/FunCommands.py +++ b/plugins/FunCommands.py @@ -85,6 +85,30 @@ class FunCommands(callbacks.Privmsg): (self.recvdMsgs, self.recvdBytes, self.sentMsgs, self.sentBytes)) + def ord(self, irc, msg, args): + """ + + Returns the 8-bit value of . + """ + letter = privmsgs.getArgs(args) + if len(letter) != 1: + irc.error(msg, 'Letter must be of length 1 (for obvious reasons)') + else: + i = ord(letter) + irc.reply(msg, str(i)) + + def chr(self, irc, msg, args): + """ + + Returns the character associated with the 8-bit value + """ + try: + i = int(privmsgs.getArgs(args)) + irc.reply(msg, chr(i)) + except ValueError: + irc.error(msg, 'That number doesn\'t map to an 8-bit character.') + + def hexlify(self, irc, msg, args): "; turn string into a hexstring." text = privmsgs.getArgs(args)