Skip to content

Commit

Permalink
feat(userinfo): add configurable last seen timestamp (#2537)
Browse files Browse the repository at this point in the history
Fixes #677
  • Loading branch information
sogehige committed Sep 17, 2019
1 parent 29fb455 commit 4b45bb3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion locales/cs/ui/systems/userinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"settings": {
"enabled": "Status",
"formatSeparator": "Oddělovač formátu",
"order": "Formát"
"order": "Formát",
"lastSeenFormat": {
"title": "Zobrazení času",
"help": "Možné hodnoty naleznete na https://momentjs.com/docs/#/displaying/format/"
}
}
}
6 changes: 5 additions & 1 deletion locales/en/ui/systems/userinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"settings": {
"enabled": "Status",
"formatSeparator": "Format separator",
"order": "Format"
"order": "Format",
"lastSeenFormat": {
"title": "Time format",
"help": "Possible formats at https://momentjs.com/docs/#/displaying/format/"
}
}
}
5 changes: 4 additions & 1 deletion src/bot/systems/userinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class UserInfo extends System {
@settings('me')
formatSeparator = ' | ';

@settings('lastseen')
lastSeenFormat = 'L LTS';

@command('!followage')
protected async followage(opts: CommandOptions) {
let username;
Expand Down Expand Up @@ -170,7 +173,7 @@ class UserInfo extends System {
moment.locale(global.lib.translate.lang);
sendMessage(global.translate('lastseen.success.time')
.replace(/\$username/g, parsed[0])
.replace(/\$when/g, moment(user.time.message).format('L') + ' ' + moment(user.time.message).format('LTS')), opts.sender);
.replace(/\$when/g, moment(user.time.message).format(this.lastSeenFormat)), opts.sender);
}
} catch (e) {
sendMessage(global.translate('lastseen.failed.parse'), opts.sender, opts.attr);
Expand Down

0 comments on commit 4b45bb3

Please sign in to comment.