commands.wrap update

This commit is contained in:
James Vega 2004-10-16 02:19:17 +00:00
parent dcb91579b0
commit 242ecb4f8f
2 changed files with 11 additions and 7 deletions

View File

@ -53,8 +53,8 @@ import supybot.dbi as dbi
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
import supybot.ircdb as ircdb import supybot.ircdb as ircdb
from supybot.commands import *
import supybot.plugins as plugins import supybot.plugins as plugins
from supybot.commands import wrap
import supybot.registry as registry import supybot.registry as registry
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
@ -137,6 +137,11 @@ class Dunno(callbacks.Privmsg):
try: try:
dunno = self.db.get(channel, id) dunno = self.db.get(channel, id)
if user.id != dunno.by: 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') cap = ircdb.makeChannelCapability(channel, 'op')
if not ircdb.users.checkCapability(cap): if not ircdb.users.checkCapability(cap):
irc.errorNoCapability(cap) irc.errorNoCapability(cap)
@ -189,6 +194,8 @@ class Dunno(callbacks.Privmsg):
itself. itself.
""" """
try: try:
# Should this check that Record.by == user.id ||
# checkChannelCapability like remove() does?
self.db.change(channel, id, replacer) self.db.change(channel, id, replacer)
except KeyError: except KeyError:
irc.error('There is no dunno #%s.' % id) irc.error('There is no dunno #%s.' % id)

View File

@ -43,7 +43,7 @@ import getopt
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
from supybot.commands import wrap from supybot.commands import *
import supybot.plugins as plugins import supybot.plugins as plugins
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.privmsgs as privmsgs import supybot.privmsgs as privmsgs
@ -101,21 +101,18 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp):
_winningBidder, _buyNow, _seller) _winningBidder, _buyNow, _seller)
_multiField = (_bidder, _winningBidder, _seller) _multiField = (_bidder, _winningBidder, _seller)
def auction(self, irc, msg, args): def auction(self, irc, msg, args, item):
"""<item> """<item>
Return useful information about the eBay auction with item number Return useful information about the eBay auction with item number
<item>. <item>.
""" """
item = privmsgs.getArgs(args)
if not item.isdigit():
irc.error('<item> must be an integer value.')
return
url = 'http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=%s' % item url = 'http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=%s' % item
try: try:
irc.reply('%s <%s>' % (self._getResponse(url), url)) irc.reply('%s <%s>' % (self._getResponse(url), url))
except EbayError, e: except EbayError, e:
irc.reply(str(e)) irc.reply(str(e))
auction = wrap(auction, [('id', 'auction')])
def ebaySnarfer(self, irc, msg, match): def ebaySnarfer(self, irc, msg, match):
r'http://cgi\.ebay\.(?:com(?:\.au)?|co\.uk|ca)/.*' \ r'http://cgi\.ebay\.(?:com(?:\.au)?|co\.uk|ca)/.*' \