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
|
||||
|
||||
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")
|
||||
|
|
Loading…
Reference in a new issue