support location names for !timezone too

This commit is contained in:
jesopo 2019-09-08 18:22:04 +01:00
parent 95c007c1da
commit b1033a0721

View file

@ -72,9 +72,13 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("require_setting", "location") @utils.kwarg("require_setting", "location")
@utils.kwarg("require_setting_unless", "1") @utils.kwarg("require_setting_unless", "1")
def timezone(self, event): def timezone(self, event):
target_user, location = self._find_setting(event) type, name, timezone = self._find_setting(event)
if not location == None: if not timezone == None:
event["stdout"].write("%s is in %s" % (target_user.nickname, event["stdout"].write("%s is in %s" % (name, timezone))
location["timezone"]))
else: else:
event["stderr"].write(NOLOCATION % target_user.nickname) out = None
if type == LocationType.USER:
out = NOLOCATION_USER
else:
out = NOLOCATION_NAME
event["stderr"].write(out % name)