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.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)

View File

@ -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):
"""<item>
Return useful information about the eBay auction with item number
<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
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)/.*' \