feat!: Updated configuration and moved config location

This commit is contained in:
Marius Begby committed 2023-07-18 13:11:15 +02:00
1 parent 2d0df79dac
commit dd4b56ae67
40 files changed
+468 -482

No files matched your search

+7 -9
View File
@@ -1,7 +1,5 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
const { embedOptions, systemOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
isSystemCommand: true,
@@ -10,14 +8,14 @@ module.exports = {
.setDescription('Show list of guilds where bot is added.')
.setDMPermission(false),
execute: async ({ interaction, client }) => {
if (!systemServerGuildIds.includes(interaction.guildId)) {
if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -37,7 +35,7 @@ module.exports = {
const totalMemberCount = client.guilds.cache.reduce((a, b) => a + b.memberCount, 0);
let embedDescription =
`**${embedIcons.bot} ${
`**${embedOptions.icons.bot} ${
client.guilds.cache.size < 50 ? `Top ${client.guilds.cache.size} guilds` : 'Top 50 guilds'
} by member count (${client.guilds.cache.size} total)**\n${guildsList}` +
`\n\n**Total members:** \`${totalMemberCount}\``;
@@ -47,7 +45,7 @@ module.exports = {
}
return await interaction.editReply({
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedColors.colorInfo)]
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedOptions.colors.info)]
});
}
};
+11 -13
View File
@@ -1,23 +1,21 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const { embedOptions, systemOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
const osu = require('node-os-utils');
const packageJson = require(path.resolve('./package.json'));
const { version, dependencies } = require('../../../package.json');
module.exports = {
isSystemCommand: true,
data: new SlashCommandBuilder().setName('status').setDescription('Show bot status.').setDMPermission(false),
execute: async ({ interaction, client }) => {
if (!systemServerGuildIds.includes(interaction.guildId)) {
if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -32,9 +30,9 @@ module.exports = {
const cpuUsage = await osu.cpu.usage();
const cpuCores = await osu.cpu.count();
const platform = await osu.os.platform();
const releaseVersion = packageJson.version;
const discordJsVersion = packageJson.dependencies['discord.js'];
const discordPlayerVersion = packageJson.dependencies['discord-player'];
const releaseVersion = version;
const discordJsVersion = dependencies['discord.js'];
const discordPlayerVersion = dependencies['discord-player'];
const discordApiLatency = client.ws.ping;
let activeVoiceConnections = 0;
client.guilds.cache.forEach((guild) => {
@@ -49,7 +47,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.bot} System and bot status**\n` +
`**${embedOptions.icons.bot} System and bot status**\n` +
`Uptime: \`${uptimeString}\`\n` +
`Platform: \`${platform}\`\n` +
`CPU cores: \`${cpuCores}\`\n` +
@@ -65,7 +63,7 @@ module.exports = {
`Active voice connections: \`${activeVoiceConnections}\`\n` +
`Joined guilds: \`${client.guilds.cache.size}\``
)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
}