switch throttle.py to use FunctionSetting
This commit is contained in:
parent
007bb78d30
commit
43fab6777c
1 changed files with 6 additions and 7 deletions
|
@ -1,13 +1,12 @@
|
||||||
from src import ModuleManager, utils
|
from src import ModuleManager, utils
|
||||||
|
|
||||||
class ThrottleSetting(utils.Setting):
|
def _parse(value):
|
||||||
def parse(self, value):
|
lines, _, seconds = value.partition(":")
|
||||||
lines, _, seconds = value.partition(":")
|
if lines.isdigit() and seconds.isdigit():
|
||||||
if lines.isdigit() and seconds.isdigit():
|
return [int(lines), int(seconds)]
|
||||||
return [int(lines), int(seconds)]
|
return None
|
||||||
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"))
|
"Configure lines:seconds throttle for the current server", example="4:2"))
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("received.001")
|
@utils.hook("received.001")
|
||||||
|
|
Loading…
Reference in a new issue