diff options
| author | 2019-10-18 15:03:19 +0100 | |
|---|---|---|
| committer | 2019-10-18 15:03:19 +0100 | |
| commit | f7d34e16bb859c4497875e52c7b1c7dac87272fd (patch) | |
| tree | c32a67d4270c38388cae8fb89adb69d0745dc7ca /modules | |
| parent | remove now-unused formatting params for urls (diff) | |
| signature | ||
if a nickname has no location set, assume it's a location
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/user_time.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/user_time.py b/modules/user_time.py index 8ea8b480..cd51c9fb 100644 --- a/modules/user_time.py +++ b/modules/user_time.py @@ -16,27 +16,29 @@ class Module(ModuleManager.BaseModule): _name = "Time" def _find_setting(self, event): - target_user = event["user"] + query = None if event["args"]: + query = event["args"] if len(event["args_split"]) == 1 and event["server"].has_user_id( event["args_split"][0]): target_user = event["server"].get_user(event["args_split"][0]) - else: - location = self.exports.get_one("get-location")(event["args"]) - if location: - return (LocationType.NAME, location["name"], - location["timezone"]) - else: - return LocationType.NAME, event["args"], None + else: + target_user = event["user"] if target_user: location = target_user.get_setting("location", None) if location: return (LocationType.USER, target_user.nickname, location["timezone"]) + + if query: + location = self.exports.get_one("get-location")(query) + if location: + return (LocationType.NAME, location["name"], + location["timezone"]) else: - return LocationType.USER, target_user.nickname, None + return LocationType.NAME, event["args"], None @utils.hook("received.command.time") |
