From 242ecb4f8f8f65ad56348dd762fc4495395a389c Mon Sep 17 00:00:00 2001 From: James Vega Date: Sat, 16 Oct 2004 02:19:17 +0000 Subject: [PATCH] commands.wrap update --- plugins/Dunno.py | 9 ++++++++- plugins/Ebay.py | 9 +++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/Dunno.py b/plugins/Dunno.py index 7b36853f4..2bcaf5567 100644 --- a/plugins/Dunno.py +++ b/plugins/Dunno.py @@ -53,8 +53,8 @@ import supybot.dbi as dbi import supybot.conf as conf import supybot.utils as utils import supybot.ircdb as ircdb +from supybot.commands import * import supybot.plugins as plugins -from supybot.commands import wrap import supybot.registry as registry import supybot.ircutils as ircutils import supybot.callbacks as callbacks @@ -137,6 +137,11 @@ class Dunno(callbacks.Privmsg): try: dunno = self.db.get(channel, id) if user.id != dunno.by: + # XXX We need to come up with a way to handle this capability + # checking when channel is None. It'll probably involve + # something along the lines of using admin instead of + # #channel,op. The function should be added to + # plugins/__init__.py cap = ircdb.makeChannelCapability(channel, 'op') if not ircdb.users.checkCapability(cap): irc.errorNoCapability(cap) @@ -189,6 +194,8 @@ class Dunno(callbacks.Privmsg): itself. """ try: + # Should this check that Record.by == user.id || + # checkChannelCapability like remove() does? self.db.change(channel, id, replacer) except KeyError: irc.error('There is no dunno #%s.' % id) diff --git a/plugins/Ebay.py b/plugins/Ebay.py index 6a46b4f68..f902d0e49 100644 --- a/plugins/Ebay.py +++ b/plugins/Ebay.py @@ -43,7 +43,7 @@ import getopt import supybot.conf as conf import supybot.utils as utils -from supybot.commands import wrap +from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.privmsgs as privmsgs @@ -101,21 +101,18 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp): _winningBidder, _buyNow, _seller) _multiField = (_bidder, _winningBidder, _seller) - def auction(self, irc, msg, args): + def auction(self, irc, msg, args, item): """ Return useful information about the eBay auction with item number . """ - item = privmsgs.getArgs(args) - if not item.isdigit(): - irc.error(' must be an integer value.') - return url = 'http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=%s' % item try: irc.reply('%s <%s>' % (self._getResponse(url), url)) except EbayError, e: irc.reply(str(e)) + auction = wrap(auction, [('id', 'auction')]) def ebaySnarfer(self, irc, msg, match): r'http://cgi\.ebay\.(?:com(?:\.au)?|co\.uk|ca)/.*' \