Added a default behavior for Admin.nick if no nick is given.

This commit is contained in:
Jeremy Fincher 2004-08-20 21:07:54 +00:00
parent eb60864c51
commit af994cfcff

View File

@ -214,16 +214,21 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
self.log.debug('Got NICK without Admin.nick being called.') self.log.debug('Got NICK without Admin.nick being called.')
def nick(self, irc, msg, args): def nick(self, irc, msg, args):
"""<nick> """[<nick>]
Changes the bot's nick to <nick>.""" Changes the bot's nick to <nick>. If no nick is given, returns the
nick = privmsgs.getArgs(args) bot's current nick.
"""
nick = privmsgs.getArgs(args, required=0, optional=1)
if nick:
if ircutils.isNick(nick): if ircutils.isNick(nick):
conf.supybot.nick.setValue(nick) conf.supybot.nick.setValue(nick)
irc.queueMsg(ircmsgs.nick(nick)) irc.queueMsg(ircmsgs.nick(nick))
self.pendingNickChanges[irc.getRealIrc()] = irc self.pendingNickChanges[irc.getRealIrc()] = irc
else: else:
irc.error('That\'s not a valid nick.') irc.error('That\'s not a valid nick.')
else:
irc.reply(irc.nick)
def part(self, irc, msg, args): def part(self, irc, msg, args):
"""<channel> [<channel> ...] [<reason>] """<channel> [<channel> ...] [<reason>]