60 lines
2.0 KiB
JavaScript
60 lines
2.0 KiB
JavaScript
const { EmbedBuilder } = require('discord.js');
|
|
const { addInventory } = require('../structures/inventory');
|
|
const { addBank } = require('../structures/bank');
|
|
|
|
module.exports = {
|
|
name: "reset",
|
|
debug: false,
|
|
description: "Reset a users data",
|
|
usage: "[user]",
|
|
permissions: {
|
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
|
member: ["MANAGE_GUILD"],
|
|
},
|
|
options: [{
|
|
name: "user",
|
|
description: "User to reset",
|
|
value: "user",
|
|
type: 6,
|
|
required: true,
|
|
}],
|
|
SlashCommand: {
|
|
/**
|
|
*
|
|
* @param {require("../structures/QuarksBot")} client
|
|
* @param {import("discord.js").Message} message
|
|
* @param {string[]} args
|
|
* @param {*} param3
|
|
*/
|
|
run: async (client, interaction, args, { GuildDB }) => {
|
|
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
|
let canUseCommand = false;
|
|
|
|
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
|
if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) canUseCommand = true;
|
|
if (!canUseCommand) return interaction.send('You don\'t have the permissions to use this command.');
|
|
|
|
const targetUserID = args[0].value.replace('<@!', '').replace('>', '');
|
|
|
|
const prompt = new EmbedBuilder()
|
|
.setTitle(`Are you sure you want to reset this user?`)
|
|
.setDescription('**Notice:** This will reset this users, cash, balance, and invnetory back to defaults.')
|
|
.setColor(client.config.Colors.Yellow)
|
|
|
|
const opt = new ActionRowBuilder()
|
|
.addComponents(
|
|
new ButtonBuilder()
|
|
.setCustomId(`reset-yes-${targetUserID}-${interaction.member.user.id}`)
|
|
.setLabel("Yes")
|
|
.setStyle(ButtonStyle.Danger),
|
|
new ButtonBuilder()
|
|
.setCustomId(`reset-no-${targetUserID}-${interaction.member.user.id}`)
|
|
.setLabel("No")
|
|
.setStyle(ButtonStyle.Success)
|
|
)
|
|
|
|
return interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) });
|
|
|
|
},
|
|
},
|
|
} |