mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor: change xID to xId (#6036)
* refactor: change `xID` to `xId` * Update src/managers/MessageManager.js Co-authored-by: Noel <buechler.noel@outlook.com> Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -50,7 +50,7 @@ class GuildManager extends CachedManager {
|
||||
/**
|
||||
* Partial data for a Role.
|
||||
* @typedef {Object} PartialRoleData
|
||||
* @property {Snowflake|number} [id] The ID for this role, used to set channel overrides,
|
||||
* @property {Snowflake|number} [id] The role's id, used to set channel overrides,
|
||||
* this is a placeholder and will be replaced by the API after consumption
|
||||
* @property {string} [name] The name of the role
|
||||
* @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number
|
||||
@@ -63,7 +63,7 @@ class GuildManager extends CachedManager {
|
||||
/**
|
||||
* Partial overwrite data.
|
||||
* @typedef {Object} PartialOverwriteData
|
||||
* @property {Snowflake|number} id The Role or User ID for this overwrite
|
||||
* @property {Snowflake|number} id The {@link Role} or {@link User} id for this overwrite
|
||||
* @property {string} [type] The type of this overwrite
|
||||
* @property {PermissionResolvable} [allow] The permissions to allow
|
||||
* @property {PermissionResolvable} [deny] The permissions to deny
|
||||
@@ -72,9 +72,9 @@ class GuildManager extends CachedManager {
|
||||
/**
|
||||
* Partial data for a Channel.
|
||||
* @typedef {Object} PartialChannelData
|
||||
* @property {Snowflake|number} [id] The ID for this channel, used to set its parent,
|
||||
* @property {Snowflake|number} [id] The channel's id, used to set its parent,
|
||||
* this is a placeholder and will be replaced by the API after consumption
|
||||
* @property {Snowflake|number} [parentID] The parent ID for this channel
|
||||
* @property {Snowflake|number} [parentId] The parent id for this channel
|
||||
* @property {string} [type] The type of the channel
|
||||
* @property {string} name The name of the channel
|
||||
* @property {string} [topic] The topic of the text channel
|
||||
@@ -108,14 +108,14 @@ class GuildManager extends CachedManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a GuildResolvable to a Guild ID string.
|
||||
* @method resolveID
|
||||
* Resolves a {@link GuildResolvable} to a {@link Guild} id string.
|
||||
* @method resolveId
|
||||
* @memberof GuildManager
|
||||
* @instance
|
||||
* @param {GuildResolvable} guild The guild resolvable to identify
|
||||
* @returns {?Snowflake}
|
||||
*/
|
||||
resolveID(guild) {
|
||||
resolveId(guild) {
|
||||
if (
|
||||
guild instanceof GuildChannel ||
|
||||
guild instanceof GuildMember ||
|
||||
@@ -123,15 +123,15 @@ class GuildManager extends CachedManager {
|
||||
guild instanceof Role ||
|
||||
(guild instanceof Invite && guild.guild)
|
||||
) {
|
||||
return super.resolveID(guild.guild.id);
|
||||
return super.resolveId(guild.guild.id);
|
||||
}
|
||||
return super.resolveID(guild);
|
||||
return super.resolveId(guild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to create a guild.
|
||||
* @typedef {Object} GuildCreateOptions
|
||||
* @property {Snowflake|number} [afkChannelID] The ID of the AFK channel
|
||||
* @property {Snowflake|number} [afkChannelId] The AFK channel's id
|
||||
* @property {number} [afkTimeout] The AFK timeout in seconds
|
||||
* @property {PartialChannelData[]} [channels=[]] The channels for this guild
|
||||
* @property {DefaultMessageNotifications} [defaultMessageNotifications] The default message notifications
|
||||
@@ -140,7 +140,7 @@ class GuildManager extends CachedManager {
|
||||
* @property {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild
|
||||
* @property {PartialRoleData[]} [roles=[]] The roles for this guild,
|
||||
* the first element of this array is used to change properties of the guild's everyone role.
|
||||
* @property {Snowflake|number} [systemChannelID] The ID of the system channel
|
||||
* @property {Snowflake|number} [systemChannelId] The system channel's id
|
||||
* @property {SystemChannelFlagsResolvable} [systemChannelFlags] The flags of the system channel
|
||||
* @property {VerificationLevel} [verificationLevel] The verification level for the guild
|
||||
*/
|
||||
@@ -155,14 +155,14 @@ class GuildManager extends CachedManager {
|
||||
async create(
|
||||
name,
|
||||
{
|
||||
afkChannelID,
|
||||
afkChannelId,
|
||||
afkTimeout,
|
||||
channels = [],
|
||||
defaultMessageNotifications,
|
||||
explicitContentFilter,
|
||||
icon = null,
|
||||
roles = [],
|
||||
systemChannelID,
|
||||
systemChannelId,
|
||||
systemChannelFlags,
|
||||
verificationLevel,
|
||||
} = {},
|
||||
@@ -179,8 +179,8 @@ class GuildManager extends CachedManager {
|
||||
}
|
||||
for (const channel of channels) {
|
||||
if (channel.type) channel.type = ChannelTypes[channel.type.toUpperCase()];
|
||||
channel.parent_id = channel.parentID;
|
||||
delete channel.parentID;
|
||||
channel.parent_id = channel.parentId;
|
||||
delete channel.parentId;
|
||||
if (!channel.permissionOverwrites) continue;
|
||||
for (const overwrite of channel.permissionOverwrites) {
|
||||
if (overwrite.allow) overwrite.allow = Permissions.resolve(overwrite.allow).toString();
|
||||
@@ -206,9 +206,9 @@ class GuildManager extends CachedManager {
|
||||
explicit_content_filter: explicitContentFilter,
|
||||
roles,
|
||||
channels,
|
||||
afk_channel_id: afkChannelID,
|
||||
afk_channel_id: afkChannelId,
|
||||
afk_timeout: afkTimeout,
|
||||
system_channel_id: systemChannelID,
|
||||
system_channel_id: systemChannelId,
|
||||
system_channel_flags: systemChannelFlags,
|
||||
},
|
||||
})
|
||||
@@ -245,18 +245,18 @@ class GuildManager extends CachedManager {
|
||||
/**
|
||||
* Options used to fetch multiple guilds.
|
||||
* @typedef {Object} FetchGuildsOptions
|
||||
* @property {Snowflake} [before] Get guilds before this guild ID
|
||||
* @property {Snowflake} [after] Get guilds after this guild ID
|
||||
* @property {Snowflake} [before] Get guilds before this guild id
|
||||
* @property {Snowflake} [after] Get guilds after this guild id
|
||||
* @property {number} [limit=100] Maximum number of guilds to request (1-100)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Obtains one or multiple guilds from Discord, or the guild cache if it's already available.
|
||||
* @param {GuildResolvable|FetchGuildOptions|FetchGuildsOptions} [options] ID of the guild or options
|
||||
* @param {GuildResolvable|FetchGuildOptions|FetchGuildsOptions} [options] The guild's id or options
|
||||
* @returns {Promise<Guild|Collection<Snowflake, OAuth2Guild>>}
|
||||
*/
|
||||
async fetch(options = {}) {
|
||||
const id = this.resolveID(options) ?? this.resolveID(options.guild);
|
||||
const id = this.resolveId(options) ?? this.resolveId(options.guild);
|
||||
|
||||
if (id) {
|
||||
if (!options.force) {
|
||||
|
||||
Reference in New Issue
Block a user