From 87332c1ac4882e2de5b019c1d5a1ac048b408145 Mon Sep 17 00:00:00 2001 From: Mallory Hancock Date: Wed, 27 Sep 2017 16:54:08 -0700 Subject: [PATCH] create decorator for plugin creation (thanks @datagrok) --- pinhook/plugin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pinhook/plugin.py b/pinhook/plugin.py index ce152b6..d7fb356 100644 --- a/pinhook/plugin.py +++ b/pinhook/plugin.py @@ -17,3 +17,10 @@ def message(msg): def add_plugin(command, func): cmds.append({'cmd': command, 'func': func}) + +def register(command): + def register_for_command(func): + add_plugin(command, func) + return func + return register_for_command +