mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
feat(Sticker): updates, sticker packs, and guild stickers (#5867)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com> Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Tiemen <ThaTiemsz@users.noreply.github.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: BannerBomb <BannerBomb55@gmail.com> Co-authored-by: Noel <icrawltogo@gmail.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
This commit is contained in:
@@ -49,8 +49,16 @@ class APIRequest {
|
||||
let body;
|
||||
if (this.options.files && this.options.files.length) {
|
||||
body = new FormData();
|
||||
for (const file of this.options.files) if (file && file.file) body.append(file.name, file.file, file.name);
|
||||
if (typeof this.options.data !== 'undefined') body.append('payload_json', JSON.stringify(this.options.data));
|
||||
for (const file of this.options.files) {
|
||||
if (file?.file) body.append(file.key ?? file.name, file.file, file.name);
|
||||
}
|
||||
if (typeof this.options.data !== 'undefined') {
|
||||
if (this.options.dontUsePayloadJSON) {
|
||||
for (const [key, value] of Object.entries(this.options.data)) body.append(key, value);
|
||||
} else {
|
||||
body.append('payload_json', JSON.stringify(this.options.data));
|
||||
}
|
||||
}
|
||||
headers = Object.assign(headers, body.getHeaders());
|
||||
// eslint-disable-next-line eqeqeq
|
||||
} else if (this.options.data != null) {
|
||||
|
||||
Reference in New Issue
Block a user