mirror of
https://github.com/Art-Portal/April.git
synced 2024-12-26 11:24:16 +01:00
Update toggle.js
Corrected indent issues, prettied up the code and added forgotten const on variable declarations
This commit is contained in:
parent
02ca9afef9
commit
31d154706b
@ -2,10 +2,10 @@ const { SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandChannelO
|
||||
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('toggle')
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('toggle')
|
||||
.setDefaultMemberPermissions(0x8)
|
||||
.setDescription('Activer différents paramètres.')
|
||||
.setDescription('Activer différents paramètres.')
|
||||
.addSubcommand(
|
||||
new SlashCommandSubcommandBuilder()
|
||||
.setName('commandes')
|
||||
@ -16,37 +16,39 @@ module.exports = {
|
||||
.setDescription('Salon du panel')
|
||||
.addChannelTypes(ChannelType.GuildText)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addStringOption(
|
||||
new SlashCommandStringOption()
|
||||
.setName('messageid')
|
||||
.setDescription('ID du message du panel')
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
,
|
||||
async execute(interaction, client) {
|
||||
),
|
||||
async execute(interaction, client) {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
const channel = interaction.options.getChannel('channel');
|
||||
const message = await channel.messages.fetch(interaction.options.getString('messageid'))
|
||||
if(!message) return interaction.reply({ content: "Je n'ai pas trouvé le message correspondant, vérifiez votre id", ephemeral: true })
|
||||
if (!message) return interaction.reply({ content: "Je n'ai pas trouvé le message correspondant, vérifiez votre id", ephemeral: true })
|
||||
|
||||
a = new ButtonBuilder(message.components[0].components[0].data)
|
||||
b = new ButtonBuilder(message.components[0].components[1].data)
|
||||
const a = new ButtonBuilder(message.components[0].components[0].data)
|
||||
const b = new ButtonBuilder(message.components[0].components[1].data)
|
||||
.setDisabled(!message.components[0].components[1].data.disabled)
|
||||
|
||||
const embed = new EmbedBuilder(message.embeds[0].data)
|
||||
if(message.components[0].components[1].data.disabled) embed.setDescription(description[0])
|
||||
else embed.setDescription(description[1])
|
||||
if (message.components[0].components[1].data.disabled) {
|
||||
embed.setDescription(description[0])
|
||||
} else {
|
||||
embed.setDescription(description[1])
|
||||
}
|
||||
|
||||
msg = message.components[0].components[1].data.disabled ? "Commandes bénévoles activées !" : "Commandes bénévoles désactivées !"
|
||||
const msg = message.components[0].components[1].data.disabled ? "Commandes bénévoles activées !" : "Commandes bénévoles désactivées !"
|
||||
|
||||
await message.edit({ components: [ new ActionRowBuilder().addComponents([a,b]) ], embeds: [embed] })
|
||||
await interaction.editReply({ ephemeral: true, content: msg })
|
||||
}
|
||||
};
|
||||
|
||||
description = [
|
||||
const description = [
|
||||
"Tu veux passer commande ? Choisis ci-dessous en fonction de ton budget ! ^^",
|
||||
"Tu veux passer commande ? Choisis ci-dessous en fonction de ton budget ! ^^\n\n**Les tickets bénévoles sont actuellement désactivés pour cause de surcharge !** Dès que la plupart seront écoulés, les commandes bénévoles rouvriront !\n\n*Vous pouvez regarder le nombre de commandes en cours via le </info server:947504536417878046> !*",
|
||||
]
|
Loading…
Reference in New Issue
Block a user