C:/Program Files/Git/settings reset cmd
This commit is contained in:
2 files changed
+70
No files matched your search
@@ -332,6 +332,12 @@ module.exports = {
|
||||
required: true,
|
||||
}]
|
||||
},
|
||||
{
|
||||
name: "reset",
|
||||
description: "Restore all settings to default configurations",
|
||||
value: "reset",
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
name: "view",
|
||||
description: "View current settings configuration",
|
||||
@@ -882,6 +888,25 @@ module.exports = {
|
||||
.setTitle(title)
|
||||
|
||||
return interaction.send({ embeds: [successEmbed] });
|
||||
} else if (args[0].name == 'reset') {
|
||||
const prompt = new EmbedBuilder()
|
||||
.setTitle(`Woah!? Hold on.`)
|
||||
.setDescruotion('Are you sure you wish to remove all your configurations for this guild?')
|
||||
.setColor(client.config.Colors.Default)
|
||||
|
||||
const opt = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`settingsReset-yes-${interaction.member.user.id}`)
|
||||
.setLabel("Yes")
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`settingsReset-no-${interaction.member.user.id}`)
|
||||
.setLabel("No")
|
||||
.setStyle(ButtonStyle.Success)
|
||||
)
|
||||
|
||||
return interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) });
|
||||
|
||||
} else if (args[0].name == 'view') {
|
||||
const tweetChannel = GuildDB.tweetChannel ? `\n╚➤ <#${GuildDB.tweetChannel}>` : '';
|
||||
|
||||
@@ -617,4 +617,49 @@ module.exports = async (client, interaction) => {
|
||||
|
||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||
}
|
||||
|
||||
// Handler for '/settings reset'
|
||||
if (interaction.customId.startsWith('settingsReset')) {
|
||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||
return ButtonInteraction.reply({
|
||||
content: "This button is not for you",
|
||||
flags: (1 << 6)
|
||||
})
|
||||
}
|
||||
let action = '';
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'reset';
|
||||
const defaultGuildConfig = {
|
||||
serverID: GuildDB.serverID,
|
||||
allowedChannels: [],
|
||||
actionChannel: null,
|
||||
tweetChannel: null,
|
||||
advertsChannel: null,
|
||||
dispatchChannel: null,
|
||||
startingBalance: 1000.00,
|
||||
incomeRoles: [],
|
||||
botAdmin: null,
|
||||
commercialRole: null,
|
||||
officerRole: null,
|
||||
dispatcherRole: null,
|
||||
onlyOfficersSearch: false,
|
||||
}
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) {
|
||||
if (err) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
.setColor(client.config.Colors.Green)
|
||||
.setTitle(`Successfully ${action} guild configurations.`)
|
||||
|
||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user