Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
feat(ClientUtils): add getCommitHash method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mednoob committed Dec 22, 2022
1 parent 2979111 commit 50ee008
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils/structures/ClientUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable class-methods-use-this */
import { Rawon } from "../../structures/Rawon";
import { Guild, Role, ChannelType } from "discord.js";
import { execSync } from "child_process";
import prism from "prism-media";
import { parse } from "path";

Expand Down Expand Up @@ -137,4 +138,13 @@ export class ClientUtils {
return "Unknown";
}
}

public getCommitHash(ref: string, short = true): string {
try {
const res = execSync(`git rev-parse${short ? " --short" : ""} ${ref}`);
return res.toString().trim();
} catch {
return "???"
}
}
}

0 comments on commit 50ee008

Please sign in to comment.