-
Notifications
You must be signed in to change notification settings - Fork 417
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
Expose components #1189
Expose components #1189
Conversation
Replace componenets with components. |
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.
Docs are finally officially released, I suggested some changes and make sure to update the JSDocs.
Co-authored-by: HeadTriXz <[email protected]>
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.
Worked completely when I tested in my code
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.
Good Job !
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.
editWebhookMessage(webhookID, token, messageID, options) { if(!options.content && !options.embeds && !options.file) { return Promise.reject(new Error("No content, embeds or file")); }}
In client should be changed to
editWebhookMessage(webhookID, token, messageID, options) { if(!options.content && !options.embeds && !options.components && !options.file) { return Promise.reject(new Error("No content, embeds, components, or file")); }}
No |
Why not? |
Because you still do need one of the 3 existing to send a component |
Not when editing a message |
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.
Checked your structures against the docs and ran locally, LGTM
* Allow Components only for editwebhookmessage * Changed flags back to 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.
Matches docs (unless I'm absolutely blind)
My eyesight has worsened by double from 3 years ago so lol |
@@ -1242,8 +1276,8 @@ class Client extends EventEmitter { | |||
}; | |||
} else if(content.content !== undefined && typeof content.content !== "string") { | |||
content.content = "" + content.content; | |||
} else if(content.content === undefined && !content.embed && !content.embeds && content.flags === undefined) { | |||
return Promise.reject(new Error("No content, embeds or flags")); | |||
} else if(content.content === undefined && !content.embed && !content.embeds && !content.components && content.flags === undefined) { |
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.
} else if(content.content === undefined && !content.embed && !content.embeds && !content.components && content.flags === undefined) { | |
} else if(content.content === undefined && !content.embed && (!content.embeds || content.embeds.length === 0) && (!content.components || content.components.length === 0) && content.flags === undefined) { |
This should be added to avoid issues when people provide only an empty array.
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.
I think we can remove the check, there's an API error anyway and it's getting rather long
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.
The whole thing including for editMessage?
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.
Yeah, both create and edit. Nowadays this error is more likely to throw because of a new Discord feature than actually missing content.
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.
in my opinion, the error this provides looks and sounds a lot better than what Discord says, which is just extremely generic
Cannot send an empty message
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.
Bring that up with discord then :-)
if(!options.content && !options.embeds && !options.components && !options.file) { | ||
return Promise.reject(new Error("No content, embed, components, or 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.
if(!options.content && !options.embeds && !options.components && !options.file) { | |
return Promise.reject(new Error("No content, embed, components, or file")); | |
if(!options.content && (!options.embeds || options.embeds.length === 0) && (!options.components || options.components.length === 0) && !options.file) { | |
return Promise.reject(new Error("No content, embeds, components, or file")); |
This comment has been minimized.
This comment has been minimized.
Will remove the message checks in another PR if someone else doesn't get to it |
commit daedb2b Author: Donovan Daniels <[email protected]> Date: Thu Sep 2 16:40:24 2021 -0500 Sticker Sending (abalabahaha#1252) Co-Authored-By: Catboy <[email protected]> Co-authored-by: bsian03 <[email protected]> commit e357991 Author: 5antos <[email protected]> Date: Sun Aug 29 23:18:45 2021 +0100 Enhancements for VoiceChannel join methods (abalabahaha#1195) Co-authored-by: Almeida <[email protected]> Co-authored-by: bsian03 <[email protected]> commit 53da0d5 Author: HeadTriXz <[email protected]> Date: Sat Aug 21 22:47:13 2021 +0200 Better types for events (abalabahaha#1242) Co-authored-by: HeadTriXz <[email protected]> commit 5246da9 Author: abalabahaha <[email protected]> Date: Thu Aug 19 13:08:56 2021 +0000 Bump dev version commit 6331536 Author: NeTT <[email protected]> Date: Thu Aug 19 18:29:06 2021 +0530 Pass user data with member in Message constructor (abalabahaha#1260) Prevents "User associated with Member not found" commit a58cd69 Author: bsian03 <[email protected]> Date: Thu Aug 19 13:55:33 2021 +0100 Support per-guild avatars (abalabahaha#1219) commit 21a3ce5 Author: Erin <[email protected]> Date: Thu Aug 19 08:40:54 2021 -0400 Add decodeReasons to typings (abalabahaha#1250) commit 120f917 Author: bsian03 <[email protected]> Date: Thu Aug 19 13:05:33 2021 +0100 Expose components (abalabahaha#1189) Co-authored-by: HeadTriXz <[email protected]> Co-authored-by: HeadTriXz <[email protected]> Co-authored-by: Tsumari <[email protected]> Co-authored-by: Catboi <[email protected]> commit 1e95e62 Author: bsian03 <[email protected]> Date: Thu Aug 19 12:48:23 2021 +0100 Warn when invalid intent is supplied (abalabahaha#1261) commit a7bff54 Author: iiFDCT <[email protected]> Date: Thu Aug 19 12:46:51 2021 +0100 Use new permission, intent names (abalabahaha#1257) commit c31685e Author: bsian03 <[email protected]> Date: Thu Aug 19 12:44:57 2021 +0100 Improve v8 ratelimit handling (abalabahaha#1256) commit 1e4d78a Author: bsian03 <[email protected]> Date: Thu Aug 19 12:28:14 2021 +0100 Expose audit log events 83-85 (abalabahaha#1213) * Audit log types 83-85 * Update the comment commit 840227e Author: bsian03 <[email protected]> Date: Thu Aug 19 12:19:02 2021 +0100 Type guild features as actual values (abalabahaha#1212) commit 4bb65f0 Author: Emad Abdullah <[email protected]> Date: Thu Aug 5 00:04:44 2021 +0300 fix permissions: Value "undefined" is not int for editRole & createRole (abalabahaha#1249) commit 756943d Author: Donovan Daniels <[email protected]> Date: Wed Aug 4 15:58:35 2021 -0500 Fix documentation for create/editRole (abalabahaha#1248) commit 3d80d20 Author: Ashesh <[email protected]> Date: Wed Aug 4 15:10:37 2021 +0530 Mark ClientOptions in Eris function as required (abalabahaha#1255) commit ee960c0 Author: bsian03 <[email protected]> Date: Tue Jul 13 21:25:57 2021 +0100 Fix possibly undefined member in voiceStateUpdate (abalabahaha#1217) Co-authored-by: Erin <[email protected]> commit e194a71 Author: Khaaz <[email protected]> Date: Tue Jul 13 13:04:21 2021 +0200 REST v8, Gateway v8 (abalabahaha#1038) Co-authored-by: macdja38 <[email protected]> Co-authored-by: bsian03 <[email protected]> Co-authored-by: abalabahaha <[email protected]> commit 0726aae Author: geg <[email protected]> Date: Tue Jul 13 06:35:08 2021 -0400 Use embeds array in embed example (abalabahaha#1244) commit 8e9a2b7 Author: Reinhardt <[email protected]> Date: Tue Jul 13 17:34:33 2021 +0700 Support sending multiple embeds (abalabahaha#1239) commit 7e55222 Author: bsian03 <[email protected]> Date: Mon Jul 12 18:25:00 2021 +0100 Allow passing a plain object to permissionsOf (abalabahaha#1224) Co-authored by: curtisf <[email protected]> commit 0abf61a Author: bsian03 <[email protected]> Date: Sun Jul 11 12:14:44 2021 +0100 Expose Guild#nsfwLevel, deprecate Guild#nsfw (abalabahaha#1207) commit 11d21c9 Author: Avocado <[email protected]> Date: Wed Jul 7 02:20:21 2021 -0500 Update Endpoints.js (abalabahaha#1241) commit d4a49a6 Author: bsian03 <[email protected]> Date: Tue Jul 6 23:38:36 2021 +0100 Document disconnecting members from vc better (abalabahaha#1202) * Update Member.js * Update Guild.js * Update Client.js * No idea how that happened commit b483ff3 Author: iiFDCT <[email protected]> Date: Tue Jul 6 16:21:56 2021 +0100 Update sticker properties (abalabahaha#1237) * Use `sticker_items` * Docs * Update docs * Deprecate `stickers`, use `sticker_items` * Add user to cache * Empty string * Use camelCase * Wrong func * Docs * Add back useless property * Pretend like this variable ever gets defined * Newlines commit 15546c4 Author: bsian03 <[email protected]> Date: Mon Jul 5 22:53:50 2021 +0100 Make purgeChannel use getMessages options (abalabahaha#1236)
Co-authored-by: HeadTriXz <[email protected]> Co-authored-by: HeadTriXz <[email protected]> Co-authored-by: Tsumari <[email protected]> Co-authored-by: Catboi <[email protected]>
discord/discord-api-docs#3007 discord/discord-api-docs#3200 https://discord.com/developers/docs/interactions/message-components
Adds support for components. Type 2 Style 5 opens an external URL, the rest of them sends an interaction request.