diff options
| author | 2019-09-04 14:27:10 +0100 | |
|---|---|---|
| committer | 2019-09-04 14:27:10 +0100 | |
| commit | 203216d94d44586d1fe261b48039058c2917e71a (patch) | |
| tree | 1403235606ca63cb18051a9026e7d39cafbc5296 /modules/birthday.py | |
| parent | switch throttle.py to use FunctionSetting (diff) | |
Switch more settings to FunctionSettings
Diffstat (limited to 'modules/birthday.py')
| -rw-r--r-- | modules/birthday.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/modules/birthday.py b/modules/birthday.py index 563c7a73..f1814ec6 100644 --- a/modules/birthday.py +++ b/modules/birthday.py @@ -31,21 +31,20 @@ def _format(years, dt): else: return _format_noyear(dt) -class BirthdaySetting(utils.Setting): - def parse(self, value: str) -> typing.Any: - parsed = _parse(value) - if parsed: - years, parsed = parsed - return _format(years, parsed) - return None +def _parse_setting(value): + parsed = _parse(value) + if parsed: + years, parsed = parsed + return _format(years, parsed) + return None def _apostrophe(nickname): if nickname[-1].lower() == "s": return "%s'" % nickname return "%s's" % nickname -@utils.export("set", BirthdaySetting("birthday", "Set your birthday", - example="1995-09-15")) +@utils.export("set", utils.FunctionSetting(_parse_setting, "birthday", + "Set your birthday", example="1995-09-15")) class Module(ModuleManager.BaseModule): @utils.hook("received.command.birthday") def birthday(self, event): |
