Add currency commands and polish utilities

This commit is contained in:
2026-01-26 12:14:18 +01:00
parent 60d52b220a
commit 0c36960645
7 changed files with 213 additions and 37 deletions
+11 -7
View File
@@ -1,19 +1,23 @@
const {SlashCommandBuilder, EmbedBuilder} = require("discord.js");
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName("about")
.setDescription("Information about this bot and creator"),
.setName('about')
.setDescription('Information about this bot and creator'),
async execute(interaction) {
const exampleEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('About Page')
.setDescription('I build this bot for managing my servers. (to lazy to write mor text rn)')
.setTitle('About This Bot')
.setDescription('A multipurpose Discord bot focused on helpful utilities, moderation, and fun community features.')
.addFields(
{ name: 'Highlights', value: 'Timezone converter, quiz games, and a growing currency system.' },
{ name: 'Created By', value: interaction.client.user?.username ?? 'Bot Creator' }
)
.setImage('https://i.postimg.cc/QdZZwKVD/Screenshot-2024-12-25-005933.png')
.setTimestamp();
await interaction.reply({
embeds: [exampleEmbed]
})
});
}
}
};
+15 -11
View File
@@ -1,23 +1,27 @@
const { SlashCommandBuilder} = require("discord.js");
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('help')
.setDescription('Gives all available commands.'),
async execute(interaction) {
// Map over the full command objects to get names and descriptions
const commandDetails = interaction.client.commands.map(cmd => ({
name: cmd.data.name,
description: cmd.data.description,
}));
const commandDetails = interaction.client.commands
.map(cmd => ({
name: cmd.data.name,
description: cmd.data.description,
}))
.sort((a, b) => a.name.localeCompare(b.name));
// Format the commands into a user-friendly help message
const helpMessage = commandDetails
.map(detail => `/${detail.name} - ${detail.description}`)
.map(detail => `• **/${detail.name}** — ${detail.description}`)
.join('\n');
// Send the help message
await interaction.reply(`Here are all the available commands:\n\n${helpMessage}`);
const embed = new EmbedBuilder()
.setColor(0x4b7bec)
.setTitle('Available Commands')
.setDescription(helpMessage)
.setFooter({ text: `${commandDetails.length} commands loaded.` });
await interaction.reply({ embeds: [embed], ephemeral: true });
},
};
};
+10 -3
View File
@@ -3,8 +3,15 @@ const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Check if the bots responsivnes'),
.setDescription('Check the bot\'s responsiveness.'),
async execute(interaction) {
await interaction.reply({ content: 'Pong! (Online)', ephemeral: true });
const sentAt = Date.now();
await interaction.reply({ content: 'Pinging...', ephemeral: true });
const latency = Date.now() - sentAt;
const apiLatency = Math.round(interaction.client.ws.ping);
await interaction.editReply({
content: `Pong! **${latency}ms** (API: **${apiLatency}ms**)`,
});
},
};
};