feat: add button to clear reminder #3

Merged
naomi merged 5 commits from Add-button-to-clear-reminder-#2 into main 2025-11-02 09:23:30 -08:00
Member

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

  • I have pinned the dependencies to a specific patch version.

Style

  • I have run the linter and resolved any errors.
  • My pull request uses an appropriate title, matching the conventional commit standards.
  • My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request.

Tests

  • My contribution adds new code, and I have added tests to cover it.
  • My contribution modifies existing code, and I have updated the tests to reflect these changes.
  • All new and existing tests pass locally with my changes.
  • Code coverage remains at or above the configured threshold.

Documentation

n/a

Versioning

Minor - My pull request introduces a new non-breaking feature.

### 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 - [x] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/) - [x] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/). - [x] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/). ### Dependencies - [x] I have pinned the dependencies to a specific patch version. ### Style - [x] I have run the linter and resolved any errors. - [x] My pull request uses an appropriate title, matching the conventional commit standards. - [x] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request. ### Tests - [x] My contribution adds new code, and I have added tests to cover it. - [x] My contribution modifies existing code, and I have updated the tests to reflect these changes. - [x] All new and existing tests pass locally with my changes. - [x] Code coverage remains at or above the configured threshold. ### Documentation n/a ### Versioning Minor - My pull request introduces a new non-breaking feature.
Author
Member

image.png

![image.png](/attachments/d398ad2c-231f-4175-bcb5-3d6aa282e8fb)
naomi requested changes 2025-10-08 10:42:43 -07:00
@@ -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 = (
Owner

This function should be in its own src/modules/createAckButton.ts file.

This function should be in its own `src/modules/createAckButton.ts` file.
@@ -0,0 +15,4 @@
* @param userId - The ID of the user who can acknowledge the reminder.
* @returns ActionRow with the acknowledgment button.
*/
const createAckButton = (
Owner

This function is entirely unnecessary - after moving the other function to a module file, we can just use that directly.

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(
Owner

This should get its own module file as well, in src/modules/handleAckButton.ts.

This should get its own module file as well, in `src/modules/handleAckButton.ts`.
gurkirat marked the pull request as work in progress 2025-10-12 12:31:33 -07:00
gurkirat requested review from naomi 2025-10-16 20:22:37 -07:00
naomi requested changes 2025-10-29 13:57:11 -07:00
src/index.ts Outdated
@@ -31,3 +32,3 @@
client.on(Events.InteractionCreate, (interaction) => {
if (!interaction.isChatInputCommand()) {
if (!interaction.isChatInputCommand() && !interaction.isButton()) {
Owner

Don't need this check at all, since we're using the type guards later in the logic.

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 acknowledgment
Owner

Unnecessary comment.

Unnecessary comment.
@@ -0,0 +15,4 @@
interaction: ButtonInteraction,
): Promise<boolean> => {
if (!interaction.customId.startsWith("ack-")) {
// Not our button
Owner

Unnecessary comment.

Unnecessary comment.
@@ -0,0 +21,4 @@
const [ , authorizedUserId ] = interaction.customId.split("-");
if (interaction.user.id !== authorizedUserId) {
// Show error that auto-deletes after 2 seconds
Owner

Unnecessary comment.

Unnecessary comment.
@@ -0,0 +26,4 @@
content: "❌ This button is only for the recipient.",
flags: MessageFlags.Ephemeral,
});
setTimeout(() => {
Owner

Skip this entirely. We don't need to auto-delete an ephemeral message.

Skip this entirely. We don't need to auto-delete an ephemeral message.
gurkirat requested review from naomi 2025-10-31 09:54:10 -07:00
naomi added 1 commit 2025-11-02 09:18:58 -08:00
fix: fixed the changes requested by naomi
Node.js CI / Lint and Test (pull_request) Successful in 38s
0e52c1c692
naomi added 1 commit 2025-11-02 09:22:35 -08:00
chore: clean up code after review
Node.js CI / Lint and Test (pull_request) Successful in 37s
36e3a5370d
naomi changed title from WIP: Add-button-to-clear-reminder-#2 to feat: add button to clear reminder 2025-11-02 09:22:57 -08:00
naomi merged commit cba2a8027b into main 2025-11-02 09:23:30 -08:00
naomi deleted branch Add-button-to-clear-reminder-#2 2025-11-02 09:23:30 -08:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/altaria#3