mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-19 23:20:57 +01:00
Teaches me not to compare strings like they're ints
This commit is contained in:
parent
57b038ea63
commit
c6a6fd47b7
@ -168,16 +168,17 @@ class Weather(callbacks.Privmsg):
|
|||||||
conds = self._condregex.search(html)
|
conds = self._condregex.search(html)
|
||||||
if conds:
|
if conds:
|
||||||
conds = conds.group(1)
|
conds = conds.group(1)
|
||||||
chill = self._chillregex.search(html)
|
self.log.warning(repr(self._chillregex))
|
||||||
if chill:
|
if chill:
|
||||||
|
#self.log.warning(chill.groups())
|
||||||
chill = chill.group(1)
|
chill = chill.group(1)
|
||||||
heat = self._heatregex.search(html)
|
heat = self._heatregex.search(html)
|
||||||
if heat:
|
if heat:
|
||||||
heat = heat.group(1)
|
heat = heat.group(1)
|
||||||
|
|
||||||
if heat[:-2] > temp[:-2]:
|
if int(heat[:-2]) > int(temp[:-2]):
|
||||||
index = ' (Heat Index: %s)' % heat
|
index = ' (Heat Index: %s)' % heat
|
||||||
elif chill[:-2] < temp[:-2]:
|
elif int(chill[:-2]) < int(temp[:-2]):
|
||||||
index = ' (Wind Chill: %s)' % chill
|
index = ' (Wind Chill: %s)' % chill
|
||||||
else:
|
else:
|
||||||
index = ''
|
index = ''
|
||||||
@ -186,7 +187,7 @@ class Weather(callbacks.Privmsg):
|
|||||||
conds = conds.replace('Tsra', 'Thunder Storms')
|
conds = conds.replace('Tsra', 'Thunder Storms')
|
||||||
s = 'The current temperature in %s, %s is %s%s. Conditions: %s' % \
|
s = 'The current temperature in %s, %s is %s%s. Conditions: %s' % \
|
||||||
(city, state, temp, index, conds)
|
(city, state, temp, index, conds)
|
||||||
irc.reply(s)
|
irc.reply(msg, s)
|
||||||
else:
|
else:
|
||||||
irc.error('The format of the page was odd.')
|
irc.error('The format of the page was odd.')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user