C:/Program Files/Git/settings reset cmd

This commit is contained in:
SowinskiBraeden committed 2022-08-30 12:00:58 -07:00
1 parent 7c8c484122
commit aab4872a00
2 files changed
+70

No files matched your search

+45
View File
@@ -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: [] });
}
}