diff options
| author | 2019-09-04 12:11:22 +0100 | |
|---|---|---|
| committer | 2019-09-04 12:11:22 +0100 | |
| commit | 43fab6777cc27c53840e4ba58d2dea7142cc98ac (patch) | |
| tree | 7a10810d2d6f8c6e596150996e7aa7b7e044a091 /modules/throttle.py | |
| parent | make utils.from_pretty_time() format much stricter (diff) | |
| signature | ||
switch throttle.py to use FunctionSetting
Diffstat (limited to 'modules/throttle.py')
| -rw-r--r-- | modules/throttle.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/throttle.py b/modules/throttle.py index 6104b32d..e204cc34 100644 --- a/modules/throttle.py +++ b/modules/throttle.py @@ -1,13 +1,12 @@ from src import ModuleManager, utils -class ThrottleSetting(utils.Setting): - def parse(self, value): - lines, _, seconds = value.partition(":") - if lines.isdigit() and seconds.isdigit(): - return [int(lines), int(seconds)] - return None +def _parse(value): + lines, _, seconds = value.partition(":") + if lines.isdigit() and seconds.isdigit(): + return [int(lines), int(seconds)] + return None -@utils.export("serverset", ThrottleSetting("throttle", +@utils.export("serverset", utils.FunctionSetting(_parse, "throttle", "Configure lines:seconds throttle for the current server", example="4:2")) class Module(ModuleManager.BaseModule): @utils.hook("received.001") |
