mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-02 16:09:24 +01:00
Fix for fix for scheduler.list showing ran (but not removed) events.
This commit is contained in:
parent
c96065a540
commit
7d3c9ffef0
@ -53,7 +53,7 @@ class Scheduler(callbacks.Privmsg):
|
|||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
self.events = {}
|
self.events = {}
|
||||||
|
|
||||||
def _makeCommandFunction(self, irc, msg, command):
|
def _makeCommandFunction(self, irc, msg, command, remove=True)
|
||||||
"""Makes a function suitable for scheduling from command."""
|
"""Makes a function suitable for scheduling from command."""
|
||||||
tokens = callbacks.tokenize(command)
|
tokens = callbacks.tokenize(command)
|
||||||
Owner = irc.getCallback('Owner')
|
Owner = irc.getCallback('Owner')
|
||||||
@ -61,6 +61,7 @@ class Scheduler(callbacks.Privmsg):
|
|||||||
if ambiguous:
|
if ambiguous:
|
||||||
raise callbacks.Error, callbacks.ambiguousReply(ambiguous)
|
raise callbacks.Error, callbacks.ambiguousReply(ambiguous)
|
||||||
def f():
|
def f():
|
||||||
|
if remove:
|
||||||
del self.events[f.eventId]
|
del self.events[f.eventId]
|
||||||
self.Proxy(irc.irc, msg, tokens)
|
self.Proxy(irc.irc, msg, tokens)
|
||||||
return f
|
return f
|
||||||
@ -129,7 +130,7 @@ class Scheduler(callbacks.Privmsg):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
self.events[name] = command
|
self.events[name] = command
|
||||||
f = self._makeCommandFunction(irc, msg, command)
|
f = self._makeCommandFunction(irc, msg, command, remove=False)
|
||||||
id = schedule.addPeriodicEvent(f, seconds, name)
|
id = schedule.addPeriodicEvent(f, seconds, name)
|
||||||
assert id == name
|
assert id == name
|
||||||
# We don't reply because the command runs immediately.
|
# We don't reply because the command runs immediately.
|
||||||
|
Loading…
Reference in New Issue
Block a user