-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for "Announcement" channels in Discord #585
Conversation
Allow the Discord provider to post in "GUILD_ANNOUNCEMENT" text channels, also known as announcement channels
@whallin is attempting to deploy a commit to the Listinai Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes modify the Changes
Possibly related issues
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
libraries/nestjs-libraries/src/integrations/social/discord.provider.ts (1)
120-120
: LGTM! The change correctly enables support for announcement channels.The addition of type 5 (GUILD_ANNOUNCEMENT) to the channel filter successfully implements the requested feature.
Consider using constants for channel types.
To improve maintainability and make the code more resilient to API changes, consider defining an enum or constants for the channel types.
+// At the top of the file +enum DiscordChannelType { + GUILD_TEXT = 0, + GUILD_ANNOUNCEMENT = 5, + FORUM = 15, +} // In the channels method -.filter((p: any) => p.type === 0 || p.type === 5 || p.type === 15) +.filter((p: any) => p.type === DiscordChannelType.GUILD_TEXT || + p.type === DiscordChannelType.GUILD_ANNOUNCEMENT || + p.type === DiscordChannelType.FORUM)Add documentation for supported channel types.
To improve code maintainability, consider adding JSDoc comments explaining the supported channel types and their purposes.
+/** + * Retrieves the list of available channels for the guild. + * Supports the following channel types: + * - GUILD_TEXT (0): Regular text channels + * - GUILD_ANNOUNCEMENT (5): Announcement channels with publish functionality + * - FORUM (15): Forum channels for threaded discussions + */ async channels(accessToken: string, params: any, id: string) {
LGTM |
What kind of change does this PR introduce?
Allow the Discord provider to post in "GUILD_ANNOUNCEMENT" text channels, also known as announcement channels.
Why was this change needed?
This PR was made due to my issue #582.
Other information:
If Discord were to change the API, either by deprecating or altering the ID for the "GUILD_ANNOUNCEMENT" channel type, it could break overnight. However, that's somewhat hard to believe since the channel has been part of Discord for quite some time.
Checklist:
Summary by CodeRabbit