Huge commit to finish refactoring of replies.

This commit is contained in:
Jeremy Fincher 2004-01-08 23:03:48 +00:00
parent 5700a69aed
commit 1c03464fd9
35 changed files with 149 additions and 156 deletions

View File

@ -79,13 +79,13 @@ class Babelfish(callbacks.Privmsg):
translation = babelfish.translate(text, fromLang, toLang)
irc.reply(translation)
except (KeyError, babelfish.LanguageNotAvailableError), e:
irc.error('%s is not a valid language. Valid languages ' \
'include %s' % \
irc.error('%s is not a valid language. Valid languages '
'include %s' %
(e, utils.commaAndify(babelfish.available_languages)))
except babelfish.BabelizerIOError, e:
irc.error(e)
except babelfish.BabelfishChangedError, e:
irc.error('Babelfish has foiled our plans by changing its ' \
irc.error('Babelfish has foiled our plans by changing its '
'webpage format')
def babelize(self, irc, msg, args):
@ -105,13 +105,13 @@ class Babelfish(callbacks.Privmsg):
translations = babelfish.babelize(text, fromLang, toLang)
irc.reply(translations[-1])
except (KeyError, babelfish.LanguageNotAvailableError), e:
irc.reply('%s is not a valid language. Valid languages ' \
'include %s' % \
irc.reply('%s is not a valid language. Valid languages '
'include %s' %
(e, utils.commaAndify(babelfish.available_languages)))
except babelfish.BabelizerIOError, e:
irc.reply(e)
except babelfish.BabelfishChangedError, e:
irc.reply('Babelfish has foiled our plans by changing its ' \
irc.reply('Babelfish has foiled our plans by changing its '
'webpage format')
def randomlanguage(self, irc, msg, args):

View File

@ -198,8 +198,9 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
return
queryurl = '%s/xml.cgi?id=%s' % (match.group(1), match.group(2))
try:
summary = self._get_short_bug_summary(queryurl, 'Snarfed '\
'Bugzilla URL', match.group(2))
summary = self._get_short_bug_summary(queryurl,
'Snarfed Bugzilla URL',
match.group(2))
except BugzillaError, e:
irc.reply(str(e))
return

View File

@ -589,7 +589,7 @@ class ChannelDB(plugins.ChannelDBHandler,
username = ircdb.users.getUser(id).name
irc.error('%r has no wordstats' % username)
return
L = [('%r: %s' % (word, count)) for \
L = [('%r: %s' % (word, count)) for
(word, count) in cursor.fetchall()]
irc.reply(utils.commaAndify(L))
return

View File

@ -126,7 +126,7 @@ class ChannelLogger(irclib.IrcCallback):
for channel in msg.args[0].split(','):
log = self.getLog(channel)
self.timestamp(log)
log.write('*** %s has joined %s\n' %\
log.write('*** %s has joined %s\n' %
(msg.nick or msg.prefix, channel))
def doKick(self, irc, msg):
@ -138,7 +138,7 @@ class ChannelLogger(irclib.IrcCallback):
log = self.getLog(channel)
self.timestamp(log)
if kickmsg:
log.write('*** %s was kicked by %s (%s)\n' % \
log.write('*** %s was kicked by %s (%s)\n' %
(target, msg.nick, kickmsg))
else:
log.write('*** %s was kicked by %s\n' % (target, msg.nick))
@ -154,7 +154,7 @@ class ChannelLogger(irclib.IrcCallback):
if ircutils.isChannel(channel):
log = self.getLog(channel)
self.timestamp(log)
log.write('*** %s sets mode: %s %s\n' % \
log.write('*** %s sets mode: %s %s\n' %
(msg.nick or msg.prefix, msg.args[1],
' '.join(msg.args[2:])))

View File

@ -80,7 +80,7 @@ class DCC(callbacks.Privmsg):
s = 'Error trying to determine the external IP ' \
'address of this machine via the host %s: %s'
self.log.warning(s, host, e)
irc.reply(conf.replyError)
irc.replyError()
return
i = ircutils.dccIP(ip)
sock.bind((host, 0))

View File

@ -230,7 +230,7 @@ class Debian(callbacks.Privmsg,
numberOfPackages = m.group(1)
m = self._debtablere.search(html)
if m is None:
irc.reply('No package found for %s (%s)' % \
irc.reply('No package found for %s (%s)' %
(urllib.unquote(package), branch))
else:
tableData = m.group(1)

View File

@ -129,7 +129,7 @@ class Dict(callbacks.Privmsg, configurable.Mixin):
if dictionary == '*':
irc.reply('No definition for %r could be found.' % word)
else:
irc.reply('No definition for %r could be found in %s' % \
irc.reply('No definition for %r could be found in %s' %
(word, ircutils.bold(dictionary)))
return
L = []

View File

@ -89,25 +89,25 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
callbacks.PrivmsgCommandAndRegexp.die(self)
_reopts = re.I | re.S
_invalid = re.compile(r'(is invalid, still pending, or no longer in our '\
'database)', _reopts)
_invalid = re.compile(r'(is invalid, still pending, or no longer in our '
r'database)', _reopts)
_info = re.compile(r'<title>eBay item (\d+) \([^)]+\) - ([^<]+)</title>',
_reopts)
_bid = re.compile(r'((?:Current|Starting) bid):.+?<b>([^<]+?)<font',
_reopts)
_bid = re.compile(r'((?:Current|Starting) bid):.+?<b>([^<]+?)<fo', _reopts)
_winningBid = re.compile(r'(Winning bid|Sold for):.+?<b>([^<]+?)<font',
_reopts)
_time = re.compile(r'(Time left):.+?<b>([^<]+?)</b>', _reopts)
_bidder = re.compile(r'(High bidder):.+?(?:">(User ID) (kept private)'\
'</font>|<a href[^>]+>([^<]+)</a>.+?<a href[^>]+>(\d+)</a>)', _reopts)
_winningBidder = re.compile(r'(Winning bidder|Buyer):.+?<a href[^>]+>'\
'([^<]+)</a>.+?<a href[^>]+>(\d+)</a>', _reopts)
_bidder = re.compile(r'(High bidder):.+?(?:">(User ID) (kept private)'
r'</font>|<a href[^>]+>([^<]+)</a>.+?'
r'<a href[^>]+>(\d+)</a>)', _reopts)
_winningBidder = re.compile(r'(Winning bidder|Buyer):.+?<a href[^>]+>'
r'([^<]+)</a>.+?<a href[^>]+>(\d+)</a>',_reopts)
_buyNow = re.compile(r'alt="(Buy It Now)">.*?<b>([^<]+)</b>', _reopts)
_seller = re.compile(r'(Seller information).+?<a href[^>]+>([^<]+)</a>'\
'.+ViewFeedback.+">(\d+)</a>', _reopts)
_searches = (_bid, _winningBid, _time, _bidder, _winningBidder, _buyNow,
_seller)
_seller = re.compile(r'(Seller information).+?<a href[^>]+>([^<]+)</a>'
r'.+ViewFeedback.+">(\d+)</a>', _reopts)
_searches = (_bid, _winningBid, _time, _bidder,
_winningBidder, _buyNow, _seller)
_multiField = (_bidder, _winningBidder, _seller)
def auction(self, irc, msg, args):
@ -139,8 +139,6 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
ebaySnarfer = privmsgs.urlSnarfer(ebaySnarfer)
def _getResponse(self, url):
def bold(m):
return (ircutils.bold(m[0]),) + m[1:]
try:
fd = urllib2.urlopen(url)
s = fd.read()
@ -157,6 +155,8 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
resp.append('%s%s: %s' % (ircutils.bold('Item #'),
ircutils.bold(num),
utils.htmlToText(desc)))
def bold(L):
return (ircutils.bold(L[0]),) + L[1:]
for r in self._searches:
m = r.search(s)
if m:

View File

@ -134,7 +134,7 @@ class Enforcer(callbacks.Privmsg, configurable.Mixin):
irc.queueMsg(ircmsgs.topic(channel, self.topics[channel]))
if self.configurables.get('revenge', channel):
irc.queueMsg(ircmsgs.kick(channel, msg.nick,
conf.replyNoCapability % \
conf.replyNoCapability %
_chanCap(channel, 'topic')))
else:
self.topics[channel] = msg.args[1]

View File

@ -268,9 +268,9 @@ class Factoids(plugins.ChannelDBHandler,
db.commit()
irc.replySuccess()
else:
irc.error('%s factoids have that key. ' \
'Please specify which one to remove, ' \
'or use * to designate all of them.' % \
irc.error('%s factoids have that key. '
'Please specify which one to remove, '
'or use * to designate all of them.' %
cursor.rowcount)
def random(self, irc, msg, args):

View File

@ -203,7 +203,7 @@ class Filter(callbacks.Privmsg):
s = s.translate(self._leettrans)
irc.reply(s)
_scrambleRe = re.compile(r'(?:\b|(?![a-zA-Z]))([a-zA-Z])([a-zA-Z]*)'\
_scrambleRe = re.compile(r'(?:\b|(?![a-zA-Z]))([a-zA-Z])([a-zA-Z]*)'
r'([a-zA-Z])(?:\b|(?![a-zA-Z]))')
def scramble(self, irc, msg, args):
"""<text>

View File

@ -142,8 +142,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler):
return
if table == "lart" or table == "praise":
if '$who' not in s:
irc.error('There must be a $who in the lart/praise '\
'somewhere.')
irc.error('There must be a $who in the lart/praise somewhere')
return
elif table not in self._tables:
irc.error('"%s" is not valid. Valid values include %s.' %
@ -157,8 +156,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler):
sql = """SELECT id FROM %ss WHERE %s=%%s""" % (table, table)
cursor.execute(sql, s)
id = cursor.fetchone()[0]
response = '%s (%s #%s)' % (conf.replySuccess, table, id)
irc.reply(response)
irc.replySuccess('(%s #%s)' % (table, id))
def remove(self, irc, msg, args):
"""[<channel>] <lart|excuse|insult|praise> <id>

View File

@ -65,7 +65,7 @@ def configure(onStart, afterConnect, advanced):
if yn('Do you want the Gameknot stats snarfer enabled by default?')==\
'n':
onStart.append('Gameknot toggle stat off')
if yn('Do you want the Gameknot Game links snarfer enabled by '\
if yn('Do you want the Gameknot Game links snarfer enabled by '
'default?') == 'n':
onStart.append('Gameknot toggle stat off')
@ -85,8 +85,8 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
)
_gkrating = re.compile(r'<font color="#FFFF33">(\d+)</font>')
_gkgames = re.compile(r's:</td><td class=sml>(\d+)</td></tr>')
_gkrecord = re.compile(r'"#FFFF00">(\d+)[^"]+"#FFFF00">(\d+)[^"]+'\
'"#FFFF00">(\d+)')
_gkrecord = re.compile(r'"#FFFF00">(\d+)[^"]+"#FFFF00">(\d+)[^"]+'
r'"#FFFF00">(\d+)')
_gkteam = re.compile(r'Team:(<.*?>)+(?P<name>.*?)</span>')
_gkseen = re.compile(r'(seen on GK:\s+([^[]+ago)|.*?is hiding.*?)')
def __init__(self):
@ -236,8 +236,8 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
(gameTitle, wName, wStats, bName, bStats, toMove)
irc.reply(s, prefixName=False)
except ValueError:
irc.error('That doesn\'t appear to be a proper Gameknot game.'\
' (%s)' % conf.replyPossibleBug)
s = 'That doesn\'t appear to be a proper Gameknot game.'
irc.errorPossibleBug(s)
except Exception, e:
irc.error(utils.exnToString(e))
gameknotSnarfer = privmsgs.urlSnarfer(gameknotSnarfer)

View File

@ -289,12 +289,11 @@ class Google(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
useful for making sure you don't go over your 1000 requests/day limit.
"""
recent = len(last24hours)
irc.reply('This google module has been called %s time%stotal; '\
'%s time%sin the past 24 hours. ' \
'Google has spent %s seconds searching for me.' % \
(totalSearches, totalSearches != 1 and 's ' or ' ',
recent, recent != 1 and 's ' or ' ',
totalTime))
irc.reply('This google module has been called %s total; '
'%s in the past 24 hours. '
'Google has spent %s seconds searching for me.' %
(utils.nItems('time', totalSearches),
utils.nItems('time', recent), totalTime))
def googleSnarfer(self, irc, msg, match):
r"^google\s+(.*)$"
@ -350,8 +349,8 @@ class Google(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
irc.reply('Google Groups: %s, %s' % (mGroup.group(1),
mThread.group(1)), prefixName = False)
else:
irc.error('That doesn\'t appear to be a proper '\
'Google Groups page. (%s)' % conf.replyPossibleBug)
irc.errorPossibleBug('That doesn\'t appear to be a proper '
'Google Groups page.')
googleGroups = privmsgs.urlSnarfer(googleGroups)

View File

@ -226,7 +226,7 @@ class Http(callbacks.Privmsg):
if s.startswith('[not an acronym]'):
defs[i] = s.split('is ', 1)[1]
if len(defs) == 0:
irc.reply('No definitions found. (%s)' % conf.replyPossibleBug)
irc.reply('No definitions found.')
else:
s = ', or '.join(defs)
irc.reply('%s could be %s' % (acronym, s))
@ -268,11 +268,11 @@ class Http(callbacks.Privmsg):
beta = version.strip()
finally:
fd.close()
irc.reply('The latest stable kernel is %s; ' \
irc.reply('The latest stable kernel is %s; '
'the latest beta kernel is %s.' % (stable, beta))
_pgpkeyre = re.compile(r'pub\s+\d{4}\w/<a '\
'href="([^"]+)">([^<]+)</a>[^>]+>([^<]+)</a>')
_pgpkeyre = re.compile(r'pub\s+\d{4}\w/<a href="([^"]+)">'
r'([^<]+)</a>[^>]+>([^<]+)</a>')
def pgpkey(self, irc, msg, args):
"""<search words>
@ -299,8 +299,8 @@ class Http(callbacks.Privmsg):
fd.close()
_filextre = re.compile(
r'<strong>Extension:</strong>.*?<tr>.*?</tr>\s+<tr>\s+<td colspan='\
r'"2">(?:<a href[^>]+>([^<]+)</a>\s+|([^<]+))</td>\s+<td>'\
r'<strong>Extension:</strong>.*?<tr>.*?</tr>\s+<tr>\s+<td colspan='
r'"2">(?:<a href[^>]+>([^<]+)</a>\s+|([^<]+))</td>\s+<td>'
r'(?:<a href[^>]+>([^<]+)</a>|<img src="images/spacer.gif"(.))',
re.I|re.S)
def extension(self, irc, msg, args):

View File

@ -202,10 +202,6 @@ class Karma(callbacks.PrivmsgCommandAndRegexp,
orderby = 'subtracted'
elif kind == 'active':
orderby = 'added+subtracted'
else:
self.log.error('Impossible condition in most: kind=%s' % kind)
irc.error(conf.replyPossibleBug)
return
sql = "SELECT name, %s FROM karma ORDER BY %s DESC LIMIT %s" % \
(orderby, orderby,
self.configurables.get('karma-most-display', channel))

View File

@ -178,7 +178,7 @@ class Lookup(callbacks.Privmsg):
cursor.execute("CREATE INDEX %s_keys ON %s (key)" %(name,name))
db.commit()
self.addCommand(name)
irc.reply('%s (lookup %s added)' % (conf.replySuccess, name))
irc.replySuccess('(lookup %s added)' % name)
add = privmsgs.checkCapability(add, 'admin')
def addCommand(self, name):

View File

@ -121,7 +121,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
else:
options = cursor.fetchall()
optionstr = 'Options:'
optionstr += ''.join([' %s: %r' % (id, option) \
optionstr += ''.join([' %s: %r' % (id, option)
for id, option in options])
pollstr = 'Poll #%s: %r started by %s. %s. Poll is %s.' % \
(poll_id, question, starter, optionstr, statusstr)
@ -148,7 +148,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
db.commit()
cursor.execute("""SELECT id FROM polls WHERE question=%s""", question)
id = cursor.fetchone()[0]
irc.reply('%s (poll #%s)' % (conf.replySuccess, id))
irc.replySuccess('(poll #%s)' % id)
def close(self, irc, msg, args):
"""[<channel>] <id>

View File

@ -94,7 +94,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
WHERE added_by=%s AND added_at=%s AND quote=%s"""
cursor.execute(sql, msg.nick, quotetime, quote)
quoteid = cursor.fetchone()[0]
irc.reply('%s (Quote #%s added)' % (conf.replySuccess, quoteid))
irc.replySuccess('(Quote #%s added)' % quoteid)
def num(self, irc, msg, args):
"""[<channel>]
@ -222,17 +222,18 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
(id, added_by, added_at, quote) = cursor.fetchone()
timestamp = time.strftime(conf.humanTimestampFormat,
time.localtime(int(added_at)))
irc.reply('Quote %r added by %s at %s.' % \
irc.reply('Quote %r added by %s at %s.' %
(quote, added_by, timestamp))
else:
irc.error('There isn\'t a quote with that id.')
def remove(self, irc, msg, args, channel):
def remove(self, irc, msg, args):
"""[<channel>] <id>
Removes quote <id> from the quotes database for <channel>. <channel>
is only necessary if the message isn't sent in the channel itself.
"""
channel = privmsgs.getChannel(msg, args)
id = privmsgs.getArgs(args)
db = self.getDb(channel)
cursor = db.cursor()

View File

@ -89,7 +89,7 @@ class Scheduler(callbacks.Privmsg):
f = self._makeCommandFunction(irc, msg, command)
id = schedule.addEvent(f, time.time() + seconds)
self.events[str(id)] = command
irc.reply('%s Event #%s added.' % (conf.replySuccess, id))
irc.replySuccess('Event #%s added.' % id)
def remove(self, irc, msg, args):
"""<id>
@ -106,7 +106,7 @@ class Scheduler(callbacks.Privmsg):
pass
try:
schedule.removeEvent(id)
irc.reply(conf.replySuccess)
irc.replySuccess()
except KeyError:
irc.error('Invalid event id.')
else:

View File

@ -82,7 +82,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
ChanServ, respectively, They default to NickServ and ChanServ.
"""
if ircutils.isChannel(msg.args[0]):
irc.error(conf.replyRequiresPrivacy)
irc.errorRequiresPrivacy()
return
(self.nick, self.password, nickserv, chanserv) = \
privmsgs.getArgs(args, required=2, optional=2)

View File

@ -104,8 +104,8 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
regexps = ['sfSnarfer']
_reopts = re.I
_infoRe = re.compile(r'<td nowrap>(\d+)</td><td><a href='\
'"([^"]+)">([^<]+)</a>', _reopts)
_infoRe = re.compile(r'<td nowrap>(\d+)</td><td><a href='
r'"([^"]+)">([^<]+)</a>', re.I)
_hrefOpts = '&set=custom&_assigned_to=0&_status=1&_category=100' \
'&_group=100&order=artifact_id&sort=DESC'
_resolution=re.compile(r'<b>(Resolution):</b> <a.+?<br>(.+?)</td>',_reopts)
@ -180,8 +180,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
if resp:
irc.reply(resp[0])
return
irc.error('No Trackers were found. (%s)' %
conf.replyPossibleBug)
irc.errorPossibleBug('No Trackers were found.')
except webutils.WebError, e:
irc.error(e.msg())
@ -195,8 +194,9 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
project = privmsgs.getArgs(args, required=0, optional=1)
try:
int(project)
irc.error('Use the bug command to get information about a '\
'specific bug.')
# They want the bug command, they're giving us an id#.
s = 'Use the bug command to get information about a specific bug.'
irc.error(s)
return
except ValueError:
pass
@ -246,8 +246,9 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
project = privmsgs.getArgs(args, required=0, optional=1)
try:
int(project)
irc.error('Use the rfe command to get information about a '\
'specific rfe.')
# They want a specific RFE, they gave us its id#.
s = 'Use the rfe command to get information about a specific rfe.'
irc.error(s)
return
except ValueError:
pass
@ -309,9 +310,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
head = '%s #%s:' % (ircutils.bold(linktype), num)
resp.append(desc)
else:
s = '%s does not appear to be a proper Sourceforge ' \
'Tracker page (%s)' % (url, conf.replyPossibleBug)
self.log.warning(s)
self.log.warning('Invalid Tracker page snarfed: %s', url)
for r in self._res:
m = r.search(s)
if m:

View File

@ -208,7 +208,7 @@ class Todo(callbacks.Privmsg):
cursor.execute("""SELECT id FROM todo
WHERE added_at=%s AND userid=%s""", now, id)
todoId = cursor.fetchone()[0]
irc.reply('%s (Todo #%s added)' % (conf.replySuccess, todoId))
irc.replySuccess('(Todo #%s added)' % (todoId))
def remove(self, irc, msg, args):
"""<task id> [<task id> ...]
@ -235,8 +235,8 @@ class Todo(callbacks.Privmsg):
invalid.append(taskid)
#print 'Invalid tasks: %s' % repr(invalid)
if invalid:
irc.error('No tasks were removed because the following '\
'tasks could not be removed: %s' % \
irc.error('No tasks were removed because the following '
'tasks could not be removed: %s' %
utils.commaAndify(invalid))
else:
for taskid in tasks:

View File

@ -304,9 +304,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
self._updateTinyDb(url, tinyurl, channel)
irc.reply(tinyurl)
else:
s = 'Could not parse the TinyURL.com results page. (%s)' % \
conf.replyPossibleBug
irc.error(s)
s = 'Could not parse the TinyURL.com results page.'
irc.errorPossibleBug(s)
tiny = privmsgs.thread(tiny)
def num(self, irc, msg, args):
@ -320,7 +319,7 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
cursor = db.cursor()
cursor.execute("""SELECT COUNT(*) FROM urls""")
(count,) = cursor.fetchone()
irc.reply('I have %s %s in my database.' % \
irc.reply('I have %s %s in my database.' %
(count, int(count) == 1 and 'URL' or 'URLs'))
def last(self, irc, msg, args):

View File

@ -62,22 +62,22 @@ class Weather(callbacks.Privmsg):
irc.error(str(e))
_cityregex = re.compile(
r'<td><font size="4" face="arial"><b>'\
r'(.*?), (.*?),(.*?)</b></font></td>', re.IGNORECASE)
r'<td><font size="4" face="arial"><b>'
r'(.*?), (.*?),(.*?)</b></font></td>', re.I)
_interregex = re.compile(
r'<td><font size="4" face="arial"><b>'\
r'([^,]+), ([^<]+)</b></font></td>', re.IGNORECASE)
r'<td><font size="4" face="arial"><b>'
r'([^,]+), ([^<]+)</b></font></td>', re.I)
_condregex = re.compile(
r'<td width="100%" colspan="2" align="center"><strong>'\
r'<font face="arial">([^<]+)</font></strong></td>', re.IGNORECASE)
r'<td width="100%" colspan="2" align="center"><strong>'
r'<font face="arial">([^<]+)</font></strong></td>', re.I)
_tempregex = re.compile(
r'<td valign="top" align="right"><strong><font face="arial">'\
r'([^<]+)</font></strong></td>', re.IGNORECASE)
r'<td valign="top" align="right"><strong><font face="arial">'
r'([^<]+)</font></strong></td>', re.I)
_chillregex = re.compile(
r'Wind Chill</font></strong>:</small></a></td>\s+<td align="right">'\
r'Wind Chill</font></strong>:</small></a></td>\s+<td align="right">'
r'<small><font face="arial">([^<]+)</font></small></td>', re.I | re.S)
_heatregex = re.compile(
r'Heat Index</font></strong>:</small></a></td>\s+<td align="right">'\
r'Heat Index</font></strong>:</small></a></td>\s+<td align="right">'
r'<small><font face="arial">([^<]+)</font></small></td>', re.I | re.S)
# States
_realStates = sets.Set(['ak', 'al', 'ar', 'az', 'ca', 'co', 'ct',
@ -126,14 +126,12 @@ class Weather(callbacks.Privmsg):
country = self._countryMap[country]
url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?' \
'pass=&dpp=&forecast=zandh&config=&' \
'place=%s&state=%s&country=%s' % \
(city, state, country)
'place=%s&state=%s&country=%s' % (city, state, country)
html = webutils.getUrl(url)
if 'was not found' in html:
url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?' \
'pass=&dpp=&forecast=zandh&config=&' \
'place=%s&state=&country=%s' % \
(city, state)
'place=%s&state=&country=%s' % (city, state)
html = webutils.getUrl(url)
if 'was not found' in html:
irc.error('No such location could be found.')

View File

@ -184,7 +184,7 @@ class Words(callbacks.Privmsg, configurable.Mixin):
return
else:
addWord(self.dbHandler.getDb(), word, commit=True)
irc.reply(msg, conf.replySuccess)
irc.replySuccess()
def crossword(self, irc, msg, args):
"""<word>

View File

@ -141,7 +141,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
to protect the secrecy of secret channels.
"""
if ircutils.isChannel(msg.args[0]):
irc.error(conf.replyRequiresPrivacy)
irc.errorRequiresPrivacy()
return
L = irc.state.channels.keys()
if L:

View File

@ -286,7 +286,7 @@ class User(callbacks.Privmsg):
specified, returns the hostmasks of the user calling the command.
"""
if ircutils.isChannel(msg.args[0]):
irc.error(conf.replyRequiresPrivacy)
irc.errorRequiresPrivacy()
return
name = privmsgs.getArgs(args, required=0, optional=1)
try:

View File

@ -299,15 +299,17 @@ class RichReplyMethods(object):
def replySuccess(self, s='', **kwargs):
self.reply(self._makeReply(conf.replySuccess, s), **kwargs)
def replyPossibleBug(self, s='', **kwargs):
self.reply(self._makeReply(conf.replyPossibleBug, s), **kwargs)
def replyError(self, s='', **kwargs):
self.reply(self._makeReply(conf.replyError, s), **kwargs)
def errorNoCapability(self, capability, s='', **kwargs):
self.error(self._makeReply(conf.replyNoCapability % s, s), **kwargs)
def errorPossibleBug(self, s='', **kwargs):
if s:
s += ' (%s)' % conf.replyPossibleBug
self.error(s, **kwargs)
def errorNotRegistered(self, s='', **kwargs):
self.error(self._makeReply(conf.replyNotRegistered, s), **kwargs)