Add location.py, to allow users to set their location
This commit is contained in:
parent
24716402ec
commit
4466bc34de
1 changed files with 17 additions and 0 deletions
17
modules/location.py
Normal file
17
modules/location.py
Normal file
|
@ -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
|
Loading…
Reference in a new issue