switch throttle.py to use FunctionSetting

This commit is contained in:
jesopo 2019-09-04 12:11:22 +01:00
parent 007bb78d30
commit 43fab6777c

View file

@ -1,13 +1,12 @@
from src import ModuleManager, utils
class ThrottleSetting(utils.Setting):
def parse(self, value):
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")