Browse Source

Using kwargs as a dict for register_schedule

pull/104/head
Kyriog 7 years ago
parent
commit
2df215f049
  1. 7
      disco/bot/plugin.py

7
disco/bot/plugin.py

@ -379,7 +379,7 @@ class Plugin(LoggingClass, PluginDeco):
"""
self.commands.append(Command(self, func, *args, **kwargs))
def register_schedule(self, func, interval, repeat=True, init=True, **kwargs):
def register_schedule(self, func, interval, repeat=True, init=True, kwargs=None):
"""
Registers a function to be called repeatedly, waiting for an interval
duration.
@ -395,7 +395,12 @@ class Plugin(LoggingClass, PluginDeco):
init : bool
Whether to run this schedule once immediatly, or wait for the first
scheduled iteration.
kwargs: dict
kwargs which will be passed to executed `func`
"""
if kwargs is None:
kwargs = {}
def repeat_func():
if init:
func(**kwargs)

Loading…
Cancel
Save