1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 16:30:58 -05:00

Add hashes

This commit is contained in:
AnxietyisReal 2023-09-26 20:48:06 +10:00
parent e9c1a1106b
commit 358c51edeb

View File

@ -7,7 +7,15 @@ import si from 'systeminformation';
import TClient from '../client.js'; import TClient from '../client.js';
import os from 'node:os'; import os from 'node:os';
import {readFileSync} from 'node:fs'; import {readFileSync} from 'node:fs';
import {execSync} from 'node:child_process';
const packageJson = JSON.parse(readFileSync('package.json', 'utf8')); 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 { export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
const waitForData = await interaction.reply({content: '<a:sakjdfsajkfhsdjhjfsa:1065342869428252743>', fetchReply:true}) const waitForData = await interaction.reply({content: '<a:sakjdfsajkfhsdjhjfsa:1065342869428252743>', fetchReply:true})
@ -43,6 +51,12 @@ export default {
embed.addFields({name: '\u200b', value: `\`\`\`\n${fieldValue}\`\`\``}); embed.addFields({name: '\u200b', value: `\`\`\`\n${fieldValue}\`\`\``});
} else embed.addFields({name: '\u200b', value: `\`\`\`\n${rows.join('')}\`\`\``}); } else embed.addFields({name: '\u200b', value: `\`\`\`\n${rows.join('')}\`\`\``});
embed.addFields( embed.addFields(
{
name: '> __Repository__', value: MessageTool.concatMessage(
`**Local:** ${commitHashes().localHash}`,
`**Remote:** ${commitHashes().remoteHash}`
)
},
{name: '> __Dependencies__', value: MessageTool.concatMessage( {name: '> __Dependencies__', value: MessageTool.concatMessage(
`**TypeScript:** ${pkg.version}`, `**TypeScript:** ${pkg.version}`,
`**NodeJS:** ${process.version}`, `**NodeJS:** ${process.version}`,