diff options
| author | 2019-04-28 10:50:35 +0100 | |
|---|---|---|
| committer | 2019-04-28 10:50:35 +0100 | |
| commit | 4466bc34de3d82ae95fc726afa89635018607fb3 (patch) | |
| tree | 88d3eaede45b415cfec0ea9e64b1d9675b30c321 /modules | |
| parent | Show the full result of a !config change (diff) | |
| signature | ||
Add location.py, to allow users to set their location
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/location.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/location.py b/modules/location.py new file mode 100644 index 00000000..ee97419b --- /dev/null +++ b/modules/location.py @@ -0,0 +1,17 @@ +from src import ModuleManager, utils +import pytz + +_lower_timezones = {} +for tz in pytz.all_timezones: + if "/" in tz: + _lower_timezones[tz.split("/", 1)[1].lower()] = tz + _lower_timezones[tz.lower()] = tz + +def _find_tz(s): + print(_lower_timezones.get(s.lower(), None)) + return _lower_timezones.get(s.lower(), None) + +@utils.export("set", {"setting": "location", "help": "Set your location", + "validate": _find_tz}) +class Module(ModuleManager.BaseModule): + pass |
