mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-06-11 17:39:29 +00:00
Added Basic Leveling System and QoL Updates
This commit is contained in:
parent
7af6d5914d
commit
b5ce514397
15 changed files with 970 additions and 39 deletions
36
src/commands/util/recalculatelevels.ts
Normal file
36
src/commands/util/recalculatelevels.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { PermissionsBitField, SlashCommandBuilder } from 'discord.js';
|
||||
|
||||
import { Command } from '../../types/CommandTypes.js';
|
||||
import { recalculateUserLevels } from '../../util/levelingSystem.js';
|
||||
|
||||
const command: Command = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('recalculatelevels')
|
||||
.setDescription('(Admin Only) Recalculate all user levels'),
|
||||
execute: async (interaction) => {
|
||||
if (
|
||||
!interaction.memberPermissions?.has(
|
||||
PermissionsBitField.Flags.Administrator,
|
||||
)
|
||||
) {
|
||||
await interaction.reply({
|
||||
content: 'You do not have permission to use this command.',
|
||||
flags: ['Ephemeral'],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await interaction.deferReply();
|
||||
await interaction.editReply('Recalculating levels...');
|
||||
|
||||
try {
|
||||
await recalculateUserLevels();
|
||||
await interaction.editReply('Levels recalculated successfully!');
|
||||
} catch (error) {
|
||||
console.error('Error recalculating levels:', error);
|
||||
await interaction.editReply('Failed to recalculate levels.');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default command;
|
Loading…
Add table
Add a link
Reference in a new issue