mirror of
https://github.com/danbulant/discord.js
synced 2026-06-20 23:21:04 +00:00
Webpack build for branch 11.1-dev: 85615aa3a1
This commit is contained in:
parent
178cc06247
commit
92517b5c5e
2 changed files with 63 additions and 17 deletions
|
|
@ -5753,7 +5753,7 @@ class Message {
|
|||
|
||||
setup(data) { // eslint-disable-line complexity
|
||||
/**
|
||||
* The ID of the message (unique in the channel it was sent)
|
||||
* The ID of the message
|
||||
* @type {Snowflake}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
|
@ -7640,8 +7640,8 @@ class Guild {
|
|||
*/
|
||||
this.id = data.id;
|
||||
} else {
|
||||
this.available = true;
|
||||
this.setup(data);
|
||||
if (!data.channels) this.available = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8075,6 +8075,7 @@ class Guild {
|
|||
* @property {string} [name] The name of the guild
|
||||
* @property {string} [region] The region of the guild
|
||||
* @property {number} [verificationLevel] The verification level of the guild
|
||||
* @property {number} [explicitContentFilter] The level of the explicit content filter
|
||||
* @property {ChannelResolvable} [afkChannel] The AFK channel of the guild
|
||||
* @property {number} [afkTimeout] The AFK timeout of the guild
|
||||
* @property {Base64Resolvable} [icon] The icon of the guild
|
||||
|
|
@ -8096,7 +8097,28 @@ class Guild {
|
|||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateGuild(this, data);
|
||||
const _data = {};
|
||||
if (data.name) _data.name = data.name;
|
||||
if (data.region) _data.region = data.region;
|
||||
if (typeof data.verificationLevel !== 'undefined') _data.verification_level = Number(data.verificationLevel);
|
||||
if (data.afkChannel) _data.afk_channel_id = this.client.resolver.resolveChannel(data.afkChannel).id;
|
||||
if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout);
|
||||
if (data.icon) _data.icon = this.client.resolver.resolveBase64(data.icon);
|
||||
if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id;
|
||||
if (data.splash) _data.splash = this.client.resolver.resolveBase64(data.splash);
|
||||
if (typeof data.explicitContentFilter !== 'undefined') {
|
||||
_data.explicit_content_filter = Number(data.explicitContentFilter);
|
||||
}
|
||||
return this.client.rest.methods.updateGuild(this, _data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the level of the explicit content filter.
|
||||
* @param {number} explicitContentFilter The new level of the explicit content filter
|
||||
* @returns {Promise<Guild>}
|
||||
*/
|
||||
setExplicitContentFilter(explicitContentFilter) {
|
||||
return this.edit({ explicitContentFilter });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -12682,14 +12704,33 @@ class ClientUser extends User {
|
|||
* @param {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild
|
||||
* @returns {Promise<Guild>} The guild that was created
|
||||
*/
|
||||
createGuild(name, region, icon = null) {
|
||||
if (!icon) return this.client.rest.methods.createGuild({ name, icon, region });
|
||||
if (typeof icon === 'string' && icon.startsWith('data:')) {
|
||||
return this.client.rest.methods.createGuild({ name, icon, region });
|
||||
} else {
|
||||
return this.client.resolver.resolveBuffer(icon).then(data =>
|
||||
this.client.rest.methods.createGuild({ name, icon: data, region })
|
||||
|
||||
createGuild(name, { region, icon = null } = {}) {
|
||||
if (!icon || (typeof icon === 'string' && icon.startsWith('data:'))) {
|
||||
return new Promise((resolve, reject) =>
|
||||
this.client.api.guilds.post({ data: { name, region, icon } })
|
||||
.then(data => {
|
||||
if (this.client.guilds.has(data.id)) return resolve(this.client.guilds.get(data.id));
|
||||
|
||||
const handleGuild = guild => {
|
||||
if (guild.id === data.id) {
|
||||
this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild);
|
||||
this.client.clearTimeout(timeout);
|
||||
resolve(guild);
|
||||
}
|
||||
};
|
||||
this.client.on(Constants.Events.GUILD_CREATE, handleGuild);
|
||||
|
||||
const timeout = this.client.setTimeout(() => {
|
||||
this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild);
|
||||
resolve(this.client.dataManager.newGuild(data));
|
||||
}, 10000);
|
||||
return undefined;
|
||||
}, reject)
|
||||
);
|
||||
} else {
|
||||
return this.client.resolver.resolveBuffer(icon)
|
||||
.then(data => this.createGuild(name, { region, icon: this.client.resolver.resolveBase64(data) || null }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -12891,6 +12932,7 @@ const Collection = __webpack_require__(3);
|
|||
const Snowflake = __webpack_require__(5);
|
||||
|
||||
const Targets = {
|
||||
ALL: 'ALL',
|
||||
GUILD: 'GUILD',
|
||||
CHANNEL: 'CHANNEL',
|
||||
USER: 'USER',
|
||||
|
|
@ -12902,6 +12944,7 @@ const Targets = {
|
|||
};
|
||||
|
||||
const Actions = {
|
||||
ALL: null,
|
||||
GUILD_UPDATE: 1,
|
||||
CHANNEL_CREATE: 10,
|
||||
CHANNEL_UPDATE: 11,
|
||||
|
|
@ -17061,6 +17104,7 @@ function base64DetectIncompleteChar(buffer) {
|
|||
|
||||
/**
|
||||
* Represents an error from the Discord API.
|
||||
* @extends Error
|
||||
*/
|
||||
class DiscordAPIError extends Error {
|
||||
constructor(error) {
|
||||
|
|
@ -17081,6 +17125,7 @@ class DiscordAPIError extends Error {
|
|||
* @param {Object} obj Discord errors object
|
||||
* @param {string} [key] Used internally to determine key names of nested fields
|
||||
* @returns {string[]}
|
||||
* @private
|
||||
*/
|
||||
static flattenErrors(obj, key = '') {
|
||||
let messages = [];
|
||||
|
|
@ -17862,6 +17907,7 @@ class Client extends EventEmitter {
|
|||
*/
|
||||
this.presences = new Collection();
|
||||
|
||||
Object.defineProperty(this, 'token', { writable: true });
|
||||
if (!this.token && 'CLIENT_TOKEN' in process.env) {
|
||||
/**
|
||||
* Authorization token for the logged in user/bot
|
||||
|
|
@ -18161,9 +18207,9 @@ class Client extends EventEmitter {
|
|||
*/
|
||||
setTimeout(fn, delay, ...args) {
|
||||
const timeout = setTimeout(() => {
|
||||
fn();
|
||||
fn(...args);
|
||||
this._timeouts.delete(timeout);
|
||||
}, delay, ...args);
|
||||
}, delay);
|
||||
this._timeouts.add(timeout);
|
||||
return timeout;
|
||||
}
|
||||
|
|
@ -18361,9 +18407,9 @@ class WebhookClient extends Webhook {
|
|||
*/
|
||||
setTimeout(fn, delay, ...args) {
|
||||
const timeout = setTimeout(() => {
|
||||
fn();
|
||||
fn(...args);
|
||||
this._timeouts.delete(timeout);
|
||||
}, delay, ...args);
|
||||
}, delay);
|
||||
this._timeouts.add(timeout);
|
||||
return timeout;
|
||||
}
|
||||
|
|
|
|||
6
discord.11.1-dev.min.js
vendored
6
discord.11.1-dev.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue