Finished color command.

This commit is contained in:
Jeremy Fincher 2004-07-22 22:46:46 +00:00
parent a4386a6798
commit 28d702ae82

View File

@ -86,11 +86,27 @@ class Format(callbacks.Privmsg):
<background> (if given) <background> (if given)
""" """
# XXX: We need to fix ircutils.mircColors (note the s) to an IrcDict. # XXX: We need to fix ircutils.mircColors (note the s) to an IrcDict.
raise NotImplementedError
try: try:
fg = args.pop(0) fg = args.pop(0)
if args[0] in ircutils.mircColors:
bg = args.pop(0)
else:
bg = None
except IndexError:
raise callbacks.ArgumentError
text = privmsgs.getArgs(args)
try:
fg = ircutils.mircColors[fg]
except KeyError: except KeyError:
pass irc.error('%r is not a valid foreground color.' % fg)
return
if bg is not None:
try:
bg = ircutils.mircColors[bg]
except KeyError:
irc.error('%r is not a valid background color.' % bg)
return
irc.reply(ircutils.mircColor(text, fg=fg, bg=bg))