generated from nhcarrigan/template
feat: add button to clear reminder #3
Reference in New Issue
Block a user
Delete Branch "Add-button-to-clear-reminder-#2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Explanation
added button to clear the reminder also added logic to not let anyone click that button if it does it reply him with warning message that auto deletes after 2sec
Issue
issue number 2 add button to clear reminder
Attestations
Dependencies
Style
Tests
Documentation
n/a
Versioning
Minor - My pull request introduces a new non-breaking feature.
@@ -67,0 +72,4 @@* @param userId - The ID of the user who can acknowledge the reminder.* @returns An array containing an ActionRow with the acknowledgment button.*/const createAckButton = (This function should be in its own
src/modules/createAckButton.tsfile.@@ -0,0 +15,4 @@* @param userId - The ID of the user who can acknowledge the reminder.* @returns ActionRow with the acknowledgment button.*/const createAckButton = (This function is entirely unnecessary - after moving the other function to a module file, we can just use that directly.
@@ -0,0 +26,4 @@* @param interaction - The button interaction to handle.* @returns Promise that resolves to true if the button was handled, false otherwise.*/const handleAckButton = async(This should get its own module file as well, in
src/modules/handleAckButton.ts.@@ -31,3 +32,3 @@client.on(Events.InteractionCreate, (interaction) => {if (!interaction.isChatInputCommand()) {if (!interaction.isChatInputCommand() && !interaction.isButton()) {Don't need this check at all, since we're using the type guards later in the logic.
@@ -27,8 +28,10 @@ export const checkAltText = async(message: Message): Promise<void> => {if (noDescription.size > 0) {const reminder = getRandomValue(reminders);// Button for acknowledgmentUnnecessary comment.
@@ -0,0 +15,4 @@interaction: ButtonInteraction,): Promise<boolean> => {if (!interaction.customId.startsWith("ack-")) {// Not our buttonUnnecessary comment.
@@ -0,0 +21,4 @@const [ , authorizedUserId ] = interaction.customId.split("-");if (interaction.user.id !== authorizedUserId) {// Show error that auto-deletes after 2 secondsUnnecessary comment.
@@ -0,0 +26,4 @@content: "❌ This button is only for the recipient.",flags: MessageFlags.Ephemeral,});setTimeout(() => {Skip this entirely. We don't need to auto-delete an ephemeral message.
WIP: Add-button-to-clear-reminder-#2to feat: add button to clear reminder