generated from nhcarrigan/template
fix: fixed the changes requested by naomi
Node.js CI / Lint and Test (pull_request) Successful in 38s
Node.js CI / Lint and Test (pull_request) Successful in 38s
This commit is contained in:
@@ -47,8 +47,6 @@ client.on(Events.InteractionCreate, (interaction) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle button clicks
|
||||
if (interaction.isButton()) {
|
||||
void handleAckButton(interaction);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ export const checkAltText = async(message: Message): Promise<void> => {
|
||||
|
||||
if (noDescription.size > 0) {
|
||||
const reminder = getRandomValue(reminders);
|
||||
// Button for acknowledgment
|
||||
await message.reply({
|
||||
components: createAckButton(message.author.id),
|
||||
content: `${reminder}\n-# If you do not know how to do this, check [Discord's help article](<https://support.discord.com/hc/en-us/articles/211866427-How-do-I-upload-images-and-GIFs>)!\n-# Need help writing descriptive text? Our bot [Cordelia](<https://cordelia.nhcarrigan.com>) can do it for you!`,
|
||||
|
||||
@@ -15,25 +15,16 @@ const handleAckButton = async(
|
||||
interaction: ButtonInteraction,
|
||||
): Promise<boolean> => {
|
||||
if (!interaction.customId.startsWith("ack-")) {
|
||||
// Not our button
|
||||
return false;
|
||||
}
|
||||
|
||||
const [ , authorizedUserId ] = interaction.customId.split("-");
|
||||
if (interaction.user.id !== authorizedUserId) {
|
||||
// Show error that auto-deletes after 2 seconds
|
||||
await interaction.reply({
|
||||
content: "❌ This button is only for the recipient.",
|
||||
flags: MessageFlags.Ephemeral,
|
||||
});
|
||||
setTimeout(() => {
|
||||
void interaction.deleteReply().catch(() => {
|
||||
// Intentionally empty - ignore deletion errors
|
||||
});
|
||||
}, 2000);
|
||||
return true;
|
||||
}
|
||||
|
||||
await interaction.message.delete();
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user