Hook factorisation ; add new hooks : default (same comportement has previous version) and one hook before any parsing
When calling a hook, passed parameters change according to associated data variable
This commit is contained in:
parent
9ec07790ef
commit
7e20368c10
8 changed files with 109 additions and 63 deletions
|
|
@ -20,7 +20,7 @@ def load(context):
|
|||
context.hooks.add_hook(context.hooks.cmd_hook, Hook(cmd_sleep, "sleepytime"))
|
||||
|
||||
|
||||
def cmd_sleep(data, msg):
|
||||
def cmd_sleep(msg):
|
||||
if len (msg.cmd) > 1 and re.match("[0-9]{1,2}[h':.,-]([0-9]{1,2})?[m'\":.,-]?",
|
||||
msg.cmd[1]) is not None:
|
||||
# First, parse the hour
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue