-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Make sending buffers easier #1459
Conversation
This might be better placed in #1451... |
src/structures/Webhook.js
Outdated
@@ -115,6 +115,7 @@ class Webhook { | |||
for (const i in options.files) { | |||
let file = options.files[i]; | |||
if (typeof file === 'string') file = { attachment: 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.
Wouldn't it be better to combine the logic instead since you are setting file to the same thing?
if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };
@@ -91,6 +91,7 @@ class TextBasedChannel { | |||
for (const i in options.files) { | |||
let file = options.files[i]; | |||
if (typeof file === 'string') file = { attachment: 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.
same here.
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.
lgtm
Closed because a lot has changed and it's gonna end up in #1731. |
* Add Attachment structure * Fix linter issues + @Private * Fixed array sends, also added embed sends * fixed proving path to attachment * fixed incorrect name assumption from path * linting fix * ;) * im really good at this * changes as requested by gus and computer from #1459 * am a dum * update webhook#send * readonly addition to getters * i... uh... oops * farming deez commits * fix webhook split * removed some ugly * removed .every checks
Please describe the changes this PR makes and why it should be merged:
Currently, to send a buffer you have to do
send({ files: [{ attachment: buffer }] })
which is honestly just ugly.This PR makes it so that you can do
send({ files: [buffer] })
.Also, I'm fairly sure that this behavior was in v11.0 but was somehow removed in v11.1.
Semantic versioning classification: