Compare commits

...

5 commits

Author SHA1 Message Date
6ce4ca6fb8
Add unique member count to botinfo
All checks were successful
CI / CI (push) Successful in 22s
2025-06-24 03:47:30 +02:00
a891b37a31
Update githash properly
All checks were successful
CI / CI (push) Successful in 22s
2025-06-24 03:46:17 +02:00
e79d2a7a7e
Add output to executeCommand return
All checks were successful
CI / CI (push) Successful in 22s
2025-06-24 03:40:44 +02:00
24e019e34f
Add latest git hash to botinfo command
All checks were successful
CI / CI (push) Successful in 21s
2025-06-24 03:38:24 +02:00
9c4a57a098
Assign sliced string 2025-06-24 03:35:54 +02:00
4 changed files with 14 additions and 5 deletions

View file

@ -1,4 +1,5 @@
const calculateReloaded = require("../../util/calculateReloaded"); const calculateReloaded = require("../../util/calculateReloaded");
const executeCommand = require("../../util/executeCommand");
const reloadCommands = require("../../util/reloadCommands"); const reloadCommands = require("../../util/reloadCommands");
module.exports = { module.exports = {
@ -27,10 +28,12 @@ module.exports = {
let commitCount = stdout.split(/\r\n|\r|\n/).length - 1 let commitCount = stdout.split(/\r\n|\r|\n/).length - 1
sendText = `${sendText}\n\nLatest commits (${commitCount}):\n${stdout}` sendText = `${sendText}\n\nLatest commits (${commitCount}):\n${stdout}`
if(sendText.length >= 2000){ if(sendText.length >= 2000){
sendText.slice(1955) sendText = sendText.slice(1955)
sendText = `${sendText}\n... Message is too long to show everything` sendText = `${sendText}\n... Message is too long to show everything`
} }
message.channel.send(sendText) message.channel.send(sendText)
const githash = executeCommand(`git`, ["rev-parse", "--short", "HEAD"]);
client.githash = githash.error ? "N/A" : githash.output;
if (err) console.log(stderr) if (err) console.log(stderr)
}) })
} }

View file

@ -12,10 +12,11 @@ module.exports = {
let descriptionArr = [`Name: ${client.user.username}`, let descriptionArr = [`Name: ${client.user.username}`,
`Prefix: ${prefix}`, `Prefix: ${prefix}`,
`Total Servers: ${guildInfo.guildCount}`, `Total Servers: ${guildInfo.guildCount}`,
`Total Members: ${guildInfo.totalMembers}`, `Total Members: ${guildInfo.totalMembers} (${guildInfo.uniqueMemberCount} unique)`,
`Total Commands: ${client.commands.size}`, `Total Commands: ${client.commands.size}`,
`Creation Date: ${getCreationDate(client)}`, `Creation Date: ${getCreationDate(client)}`,
`Source: [Click Here](https://github.com/SileNce5k/discord_bot)` `Source: [Click Here](https://github.com/SileNce5k/discord_bot)`,
`Current Version: ${client.githash}`
] ]
let description = ""; let description = "";

View file

@ -1,6 +1,7 @@
const fs = require('fs'); const fs = require('fs');
const createInitialConfig = require("./util/createInitialConfig") const createInitialConfig = require("./util/createInitialConfig")
const convertJSONToSQL = require('./util/timer/convertJSONToSQL'); const convertJSONToSQL = require('./util/timer/convertJSONToSQL');
const executeCommand = require('./util/executeCommand.js');
const sqlite3 = require('sqlite3').verbose(); const sqlite3 = require('sqlite3').verbose();
if(!fs.existsSync("./data/config.json")) { if(!fs.existsSync("./data/config.json")) {
createInitialConfig(); createInitialConfig();
@ -56,6 +57,9 @@ client.settings.set("presenceType", presenceType);
client.settings.set("presenceText", presenceText); client.settings.set("presenceText", presenceText);
client.settings.set("globalPrefix", globalPrefix); client.settings.set("globalPrefix", globalPrefix);
const githash = executeCommand(`git`, ["rev-parse", "--short", "HEAD"]);
client.githash = githash.error ? "N/A" : githash.output;
const reloadCommands = require("./util/reloadCommands.js"); const reloadCommands = require("./util/reloadCommands.js");
const onMessage = require('./server/message'); const onMessage = require('./server/message');
const onReady = require('./server/ready'); const onReady = require('./server/ready');

View file

@ -2,13 +2,14 @@ const { execFileSync } = require('child_process');
module.exports = function(command, commandArgs, verbose=false) { module.exports = function(command, commandArgs, verbose=false) {
if (typeof command !== 'string' || !Array.isArray(commandArgs)) return { error: true }; if (typeof command !== 'string' || !Array.isArray(commandArgs)) return { error: true };
console.log("Executing:", command, commandArgs.join(" ")); console.log("Executing:", command, commandArgs.join(" "));
let output;
try { try {
const output = execFileSync(command, commandArgs, {encoding: 'utf8'}) output = execFileSync(command, commandArgs, {encoding: 'utf8'})
if (output.length !== 0 && verbose) if (output.length !== 0 && verbose)
console.log(output) console.log(output)
} catch (error) { } catch (error) {
console.error(`Error executing ${command} command:`, error); console.error(`Error executing ${command} command:`, error);
return { error: true }; return { error: true };
} }
return { error: false }; return { error: false, output};
} }