mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
add multi-file support (#1268)
* add multi-file support * (╯°□°)╯︵ ┻━┻ (╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻(╯°□°)╯︵ ┻━┻ * stupid git web rebase editor - Gus2k17 * Update TextBasedChannel.js * Update TextBasedChannel.js
This commit is contained in:
@@ -2,13 +2,13 @@ const request = require('superagent');
|
||||
const Constants = require('../../util/Constants');
|
||||
|
||||
class APIRequest {
|
||||
constructor(rest, method, url, auth, data, file) {
|
||||
constructor(rest, method, url, auth, data, files) {
|
||||
this.rest = rest;
|
||||
this.method = method;
|
||||
this.url = url;
|
||||
this.auth = auth;
|
||||
this.data = data;
|
||||
this.file = file;
|
||||
this.files = files;
|
||||
this.route = this.getRoute(this.url);
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ class APIRequest {
|
||||
gen() {
|
||||
const apiRequest = request[this.method](this.url);
|
||||
if (this.auth) apiRequest.set('authorization', this.getAuth());
|
||||
if (this.file && this.file.file) {
|
||||
apiRequest.attach('file', this.file.file, this.file.name);
|
||||
if (this.files) {
|
||||
for (const file of this.files) if (file && file.file) apiRequest.attach(file.name, file.file, file.name);
|
||||
this.data = this.data || {};
|
||||
apiRequest.field('payload_json', JSON.stringify(this.data));
|
||||
} else if (this.data) {
|
||||
|
||||
Reference in New Issue
Block a user