diff options
| author | 2019-06-26 14:37:26 +0100 | |
|---|---|---|
| committer | 2019-06-26 14:37:41 +0100 | |
| commit | c5785a2d1484a98616b0fb8b5a7cb728eb094435 (patch) | |
| tree | 470ace2c509805fb9b723592df196b4e9e0edb46 /src/utils | |
| parent | Update IRCBot `except queue.Empty` comment (diff) | |
| signature | ||
implement @utils.kwarg() magic, use it for command.regex hooks
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/__init__.py | 5 | ||||
| -rw-r--r-- | src/utils/consts.py | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 4e947c4b..de812f5b 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -184,6 +184,11 @@ def export(setting: str, value: typing.Any): {"setting": setting, "value": value}) return module return _export_func +def kwarg(key: str, value: typing.Any): + def _kwarg_func(func): + _set_get_append(func, consts.BITBOT_KWARG_MAGIC, {key: value}) + return func + return _kwarg_func class MultiCheck(object): def __init__(self, diff --git a/src/utils/consts.py b/src/utils/consts.py index f5272cab..0c57b4b0 100644 --- a/src/utils/consts.py +++ b/src/utils/consts.py @@ -2,6 +2,7 @@ import typing from . import _consts_256_color BITBOT_HOOKS_MAGIC = "__bitbot_hooks" +BITBOT_KWARG_MAGIC = "__bitbot_kwarg" BITBOT_EXPORTS_MAGIC = "__bitbot_exports" class IRCColor(object): |
