Update to use new commands.wrap. There are still some issues with some of

the commands (such as Misc.help), but works overall.
This commit is contained in:
James Vega 2004-10-13 15:23:14 +00:00
parent c574403ca8
commit bec6b54cbc

View File

@ -44,7 +44,7 @@ import supybot.fix as fix
import os import os
import sys import sys
import time import time
import getopt
from itertools import imap, ifilter from itertools import imap, ifilter
import supybot.log as log import supybot.log as log
@ -53,7 +53,7 @@ import supybot.utils as utils
import supybot.world as world import supybot.world as world
import supybot.ircdb as ircdb import supybot.ircdb as ircdb
import supybot.irclib as irclib import supybot.irclib as irclib
from supybot.commands import wrap from supybot.commands import additional, getopts, optional, wrap
import supybot.ircmsgs as ircmsgs import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.webutils as webutils import supybot.webutils as webutils
@ -185,7 +185,7 @@ class Misc(callbacks.Privmsg):
else: else:
irc.error('That plugin exists, but it has no ' irc.error('That plugin exists, but it has no '
'commands with help.') 'commands with help.')
list = wrap(list, ['?plugin'], getopts={'private': ''}) list = wrap(list, [getopts({'private':''}), optional('plugin')])
def apropos(self, irc, msg, args, s): def apropos(self, irc, msg, args, s):
"""<string> """<string>
@ -251,7 +251,7 @@ class Misc(callbacks.Privmsg):
cb = cbs[0] cb = cbs[0]
method = getattr(cb, command) method = getattr(cb, command)
getHelp(method) getHelp(method)
help = wrap(help, [('plugin?', None, False), 'commandName']) help = wrap(help, [additional(('plugin', False)), 'commandName'])
def hostmask(self, irc, msg, args, nick): def hostmask(self, irc, msg, args, nick):
"""[<nick>] """[<nick>]
@ -262,7 +262,7 @@ class Misc(callbacks.Privmsg):
if not nick: if not nick:
nick = msg.nick nick = msg.nick
irc.reply(irc.state.nickToHostmask(nick)) irc.reply(irc.state.nickToHostmask(nick))
hostmask = wrap(hostmask, ['?seenNick']) hostmask = wrap(hostmask, [optional('seenNick')])
def version(self, irc, msg, args): def version(self, irc, msg, args):
"""takes no arguments """takes no arguments
@ -408,7 +408,7 @@ class Misc(callbacks.Privmsg):
irc.reply(utils.mungeEmailForWeb(str(module.__author__))) irc.reply(utils.mungeEmailForWeb(str(module.__author__)))
else: else:
irc.reply('That plugin doesn\'t have an author that claims it.') irc.reply('That plugin doesn\'t have an author that claims it.')
author = wrap(author, [('plugin', False)]) author = wrap(author, [('plugin')])
def more(self, irc, msg, args, nick): def more(self, irc, msg, args, nick):
"""[<nick>] """[<nick>]
@ -441,7 +441,7 @@ class Misc(callbacks.Privmsg):
irc.error('You haven\'t asked me a command!') irc.error('You haven\'t asked me a command!')
except IndexError: except IndexError:
irc.error('That\'s all, there is no more.') irc.error('That\'s all, there is no more.')
more = wrap(more, ['?seenNick']) more = wrap(more, [optional('seenNick')])
def _validLastMsg(self, msg): def _validLastMsg(self, msg):
return msg.prefix and \ return msg.prefix and \
@ -526,13 +526,13 @@ class Misc(callbacks.Privmsg):
'my history of %s messages.' % len(irc.state.history)) 'my history of %s messages.' % len(irc.state.history))
else: else:
irc.reply(utils.commaAndify(resp)) irc.reply(utils.commaAndify(resp))
last = wrap(last, getopts={'nolimit': '', last = wrap(last, [getopts({'nolimit': '',
'on': 'something', 'on': 'something',
'with': 'something', 'with': 'something',
'from': 'something', 'from': 'something',
'without': 'something', 'without': 'something',
'in': 'callerInChannel', 'in': 'callerInChannel',
'regexp': 'regexpMatcher',}) 'regexp': 'regexpMatcher',})])
def tell(self, irc, msg, args, target, text): def tell(self, irc, msg, args, target, text):
@ -702,7 +702,7 @@ class Misc(callbacks.Privmsg):
irc.reply(buildPeopleString(module)) irc.reply(buildPeopleString(module))
else: else:
irc.reply(buildPersonString(module)) irc.reply(buildPersonString(module))
contributors = wrap(contributors, ['plugin', '?nick']) contributors = wrap(contributors, ['plugin', optional('nick')])
Class = Misc Class = Misc