_gkrecord regex needed to be before stripHtml. Also fixed the _gkseen regex since there is not always 2 spaces. Used \s+ instead.

This commit is contained in:
James Vega 2003-03-27 17:37:47 +00:00
parent 3cd72723e4
commit f355465ad6

View File

@ -140,7 +140,7 @@ class Http(callbacks.Privmsg):
_gkrecord = re.compile(r'"#FFFF00">(\d+)[^"]+"#FFFF00">(\d+)[^"]+'\ _gkrecord = re.compile(r'"#FFFF00">(\d+)[^"]+"#FFFF00">(\d+)[^"]+'\
'"#FFFF00">(\d+)') '"#FFFF00">(\d+)')
_gkteam = re.compile('Team:([^\s]+)') _gkteam = re.compile('Team:([^\s]+)')
_gkseen = re.compile('seen on GK: ([^\n]+)') _gkseen = re.compile('seen on GK:\s+([^\n]+)')
def gkstats(self, irc, msg, args): def gkstats(self, irc, msg, args):
"""<name>""" """<name>"""
name = privmsgs.getArgs(args) name = privmsgs.getArgs(args)
@ -151,17 +151,17 @@ class Http(callbacks.Privmsg):
fd.close() fd.close()
rating = self._gkrating.search(profile).group(1) rating = self._gkrating.search(profile).group(1)
games = self._gkgames.search(profile).group(1) games = self._gkgames.search(profile).group(1)
(w, l, d) = self._gkrecord.search(profile).groups()
profile = stripHtml(profile) profile = stripHtml(profile)
seen = self._gkseen.search(profile).group(1) seen = self._gkseen.search(profile).group(1)
(w, l, d) = self._gkrecord.search(profile).groups()
if profile.find('Team:') >= 0: if profile.find('Team:') >= 0:
team = self._gkteam.search(profile).group(1) team = self._gkteam.search(profile).group(1)
irc.reply(msg, '%s (team %s) is rated %s and has %s active ' irc.reply(msg, '%s (team %s) is rated %s and has %s active ' \
'games and a record of W-%s, L-%s, D-%s. ' \ 'games and a record of W-%s, L-%s, D-%s. ' \
'%s was last seen on Gameknot %s' % \ '%s was last seen on Gameknot %s' % \
(name, team, rating, games, w, l, d, name, seen)) (name, team, rating, games, w, l, d, name, seen))
else: else:
irc.reply(msg, '%s is rated %s and has %s active games ' irc.reply(msg, '%s is rated %s and has %s active games ' \
'and a record of W-%s, L-%s, D-%s. ' \ 'and a record of W-%s, L-%s, D-%s. ' \
'%s was last seen on Gameknot %s' % \ '%s was last seen on Gameknot %s' % \
(name, rating, games, w, l, d, name, seen)) (name, rating, games, w, l, d, name, seen))