Compare commits

...

2 commits

Author SHA1 Message Date
2f34b9fcc8 Tell what opting out does 2023-04-07 01:08:16 +00:00
dceb4fbbb8 replace arg command with a nice arrow 2023-04-07 00:25:46 +00:00
3 changed files with 35 additions and 23 deletions

View file

@ -12,26 +12,38 @@ export default {
if (!isOptOut) { if (!isOptOut) {
const body = { userID: interaction.user.id }; const body = { userID: interaction.user.id };
await db.optout.create(body); await db.optout.create(body);
return await interaction.reply({ content: 'You have successfully been opt out.' }); await interaction.reply({ content: 'You have successfully been opt out.', ephemeral: true });
}
else {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId(`yes${interaction.user.id}${interaction.id}`)
.setLabel('Yes')
.setStyle(ButtonStyle.Primary),
)
.addComponents(
new ButtonBuilder()
.setCustomId(`no${interaction.user.id}${interaction.id}`)
.setLabel('No')
.setStyle(ButtonStyle.Danger),
);
await interaction.reply({ content: 'You are already opt out, do you wish to opt in?', components: [row], ephemeral: true });
listenButton(client, interaction, interaction.user);
} }
const row = new ActionRowBuilder() return interaction.followUp({
.addComponents( content:
new ButtonBuilder() 'As a reminder here what opting out does:\n'
.setCustomId(`yes${interaction.user.id}${interaction.id}`) + '- Your user ID will no longer be used for debug logging.\n'
.setLabel('Yes') + '- servers will no longer be shown in added/kicked stats.\n'
.setStyle(ButtonStyle.Primary), + '- Your messages won\'t be quoted.\n'
) + '- Won\'t show the arguments from commands.',
.addComponents( ephemeral: true,
new ButtonBuilder() },
.setCustomId(`no${interaction.user.id}${interaction.id}`) );
.setLabel('No')
.setStyle(ButtonStyle.Danger),
);
await interaction.reply({ content: 'You are already opt out, do you wish to opt in?', components: [row] });
return listenButton(client, interaction, interaction.user);
}, },
}; };
@ -45,10 +57,10 @@ async function listenButton(client, interaction, user = interaction.user, origin
if (interactionMenu.customId === `yes${interaction.user.id}${originalId}`) { if (interactionMenu.customId === `yes${interaction.user.id}${originalId}`) {
db.optout.destroy({ where: { userID: interaction.user.id } }); db.optout.destroy({ where: { userID: interaction.user.id } });
return interaction.editReply('You have successfully been opt in'); return interaction.editReply({ content: 'You have successfully been opt in', ephemeral: true });
} }
else { else {
return interaction.editReply('Nothing has been changed.'); return interaction.editReply({ content: 'Nothing has been changed.', ephemeral: true });
} }
}); });
} }

View file

@ -83,7 +83,7 @@ export default {
}); });
if (!isOptOut) { if (!isOptOut) {
console.log(`\x1b[33m${commandName}\x1b[0m with args ${JSON.stringify(args)}`); console.log(`\x1b[33m\x1b[0m with args ${JSON.stringify(args)}`);
} }
await command.execute(interaction, args, client); await command.execute(interaction, args, client);

View file

@ -405,8 +405,8 @@ export default {
args[payloadName] = payload; args[payloadName] = payload;
} }
if (!isOptOut) { if (!isOptOut && argsLength > 0) {
console.log(`\x1b[33m${commandName}\x1b[0m with args ${JSON.stringify(args)}`); console.log(`\x1b[33m\x1b[0m with args ${JSON.stringify(args)}`);
} }
await command.execute(message, args, client); await command.execute(message, args, client);