From 43fab6777cc27c53840e4ba58d2dea7142cc98ac Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 4 Sep 2019 12:11:22 +0100 Subject: switch throttle.py to use FunctionSetting --- modules/throttle.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'modules') 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") -- cgit v1.3.1-10-gc9f91