mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 11:40:41 +00:00
Webpack build for branch master: f3a7f59824
This commit is contained in:
parent
3d96b5ec38
commit
11c86067b1
2 changed files with 29 additions and 22 deletions
|
|
@ -4431,20 +4431,20 @@ class Guild {
|
||||||
/**
|
/**
|
||||||
* The data needed for updating a channel's position.
|
* The data needed for updating a channel's position.
|
||||||
* @typedef {Object} ChannelPosition
|
* @typedef {Object} ChannelPosition
|
||||||
* @property {Snowflake} id The channel being updated's unique id.
|
* @property {ChannelResolvable} channel Channel to update
|
||||||
* @property {number} position The new position of the channel.
|
* @property {number} position New position for the channel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates this guild's channel positions as a batch.
|
* Batch-updates the guild's channels' positions.
|
||||||
* @param {Array<ChannelPosition>} channelPositions Array of objects that defines which channel is going where.
|
* @param {ChannelPosition[]} channelPositions Channel positions to update
|
||||||
* @returns {Promise<Guild>}
|
* @returns {Promise<Guild>}
|
||||||
* @example
|
* @example
|
||||||
* guild.updateChannels([{ id: channelID, position: newChannelIndex }])
|
* guild.updateChannels([{ channel: channelID, position: newChannelIndex }])
|
||||||
* .then(guild => console.log(`Updated channels for ${guild.id}`))
|
* .then(guild => console.log(`Updated channel positions for ${guild.id}`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
updateChannelPositions(channelPositions) {
|
setChannelPositions(channelPositions) {
|
||||||
return this.client.rest.methods.updateChannelPositions(this.id, channelPositions);
|
return this.client.rest.methods.updateChannelPositions(this.id, channelPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9232,9 +9232,9 @@ class ClientDataResolver {
|
||||||
*/
|
*/
|
||||||
resolveChannel(channel) {
|
resolveChannel(channel) {
|
||||||
if (channel instanceof Channel) return channel;
|
if (channel instanceof Channel) return channel;
|
||||||
|
if (typeof channel === 'string') return this.client.channels.get(channel) || null;
|
||||||
if (channel instanceof Message) return channel.channel;
|
if (channel instanceof Message) return channel.channel;
|
||||||
if (channel instanceof Guild) return channel.channels.get(channel.id) || null;
|
if (channel instanceof Guild) return channel.channels.get(channel.id) || null;
|
||||||
if (typeof channel === 'string') return this.client.channels.get(channel) || null;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9927,15 +9927,15 @@ class ClientUser extends User {
|
||||||
/**
|
/**
|
||||||
* An object containing either a user or access token, and an optional nickname
|
* An object containing either a user or access token, and an optional nickname
|
||||||
* @typedef {Object} GroupDMRecipientOptions
|
* @typedef {Object} GroupDMRecipientOptions
|
||||||
* @property {UserResolvable|Snowflake} [user] User to add to the group dm
|
* @property {UserResolvable|Snowflake} [user] User to add to the group DM
|
||||||
* (only available if a user is creating the dm)
|
* (only available if a user is creating the DM)
|
||||||
* @property {string} [accessToken] Access token to use to add a user to the group dm
|
* @property {string} [accessToken] Access token to use to add a user to the group DM
|
||||||
* (only available if a bot is creating the dm)
|
* (only available if a bot is creating the DM)
|
||||||
* @property {string} [nick] Permanent nickname (only available if a bot is creating the dm)
|
* @property {string} [nick] Permanent nickname (only available if a bot is creating the DM)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a group dm
|
* Creates a group DM
|
||||||
* @param {GroupDMRecipientOptions[]} recipients The recipients
|
* @param {GroupDMRecipientOptions[]} recipients The recipients
|
||||||
* @returns {Promise<GroupDMChannel>}
|
* @returns {Promise<GroupDMChannel>}
|
||||||
*/
|
*/
|
||||||
|
|
@ -9948,6 +9948,7 @@ class ClientUser extends User {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Accepts an invite to join a guild
|
||||||
* @param {Invite|string} invite Invite or code to accept
|
* @param {Invite|string} invite Invite or code to accept
|
||||||
* @returns {Promise<Guild>} Joined guild
|
* @returns {Promise<Guild>} Joined guild
|
||||||
*/
|
*/
|
||||||
|
|
@ -22008,9 +22009,7 @@ class GuildChannelsPositionUpdate extends Action {
|
||||||
if (guild) {
|
if (guild) {
|
||||||
for (const partialChannel of data.channels) {
|
for (const partialChannel of data.channels) {
|
||||||
const channel = guild.roles.get(partialChannel.id);
|
const channel = guild.roles.get(partialChannel.id);
|
||||||
if (channel) {
|
if (channel) channel.position = partialChannel.position;
|
||||||
channel.position = partialChannel.position;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23711,7 +23710,15 @@ class RESTMethods {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChannelPositions(guildID, channels) {
|
updateChannelPositions(guildID, channels) {
|
||||||
return this.rest.makeRequest('patch', Constants.Endpoints.guildChannels(guildID), true, channels).then(() =>
|
const data = new Array(channels.length);
|
||||||
|
for (let i = 0; i < channels.length; i++) {
|
||||||
|
data[i] = {
|
||||||
|
id: this.client.resolver.resolveChannelID(channels[i].channel),
|
||||||
|
position: channels[i].position,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.rest.makeRequest('patch', Constants.Endpoints.guildChannels(guildID), true, data).then(() =>
|
||||||
this.client.actions.GuildChannelsPositionUpdate.handle({
|
this.client.actions.GuildChannelsPositionUpdate.handle({
|
||||||
guild_id: guildID,
|
guild_id: guildID,
|
||||||
channels,
|
channels,
|
||||||
|
|
|
||||||
8
discord.master.min.js
vendored
8
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue