mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 22:51:01 +01:00
Our first use of the userdata registry!
This commit is contained in:
parent
e3b690f933
commit
ae542511be
@ -34,7 +34,7 @@ This plugin does weather-related stuff. It can't change the weather, though,
|
|||||||
so don't get your hopes up. We just report it.
|
so don't get your hopes up. We just report it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__revision__ = "$Id"
|
__revision__ = "$Id$"
|
||||||
|
|
||||||
import plugins
|
import plugins
|
||||||
|
|
||||||
@ -91,6 +91,13 @@ class Weather(callbacks.Privmsg):
|
|||||||
channel = None
|
channel = None
|
||||||
if ircutils.isChannel(msg.args[0]):
|
if ircutils.isChannel(msg.args[0]):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
|
if not args:
|
||||||
|
s = self.userValue('lastLocation', msg.prefix)
|
||||||
|
if s:
|
||||||
|
args = [s]
|
||||||
|
else:
|
||||||
|
location = privmsgs.getArgs(args)
|
||||||
|
self.setUserValue(msg.prefix, 'lastLocation', location)
|
||||||
realCommandName = self.registryValue('command', channel)
|
realCommandName = self.registryValue('command', channel)
|
||||||
realCommand = getattr(self, realCommandName)
|
realCommand = getattr(self, realCommandName)
|
||||||
realCommand(irc, msg, args)
|
realCommand(irc, msg, args)
|
||||||
@ -346,6 +353,9 @@ conf.registerChannelValue(conf.supybot.plugins.Weather, 'convert',
|
|||||||
automatically convert weather units to the unit specified in
|
automatically convert weather units to the unit specified in
|
||||||
supybot.plugins.Weather.temperatureUnit."""))
|
supybot.plugins.Weather.temperatureUnit."""))
|
||||||
|
|
||||||
|
conf.registerUserValue(conf.users.plugins.Weather, 'lastLocation',
|
||||||
|
registry.String('', ''))
|
||||||
|
|
||||||
Class = Weather
|
Class = Weather
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user