Skip to content

Conversation

@Pdzly
Copy link
Contributor

@Pdzly Pdzly commented Oct 3, 2025

No description provided.

Pdzly added 2 commits October 3, 2025 17:33
…ce functionality

- Extracted reusable functions for handling suggestion interactions (voting, managing approvals/rejections) to improve maintainability.
- Added `generateVoteMessage` and `createReasonModal` utilities for better user feedback and modular modal creation.
- Refactored imports across suggestion module files for consistency.
- Consolidated ephemeral flag usage with a new constant and cleaned up redundant code paths.
- Enhanced suggestion archiving logic with additional validations and error handling.
- Replaced repetitive ephemeral flag arrays with a centralized constant (`EPHEMERAL_FLAG`).
- Streamlined defer and reply calls across modules to improve consistency and maintainability.
} = {
"suggestion-no": -1,
"suggestion-yes": 1,
const SUGGESTION_BUTTON_MAP: Record<string, SuggestionVoteType> = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather this be more explicitly typed that it can only take the SUGGESTION_YES/NO_ID keys

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e.

SUGGESTION_BUTTON_MAP : { [SUGGESTION_NO_ID] : number, [SUGGESTION_YES_ID]: number } 

I think this is the syntax

if (!interaction.guild) {
await interaction.followUp({
content: "This can only be done in a guild!",
flags: "Ephemeral",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need EPHEMERAL_FLAG here? ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, and i thought about it, why not just directly use MessageFlags.Ephemeral

Pdzly added 2 commits October 3, 2025 19:29
…s modules

- Refactored all occurrences of `EPHEMERAL_FLAG` to use `MessageFlags.Ephemeral` for better consistency with Discord.js standards.
- Removed redundant `EPHEMERAL_FLAG` constant and adjusted related import statements.
- Improved maintainability by directly referencing Discord.js enum for ephemeral message flags.
…annotations

- Added validation for invalid button interactions with user-friendly ephemeral replies.
- Updated `SUGGESTION_BUTTON_MAP` type annotations for better type safety and error handling.
- Reformatted imports for consistency and readability.
@bristermitten bristermitten merged commit 47b74af into TheDeveloperDen:master Oct 5, 2025
13 checks passed
@Pdzly Pdzly deleted the chores/suggest branch October 6, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants