Fixed some bugz0rs.

This commit is contained in:
Jeremy Fincher 2004-11-21 13:18:58 +00:00
parent 8071e0236b
commit de367731f1
5 changed files with 14 additions and 14 deletions

View File

@ -95,7 +95,7 @@ class Babelfish(callbacks.Privmsg):
"""
irc.reply(utils.commaAndify(babelfish.available_languages))
def translate(self, irc, msg, args, fromLang, to, toLang, text):
def translate(self, irc, msg, args, fromLang, toLang, text):
"""<from-language> [to] <to-language> <text>
Returns <text> translated from <from-language> into <to-language>.
@ -128,9 +128,7 @@ class Babelfish(callbacks.Privmsg):
except babelfish.BabelfishChangedError, e:
irc.error('Babelfish has foiled our plans by changing its '
'webpage format.')
translate = wrap(translate,
['something', optional(literal('to')),
'something', 'text'])
translate = wrap(translate, ['something', 'to', 'something', 'text'])
def babelize(self, irc, msg, args, fromLang, toLang, text):
"""<from-language> <to-language> <text>

View File

@ -76,7 +76,7 @@ class Currency(callbacks.Privmsg):
r'(.*)</body>', re.I | re.S)
_xeConvert = re.compile(r'<TD[^>]+><FONT[^>]+>\s+([\d.]+\s+\w{3}\s+='
r'\s+[\d.]+\s+\w{3})', re.I | re.S)
def xe(self, irc, msg, args, number, curr1, to, curr2):
def xe(self, irc, msg, args, number, curr1, curr2):
"""[<number>] <currency1> [to] <currency2>
Converts from <currency1> to <currency2>. If number isn't given, it
@ -107,10 +107,9 @@ class Currency(callbacks.Privmsg):
else:
irc.error('XE must\'ve changed the format of their site.')
return
xe = wrap(xe, [optional('float', 1.0), 'lowered',
optional(literal('to')), 'lowered'])
xe = wrap(xe, [optional('float', 1.0), 'lowered', 'to', 'lowered'])
def yahoo(self, irc, msg, args, number, curr1, to, curr2):
def yahoo(self, irc, msg, args, number, curr1, curr2):
"""[<number>] <currency1> to <currency2>
Converts from <currency1> to <currency2>. If number isn't given, it
@ -135,8 +134,7 @@ class Currency(callbacks.Privmsg):
if '.' not in resp[0] and 'e' not in resp[0]:
resp[0] = '%s.00' % resp[0]
irc.reply(' '.join(resp))
yahoo = wrap(yahoo, [optional(float, 1.0), 'lowered',
optional(literal('to')), 'lowered'])
yahoo = wrap(yahoo, [optional(float, 1.0), 'lowered', 'to', 'lowered'])
conf.registerPlugin('Currency')
conf.registerChannelValue(conf.supybot.plugins.Currency, 'command',

View File

@ -294,7 +294,7 @@ class Math(callbacks.Privmsg):
s = ', '.join(imap(self._complexToString, imap(complex, stack)))
irc.reply('Stack: [%s]' % s)
def convert(self, irc, msg, args, number, unit1, to, unit2):
def convert(self, irc, msg, args, number, unit1, unit2):
"""[<number>] <unit> to <other unit>
Converts from <unit> to <other unit>. If number isn't given, it
@ -306,8 +306,7 @@ class Math(callbacks.Privmsg):
irc.reply(str(newNum))
except convertcore.UnitDataError, ude:
irc.error(str(ude))
convert = wrap(convert, [optional('float', 1.0), 'something',
additional(('literal', 'to'), ''), 'text'])
convert = wrap(convert, [optional('float', 1.0),'something','to','text'])
def units(self, irc, msg, args, type):
""" [<type>]

View File

@ -515,7 +515,7 @@ class Services(callbacks.Privmsg):
else:
irc.error('You must set supybot.plugins.Services.NickServ before '
'I\'m able to do identify.')
identify = wrap(identify, ['checkCapability', 'admin'])
identify = wrap(identify, [('checkCapability', 'admin')])
def ghost(self, irc, msg, args, nick):
"""[<nick>]

View File

@ -490,6 +490,10 @@ def getLiteral(irc, msg, args, state, literals, errmsg=None):
else:
raise callbacks.ArgumentError
def getTo(irc, msg, args, state):
if args[0].lower() == 'to':
args.pop(0)
def getPlugin(irc, msg, args, state, require=True):
cb = irc.getCallback(args[0])
if cb is not None:
@ -530,6 +534,7 @@ wrappers = ircutils.IrcDict({
'haveOp': getHaveOp,
'expiry': getExpiry,
'literal': getLiteral,
'to': getTo,
'nick': getNick,
'seenNick': getSeenNick,
'channel': getChannel,