From 358c51edeb9f3757c2573ca1dae29d1c538c0bcd Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Tue, 26 Sep 2023 20:48:06 +1000 Subject: [PATCH] Add hashes --- src/commands/statistics.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/commands/statistics.ts b/src/commands/statistics.ts index 38d8c13..31593fc 100644 --- a/src/commands/statistics.ts +++ b/src/commands/statistics.ts @@ -7,7 +7,15 @@ import si from 'systeminformation'; import TClient from '../client.js'; import os from 'node:os'; import {readFileSync} from 'node:fs'; +import {execSync} from 'node:child_process'; const packageJson = JSON.parse(readFileSync('package.json', 'utf8')); + +function commitHashes() { + const localHash = execSync('git rev-parse HEAD').toString().trim().slice(0, 7); + const remoteHash = execSync('git ls-remote origin HEAD').toString().split('\t')[0].slice(0, 7); + return { localHash, remoteHash }; +} + export default { async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ const waitForData = await interaction.reply({content: '', fetchReply:true}) @@ -43,6 +51,12 @@ export default { embed.addFields({name: '\u200b', value: `\`\`\`\n${fieldValue}\`\`\``}); } else embed.addFields({name: '\u200b', value: `\`\`\`\n${rows.join('')}\`\`\``}); embed.addFields( + { + name: '> __Repository__', value: MessageTool.concatMessage( + `**Local:** ${commitHashes().localHash}`, + `**Remote:** ${commitHashes().remoteHash}` + ) + }, {name: '> __Dependencies__', value: MessageTool.concatMessage( `**TypeScript:** ${pkg.version}`, `**NodeJS:** ${process.version}`,