Merge branch 'main' of https://git.ayau.me/HotPlate/discord-rpg-concept
This commit is contained in:
29
src/commands/economy/balance.ts
Normal file
29
src/commands/economy/balance.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { createCommand } from "@lib/utils";
|
||||
import { getUserBalance } from "@/modules/economy/economy.service";
|
||||
import { createUser, getUserById } from "@/modules/users/users.service";
|
||||
import { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } from "discord.js";
|
||||
|
||||
export const balance = createCommand({
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("balance")
|
||||
.setDescription("Check your balance")
|
||||
|
||||
|
||||
, execute: async (interaction) => {
|
||||
const user = interaction.user;
|
||||
// Ensure user exists in DB
|
||||
let dbUser = await getUserById(user.id);
|
||||
if (!dbUser) {
|
||||
await createUser(user.id);
|
||||
}
|
||||
|
||||
const balance = await getUserBalance(user.id);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${user.username}'s Balance`)
|
||||
.setDescription(`💰 **${balance} coins**`)
|
||||
.setColor("Green");
|
||||
|
||||
await interaction.reply({ embeds: [embed] });
|
||||
}
|
||||
});
|
||||
34
src/commands/system/reload.ts
Normal file
34
src/commands/system/reload.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { createCommand } from "@lib/utils";
|
||||
import { KyokoClient } from "@lib/KyokoClient";
|
||||
import { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } from "discord.js";
|
||||
|
||||
export const reload = createCommand({
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("reload")
|
||||
.setDescription("Reloads all commands")
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
execute: async (interaction) => {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
try {
|
||||
await KyokoClient.loadCommands(true);
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("✅ System Reloaded")
|
||||
.setDescription(`Successfully reloaded ${KyokoClient.commands.size} commands.`)
|
||||
.setColor("Green");
|
||||
|
||||
// Deploy commands
|
||||
await KyokoClient.deployCommands();
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("❌ Reload Failed")
|
||||
.setDescription("An error occurred while reloading commands. Check console for details.")
|
||||
.setColor("Red");
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user