mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Fix last update/version in !about
This commit is contained in:
parent
bcfaf1fee3
commit
8e37ca3609
4 changed files with 25 additions and 5 deletions
8
backend/package-lock.json
generated
8
backend/package-lock.json
generated
|
@ -3221,6 +3221,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"pkg-up": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
|
||||
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
|
||||
"requires": {
|
||||
"find-up": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"plur": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz",
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
"passport": "^0.4.0",
|
||||
"passport-custom": "^1.0.5",
|
||||
"passport-oauth2": "^1.5.0",
|
||||
"pkg-up": "^3.1.0",
|
||||
"reflect-metadata": "^0.1.12",
|
||||
"regexp-worker": "^1.1.0",
|
||||
"safe-regex": "^2.0.2",
|
||||
|
|
9
backend/src/paths.ts
Normal file
9
backend/src/paths.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import path from "path";
|
||||
import pkgUp from "pkg-up";
|
||||
|
||||
const backendPackageJson = pkgUp.sync({
|
||||
cwd: __dirname,
|
||||
});
|
||||
|
||||
export const backendDir = path.dirname(backendPackageJson);
|
||||
export const rootDir = path.resolve(backendDir, "..");
|
|
@ -6,7 +6,9 @@ import humanizeDuration from "humanize-duration";
|
|||
import LCL from "last-commit-log";
|
||||
import path from "path";
|
||||
import moment from "moment-timezone";
|
||||
import { getGuildTz } from "../../../utils/timezones";
|
||||
import { getGuildTz, inGuildTz } from "../../../utils/timezones";
|
||||
import { rootDir } from "../../../paths";
|
||||
import { getDateFormat } from "../../../utils/dateFormats";
|
||||
|
||||
export const AboutCmd = utilityCmd({
|
||||
trigger: "about",
|
||||
|
@ -20,9 +22,7 @@ export const AboutCmd = utilityCmd({
|
|||
let lastCommit;
|
||||
|
||||
try {
|
||||
// From project root
|
||||
// FIXME: Store these paths properly somewhere
|
||||
const lcl = new LCL(path.resolve(__dirname, "..", "..", ".."));
|
||||
const lcl = new LCL(rootDir);
|
||||
lastCommit = await lcl.getLastCommit();
|
||||
} catch (e) {} // tslint:disable-line:no-empty
|
||||
|
||||
|
@ -30,7 +30,9 @@ export const AboutCmd = utilityCmd({
|
|||
let version;
|
||||
|
||||
if (lastCommit) {
|
||||
lastUpdate = moment.utc(lastCommit.committer.date, "X").format("LL [at] H:mm z");
|
||||
lastUpdate = inGuildTz(pluginData, moment.utc(lastCommit.committer.date, "X")).format(
|
||||
getDateFormat(pluginData, "pretty_datetime"),
|
||||
);
|
||||
version = lastCommit.shortHash;
|
||||
} else {
|
||||
lastUpdate = "?";
|
||||
|
|
Loading…
Add table
Reference in a new issue