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:
Antonio Román
2021-07-04 20:54:27 +02:00
committed by GitHub
parent 281072be44
commit a7c6678c72
95 changed files with 963 additions and 963 deletions

View File

@@ -10,11 +10,11 @@ const SnowflakeUtil = require('../util/SnowflakeUtil');
* @extends {Base}
*/
class ApplicationCommand extends Base {
constructor(client, data, guild, guildID) {
constructor(client, data, guild, guildId) {
super(client);
/**
* The ID of this command
* The command's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -26,11 +26,11 @@ class ApplicationCommand extends Base {
this.guild = guild ?? null;
/**
* The guild ID this command is part of, this may be non-null when `guild` is `null` if the command
* The guild's id this command is part of, this may be non-null when `guild` is `null` if the command
* was fetched from the `ApplicationCommandManager`
* @type {?Snowflake}
*/
this.guildID = guild?.id ?? guildID ?? null;
this.guildId = guild?.id ?? guildId ?? null;
/**
* The manager for permissions of this command on its guild or arbitrary guilds when the command is global
@@ -127,7 +127,7 @@ class ApplicationCommand extends Base {
* .catch(console.error);
*/
edit(data) {
return this.manager.edit(this, data, this.guildID);
return this.manager.edit(this, data, this.guildId);
}
/**
@@ -140,7 +140,7 @@ class ApplicationCommand extends Base {
* .catch(console.error);
*/
delete() {
return this.manager.delete(this, this.guildID);
return this.manager.delete(this, this.guildId);
}
/**

View File

@@ -13,7 +13,7 @@ class BaseGuild extends Base {
super(client);
/**
* The ID of this guild
* The guild's id
* @type {Snowflake}
*/
this.id = data.id;

View File

@@ -39,7 +39,7 @@ class BaseGuildVoiceChannel extends GuildChannel {
get members() {
const coll = new Collection();
for (const state of this.guild.voiceStates.cache.values()) {
if (state.channelID === this.id && state.member) {
if (state.channelId === this.id && state.member) {
coll.set(state.id, state.member);
}
}

View File

@@ -13,7 +13,7 @@ class CategoryChannel extends GuildChannel {
* @readonly
*/
get children() {
return this.guild.channels.cache.filter(c => c.parentID === this.id);
return this.guild.channels.cache.filter(c => c.parentId === this.id);
}
/**

View File

@@ -50,7 +50,7 @@ class Channel extends Base {
_patch(data) {
/**
* The unique ID of the channel
* The channel's id
* @type {Snowflake}
*/
this.id = data.id;

View File

@@ -16,14 +16,14 @@ class ClientPresence extends Presence {
set(presence) {
const packet = this._parse(presence);
this.patch(packet);
if (typeof presence.shardID === 'undefined') {
if (typeof presence.shardId === 'undefined') {
this.client.ws.broadcast({ op: OPCodes.STATUS_UPDATE, d: packet });
} else if (Array.isArray(presence.shardID)) {
for (const shardID of presence.shardID) {
this.client.ws.shards.get(shardID).send({ op: OPCodes.STATUS_UPDATE, d: packet });
} else if (Array.isArray(presence.shardId)) {
for (const shardId of presence.shardId) {
this.client.ws.shards.get(shardId).send({ op: OPCodes.STATUS_UPDATE, d: packet });
}
} else {
this.client.ws.shards.get(presence.shardID).send({ op: OPCodes.STATUS_UPDATE, d: packet });
this.client.ws.shards.get(presence.shardId).send({ op: OPCodes.STATUS_UPDATE, d: packet });
}
return this;
}

View File

@@ -103,7 +103,7 @@ class ClientUser extends User {
* @property {PresenceStatusData} [status] Status of the user
* @property {boolean} [afk] Whether the user is AFK
* @property {ActivitiesOptions[]} [activities] Activity the user is playing
* @property {?(number|number[])} [shardID] Shard Id(s) to have the activity set on
* @property {?(number|number[])} [shardId] Shard Id(s) to have the activity set on
*/
/**
@@ -130,14 +130,14 @@ class ClientUser extends User {
/**
* Sets the status of the client user.
* @param {PresenceStatusData} status Status to change to
* @param {?(number|number[])} [shardID] Shard ID(s) to have the activity set on
* @param {?(number|number[])} [shardId] Shard id(s) to have the activity set on
* @returns {Presence}
* @example
* // Set the client user's status
* client.user.setStatus('idle');
*/
setStatus(status, shardID) {
return this.setPresence({ status, shardID });
setStatus(status, shardId) {
return this.setPresence({ status, shardId });
}
/**
@@ -146,7 +146,7 @@ class ClientUser extends User {
* @property {string} [name] Name of the activity
* @property {string} [url] Twitch / YouTube stream URL
* @property {ActivityType|number} [type] Type of the activity
* @property {number|number[]} [shardID] Shard Id(s) to have the activity set on
* @property {number|number[]} [shardId] Shard Id(s) to have the activity set on
*/
/**
@@ -159,20 +159,20 @@ class ClientUser extends User {
* client.user.setActivity('discord.js', { type: 'WATCHING' });
*/
setActivity(name, options = {}) {
if (!name) return this.setPresence({ activities: [], shardID: options.shardID });
if (!name) return this.setPresence({ activities: [], shardId: options.shardId });
const activity = Object.assign({}, options, typeof name === 'object' ? name : { name });
return this.setPresence({ activities: [activity], shardID: activity.shardID });
return this.setPresence({ activities: [activity], shardId: activity.shardId });
}
/**
* Sets/removes the AFK flag for the client user.
* @param {boolean} afk Whether or not the user is AFK
* @param {number|number[]} [shardID] Shard Id(s) to have the AFK flag set on
* @param {number|number[]} [shardId] Shard Id(s) to have the AFK flag set on
* @returns {Presence}
*/
setAFK(afk, shardID) {
return this.setPresence({ afk, shardID });
setAFK(afk, shardId) {
return this.setPresence({ afk, shardId });
}
}

View File

@@ -23,19 +23,19 @@ class CommandInteraction extends Interaction {
*/
/**
* The ID of the channel this interaction was sent in
* The id of the channel this interaction was sent in
* @type {Snowflake}
* @name CommandInteraction#channelID
* @name CommandInteraction#channelId
*/
/**
* The ID of the invoked application command
* The invoked application command's id
* @type {Snowflake}
*/
this.commandID = data.data.id;
this.commandId = data.data.id;
/**
* The name of the invoked application command
* The invoked application command's name
* @type {string}
*/
this.commandName = data.data.name;
@@ -68,7 +68,7 @@ class CommandInteraction extends Interaction {
* An associated interaction webhook, can be used to further interact with this interaction
* @type {InteractionWebhook}
*/
this.webhook = new InteractionWebhook(this.client, this.applicationID, this.token);
this.webhook = new InteractionWebhook(this.client, this.applicationId, this.token);
}
/**
@@ -76,7 +76,7 @@ class CommandInteraction extends Interaction {
* @type {?ApplicationCommand}
*/
get command() {
const id = this.commandID;
const id = this.commandId;
return this.guild?.commands.cache.get(id) ?? this.client.application.commands.cache.get(id) ?? null;
}

View File

@@ -38,10 +38,10 @@ class DMChannel extends Channel {
}
/**
* The ID of the last message in the channel, if one was sent
* The channel's last message id, if one was sent
* @type {?Snowflake}
*/
this.lastMessageID = data.last_message_id;
this.lastMessageId = data.last_message_id;
/**
* The timestamp when the last pinned message was pinned, if there was one
@@ -56,7 +56,7 @@ class DMChannel extends Channel {
* @readonly
*/
get partial() {
return typeof this.lastMessageID === 'undefined';
return typeof this.lastMessageId === 'undefined';
}
/**

View File

@@ -6,9 +6,9 @@ const SnowflakeUtil = require('../util/SnowflakeUtil');
/**
* Represents raw emoji data from the API
* @typedef {APIEmoji} RawEmoji
* @property {?Snowflake} id ID of this emoji
* @property {?string} name Name of this emoji
* @property {?boolean} animated Whether this emoji is animated
* @property {?Snowflake} id The emoji's id
* @property {?string} name The emoji's name
* @property {?boolean} animated Whether the emoji is animated
*/
/**
@@ -19,19 +19,19 @@ class Emoji extends Base {
constructor(client, emoji) {
super(client);
/**
* Whether this emoji is animated
* Whether or not the emoji is animated
* @type {?boolean}
*/
this.animated = emoji.animated ?? null;
/**
* The name of this emoji
* The emoji's name
* @type {?string}
*/
this.name = emoji.name ?? null;
/**
* The ID of this emoji
* The emoji's id
* @type {?Snowflake}
*/
this.id = emoji.id;
@@ -98,7 +98,7 @@ class Emoji extends Base {
toJSON() {
return super.toJSON({
guild: 'guildID',
guild: 'guildId',
createdTimestamp: true,
url: true,
identifier: true,

View File

@@ -113,7 +113,7 @@ class Guild extends AnonymousGuild {
* The id of the shard this Guild belongs to.
* @type {number}
*/
this.shardID = data.shardID;
this.shardId = data.shardId;
}
/**
@@ -122,7 +122,7 @@ class Guild extends AnonymousGuild {
* @readonly
*/
get shard() {
return this.client.ws.shards.get(this.shardID);
return this.client.ws.shards.get(this.shardId);
}
/**
@@ -183,10 +183,10 @@ class Guild extends AnonymousGuild {
*/
/**
* The ID of the application that created this guild (if applicable)
* The id of the application that created this guild (if applicable)
* @type {?Snowflake}
*/
this.applicationID = data.application_id;
this.applicationId = data.application_id;
/**
* The time in seconds before a user is counted as "away from keyboard"
@@ -195,16 +195,16 @@ class Guild extends AnonymousGuild {
this.afkTimeout = data.afk_timeout;
/**
* The ID of the voice channel where AFK members are moved
* The id of the voice channel where AFK members are moved
* @type {?Snowflake}
*/
this.afkChannelID = data.afk_channel_id;
this.afkChannelId = data.afk_channel_id;
/**
* The ID of the system channel
* The system channel's id
* @type {?Snowflake}
*/
this.systemChannelID = data.system_channel_id;
this.systemChannelId = data.system_channel_id;
/**
* The premium tier of this guild
@@ -230,10 +230,10 @@ class Guild extends AnonymousGuild {
if (typeof data.widget_channel_id !== 'undefined') {
/**
* The widget channel ID, if enabled
* The widget channel's id, if enabled
* @type {?string}
*/
this.widgetChannelID = data.widget_channel_id;
this.widgetChannelId = data.widget_channel_id;
}
/**
@@ -317,16 +317,16 @@ class Guild extends AnonymousGuild {
this.vanityURLUses = null;
/**
* The ID of the rules channel for the guild
* The rules channel's id for the guild
* @type {?Snowflake}
*/
this.rulesChannelID = data.rules_channel_id;
this.rulesChannelId = data.rules_channel_id;
/**
* The ID of the community updates channel for the guild
* The community updates channel's id for the guild
* @type {?Snowflake}
*/
this.publicUpdatesChannelID = data.public_updates_channel_id;
this.publicUpdatesChannelId = data.public_updates_channel_id;
/**
* The preferred locale of the guild, defaults to `en-US`
@@ -359,10 +359,10 @@ class Guild extends AnonymousGuild {
if (data.owner_id) {
/**
* The user ID of this guild's owner
* The user id of this guild's owner
* @type {Snowflake}
*/
this.ownerID = data.owner_id;
this.ownerId = data.owner_id;
}
if (data.presences) {
@@ -445,12 +445,12 @@ class Guild extends AnonymousGuild {
/**
* Fetches the owner of the guild.
* If the member object isn't needed, use {@link Guild#ownerID} instead.
* If the member object isn't needed, use {@link Guild#ownerId} instead.
* @param {FetchOwnerOptions} [options] The options for fetching the member
* @returns {Promise<GuildMember>}
*/
fetchOwner(options) {
return this.members.fetch({ ...options, user: this.ownerID });
return this.members.fetch({ ...options, user: this.ownerId });
}
/**
@@ -459,7 +459,7 @@ class Guild extends AnonymousGuild {
* @readonly
*/
get afkChannel() {
return this.client.channels.resolve(this.afkChannelID);
return this.client.channels.resolve(this.afkChannelId);
}
/**
@@ -468,7 +468,7 @@ class Guild extends AnonymousGuild {
* @readonly
*/
get systemChannel() {
return this.client.channels.resolve(this.systemChannelID);
return this.client.channels.resolve(this.systemChannelId);
}
/**
@@ -477,7 +477,7 @@ class Guild extends AnonymousGuild {
* @readonly
*/
get widgetChannel() {
return this.client.channels.resolve(this.widgetChannelID);
return this.client.channels.resolve(this.widgetChannelId);
}
/**
@@ -486,7 +486,7 @@ class Guild extends AnonymousGuild {
* @readonly
*/
get rulesChannel() {
return this.client.channels.resolve(this.rulesChannelID);
return this.client.channels.resolve(this.rulesChannelId);
}
/**
@@ -495,7 +495,7 @@ class Guild extends AnonymousGuild {
* @readonly
*/
get publicUpdatesChannel() {
return this.client.channels.resolve(this.publicUpdatesChannelID);
return this.client.channels.resolve(this.publicUpdatesChannelId);
}
/**
@@ -702,7 +702,7 @@ class Guild extends AnonymousGuild {
async fetchWidget() {
const data = await this.client.api.guilds(this.id).widget.get();
this.widgetEnabled = data.enabled;
this.widgetChannelID = data.channel_id;
this.widgetChannelId = data.channel_id;
return {
enabled: data.enabled,
channel: data.channel_id ? this.channels.cache.get(data.channel_id) : null,
@@ -738,7 +738,7 @@ class Guild extends AnonymousGuild {
query: {
before: options.before,
limit: options.limit,
user_id: this.client.users.resolveID(options.user),
user_id: this.client.users.resolveId(options.user),
action_type: options.type,
},
})
@@ -764,7 +764,7 @@ class Guild extends AnonymousGuild {
* @returns {Promise<GuildMember>}
*/
async addMember(user, options) {
user = this.client.users.resolveID(user);
user = this.client.users.resolveId(user);
if (!user) throw new TypeError('INVALID_TYPE', 'user', 'UserResolvable');
if (this.members.cache.has(user)) return this.members.cache.get(user);
options.access_token = options.accessToken;
@@ -774,7 +774,7 @@ class Guild extends AnonymousGuild {
}
const resolvedRoles = [];
for (const role of options.roles.values()) {
const resolvedRole = this.roles.resolveID(role);
const resolvedRole = this.roles.resolveId(role);
if (!role) throw new TypeError('INVALID_ELEMENT', 'Array or Collection', 'options.roles', role);
resolvedRoles.push(resolvedRole);
}
@@ -832,14 +832,14 @@ class Guild extends AnonymousGuild {
: VerificationLevels[data.verificationLevel];
}
if (typeof data.afkChannel !== 'undefined') {
_data.afk_channel_id = this.client.channels.resolveID(data.afkChannel);
_data.afk_channel_id = this.client.channels.resolveId(data.afkChannel);
}
if (typeof data.systemChannel !== 'undefined') {
_data.system_channel_id = this.client.channels.resolveID(data.systemChannel);
_data.system_channel_id = this.client.channels.resolveId(data.systemChannel);
}
if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout);
if (typeof data.icon !== 'undefined') _data.icon = data.icon;
if (data.owner) _data.owner_id = this.client.users.resolveID(data.owner);
if (data.owner) _data.owner_id = this.client.users.resolveId(data.owner);
if (data.splash) _data.splash = data.splash;
if (data.discoverySplash) _data.discovery_splash = data.discoverySplash;
if (data.banner) _data.banner = data.banner;
@@ -859,10 +859,10 @@ class Guild extends AnonymousGuild {
_data.system_channel_flags = SystemChannelFlags.resolve(data.systemChannelFlags);
}
if (typeof data.rulesChannel !== 'undefined') {
_data.rules_channel_id = this.client.channels.resolveID(data.rulesChannel);
_data.rules_channel_id = this.client.channels.resolveId(data.rulesChannel);
}
if (typeof data.publicUpdatesChannel !== 'undefined') {
_data.public_updates_channel_id = this.client.channels.resolveID(data.publicUpdatesChannel);
_data.public_updates_channel_id = this.client.channels.resolveId(data.publicUpdatesChannel);
}
if (typeof data.features !== 'undefined') {
_data.features = data.features;
@@ -916,7 +916,7 @@ class Guild extends AnonymousGuild {
return {
emoji_id: emoji && emoji.id,
emoji_name: emoji?.name ?? welcomeChannelData.emoji,
channel_id: this.channels.resolveID(welcomeChannelData.channel),
channel_id: this.channels.resolveId(welcomeChannelData.channel),
description: welcomeChannelData.description,
};
});
@@ -1179,16 +1179,16 @@ class Guild extends AnonymousGuild {
* @param {ChannelPosition[]} channelPositions Channel positions to update
* @returns {Promise<Guild>}
* @example
* guild.setChannelPositions([{ channel: channelID, position: newChannelIndex }])
* guild.setChannelPositions([{ channel: channelId, position: newChannelIndex }])
* .then(guild => console.log(`Updated channel positions for ${guild}`))
* .catch(console.error);
*/
setChannelPositions(channelPositions) {
const updatedChannels = channelPositions.map(r => ({
id: this.client.channels.resolveID(r.channel),
id: this.client.channels.resolveId(r.channel),
position: r.position,
lock_permissions: r.lockPermissions,
parent_id: typeof r.parent !== 'undefined' ? this.channels.resolveID(r.parent) : undefined,
parent_id: typeof r.parent !== 'undefined' ? this.channels.resolveId(r.parent) : undefined,
}));
return this.client.api
@@ -1206,7 +1206,7 @@ class Guild extends AnonymousGuild {
/**
* The data needed for updating a guild role's position
* @typedef {Object} GuildRolePosition
* @property {RoleResolveable} role The ID of the role
* @property {RoleResolveable} role The role's id
* @property {number} position The position to update
*/
@@ -1215,14 +1215,14 @@ class Guild extends AnonymousGuild {
* @param {GuildRolePosition[]} rolePositions Role positions to update
* @returns {Promise<Guild>}
* @example
* guild.setRolePositions([{ role: roleID, position: updatedRoleIndex }])
* guild.setRolePositions([{ role: roleId, position: updatedRoleIndex }])
* .then(guild => console.log(`Role positions updated for ${guild}`))
* .catch(console.error);
*/
setRolePositions(rolePositions) {
// Make sure rolePositions are prepared for API
rolePositions = rolePositions.map(o => ({
id: this.roles.resolveID(o.role),
id: this.roles.resolveId(o.role),
position: o.position,
}));
@@ -1253,7 +1253,7 @@ class Guild extends AnonymousGuild {
.widget.patch({
data: {
enabled: widget.enabled,
channel_id: this.channels.resolveID(widget.channel),
channel_id: this.channels.resolveId(widget.channel),
},
reason,
})
@@ -1270,7 +1270,7 @@ class Guild extends AnonymousGuild {
* .catch(console.error);
*/
leave() {
if (this.ownerID === this.client.user.id) return Promise.reject(new Error('GUILD_OWNED'));
if (this.ownerId === this.client.user.id) return Promise.reject(new Error('GUILD_OWNED'));
return this.client.api
.users('@me')
.guilds(this.id)
@@ -1313,7 +1313,7 @@ class Guild extends AnonymousGuild {
this.memberCount === guild.memberCount &&
this.large === guild.large &&
this.icon === guild.icon &&
this.ownerID === guild.ownerID &&
this.ownerId === guild.ownerId &&
this.verificationLevel === guild.verificationLevel &&
(this.features === guild.features ||
(this.features.length === guild.features.length &&
@@ -1366,7 +1366,7 @@ class Guild extends AnonymousGuild {
}
/**
* Creates a collection of this guild's roles, sorted by their position and IDs.
* Creates a collection of this guild's roles, sorted by their position and ids.
* @returns {Collection<Snowflake, Role>}
* @private
*/
@@ -1375,7 +1375,7 @@ class Guild extends AnonymousGuild {
}
/**
* Creates a collection of this guild's or a specific category's channels, sorted by their position and IDs.
* Creates a collection of this guild's or a specific category's channels, sorted by their position and ids.
* @param {GuildChannel} [channel] Category to get the channels of
* @returns {Collection<Snowflake, GuildChannel>}
* @private

View File

@@ -359,7 +359,7 @@ class GuildAuditLogsEntry {
this.changes = data.changes?.map(c => ({ key: c.key, old: c.old_value, new: c.new_value })) ?? null;
/**
* The ID of this entry
* The entry's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -390,7 +390,7 @@ class GuildAuditLogsEntry {
case Actions.MESSAGE_UNPIN:
this.extra = {
channel: guild.client.channels.cache.get(data.options.channel_id) ?? { id: data.options.channel_id },
messageID: data.options.message_id,
messageId: data.options.message_id,
};
break;

View File

@@ -35,7 +35,7 @@ class GuildChannel extends Channel {
*/
this.guild = guild;
this.parentID = this.parentID ?? null;
this.parentId = this.parentId ?? null;
/**
* A manager of permission overwrites that belong to this channel
* @type {PermissionOverwriteManager}
@@ -66,10 +66,10 @@ class GuildChannel extends Channel {
if ('parent_id' in data) {
/**
* The ID of the category parent of this channel
* The id of the category parent of this channel
* @type {?Snowflake}
*/
this.parentID = data.parent_id;
this.parentId = data.parent_id;
}
if ('permission_overwrites' in data) {
@@ -86,7 +86,7 @@ class GuildChannel extends Channel {
* @readonly
*/
get parent() {
return this.guild.channels.resolve(this.parentID);
return this.guild.channels.resolve(this.parentId);
}
/**
@@ -185,7 +185,7 @@ class GuildChannel extends Channel {
* @private
*/
memberPermissions(member) {
if (member.id === this.guild.ownerID) return new Permissions(Permissions.ALL).freeze();
if (member.id === this.guild.ownerId) return new Permissions(Permissions.ALL).freeze();
const roles = member.roles.cache;
const permissions = new Permissions(roles.map(role => role.permissions));
@@ -235,7 +235,7 @@ class GuildChannel extends Channel {
}
/**
* A collection of cached members of this channel, mapped by their ID.
* A collection of cached members of this channel, mapped by their ids.
* Members that can view this channel, if the channel is text based.
* Members in the channel, if the channel is voice based.
* @type {Collection<Snowflake, GuildMember>}
@@ -261,7 +261,7 @@ class GuildChannel extends Channel {
* @property {boolean} [nsfw] Whether the channel is NSFW
* @property {number} [bitrate] The bitrate of the voice channel
* @property {number} [userLimit] The user limit of the voice channel
* @property {?Snowflake} [parentID] The parent ID of the channel
* @property {?Snowflake} [parentId] The parent's id of the channel
* @property {boolean} [lockPermissions]
* Lock the permissions of the channel to what the parent's permissions are
* @property {OverwriteResolvable[]|Collection<Snowflake, OverwriteResolvable>} [permissionOverwrites]
@@ -307,8 +307,8 @@ class GuildChannel extends Channel {
}
if (data.lockPermissions) {
if (data.parentID) {
const newParent = this.guild.channels.resolve(data.parentID);
if (data.parentId) {
const newParent = this.guild.channels.resolve(data.parentId);
if (newParent?.type === 'category') {
permission_overwrites = newParent.permissionOverwrites.cache.map(o =>
PermissionOverwrites.resolve(o, this.guild),
@@ -330,7 +330,7 @@ class GuildChannel extends Channel {
bitrate: data.bitrate ?? this.bitrate,
user_limit: data.userLimit ?? this.userLimit,
rtc_region: data.rtcRegion ?? this.rtcRegion,
parent_id: data.parentID,
parent_id: data.parentId,
lock_permissions: data.lockPermissions,
rate_limit_per_user: data.rateLimitPerUser,
default_auto_archive_duration: data.defaultAutoArchiveDuration,
@@ -379,7 +379,7 @@ class GuildChannel extends Channel {
return this.edit(
{
// eslint-disable-next-line no-prototype-builtins
parentID: channel?.id ?? channel ?? null,
parentId: channel?.id ?? channel ?? null,
lockPermissions,
},
reason,
@@ -488,8 +488,8 @@ class GuildChannel extends Channel {
max_age: maxAge,
max_uses: maxUses,
unique,
target_user_id: this.client.users.resolveID(targetUser),
target_application_id: targetApplication?.id ?? targetApplication?.applicationID ?? targetApplication,
target_user_id: this.client.users.resolveId(targetUser),
target_application_id: targetApplication?.id ?? targetApplication?.applicationId ?? targetApplication,
target_type: targetType,
},
reason,
@@ -540,7 +540,7 @@ class GuildChannel extends Channel {
}
/**
* Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel.
* Checks if this channel has the same type, topic, position, name, overwrites, and id as another channel.
* In most cases, a simple `channel.id === channel2.id` will do, and is much faster too.
* @param {GuildChannel} channel Channel to compare with
* @returns {boolean}
@@ -573,8 +573,8 @@ class GuildChannel extends Channel {
get deletable() {
return (
this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false) &&
this.guild.rulesChannelID !== this.id &&
this.guild.publicUpdatesChannelID !== this.id
this.guild.rulesChannelId !== this.id &&
this.guild.publicUpdatesChannelId !== this.id
);
}
@@ -584,7 +584,7 @@ class GuildChannel extends Channel {
* @readonly
*/
get manageable() {
if (this.client.user.id === this.guild.ownerID) return true;
if (this.client.user.id === this.guild.ownerId) return true;
if (this.type === 'voice' || this.type === 'stage') {
if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) {
return false;
@@ -601,7 +601,7 @@ class GuildChannel extends Channel {
* @readonly
*/
get viewable() {
if (this.client.user.id === this.guild.ownerID) return true;
if (this.client.user.id === this.guild.ownerId) return true;
const permissions = this.permissionsFor(this.client.user);
if (!permissions) return false;
return permissions.has(Permissions.FLAGS.VIEW_CHANNEL, false);

View File

@@ -35,16 +35,16 @@ class GuildMember extends Base {
this.joinedTimestamp = null;
/**
* The ID of the last message sent by the member in their guild, if one was sent
* The member's last message id, if one was sent
* @type {?Snowflake}
*/
this.lastMessageID = null;
this.lastMessageId = null;
/**
* The ID of the channel for the last message sent by the member in their guild, if one was sent
* The id of the channel for the last message sent by the member in their guild, if one was sent
* @type {?Snowflake}
*/
this.lastMessageChannelID = null;
this.lastMessageChannelId = null;
/**
* The timestamp of when the member used their Nitro boost on the guild, if it was used
@@ -122,7 +122,7 @@ class GuildMember extends Base {
* @readonly
*/
get lastMessage() {
return this.guild.channels.resolve(this.lastMessageChannelID)?.messages.resolve(this.lastMessageID) ?? null;
return this.guild.channels.resolve(this.lastMessageChannelId)?.messages.resolve(this.lastMessageId) ?? null;
}
/**
@@ -188,7 +188,7 @@ class GuildMember extends Base {
}
/**
* The ID of this member
* The member's id
* @type {Snowflake}
* @readonly
*/
@@ -211,7 +211,7 @@ class GuildMember extends Base {
* @readonly
*/
get permissions() {
if (this.user.id === this.guild.ownerID) return new Permissions(Permissions.ALL).freeze();
if (this.user.id === this.guild.ownerId) return new Permissions(Permissions.ALL).freeze();
return new Permissions(this.roles.cache.map(role => role.permissions)).freeze();
}
@@ -222,9 +222,9 @@ class GuildMember extends Base {
* @readonly
*/
get manageable() {
if (this.user.id === this.guild.ownerID) return false;
if (this.user.id === this.guild.ownerId) return false;
if (this.user.id === this.client.user.id) return false;
if (this.client.user.id === this.guild.ownerID) return true;
if (this.client.user.id === this.guild.ownerId) return true;
if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME');
return this.guild.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
}
@@ -263,7 +263,7 @@ class GuildMember extends Base {
* The data for editing a guild member.
* @typedef {Object} GuildMemberEditData
* @property {?string} [nick] The nickname to set for the member
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles or role IDs to apply
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles or role ids to apply
* @property {boolean} [mute] Whether or not the member should be muted
* @property {boolean} [deaf] Whether or not the member should be deafened
* @property {ChannelResolvable|null} [channel] Channel to move member to (if they are connected to voice), or `null`
@@ -352,8 +352,8 @@ class GuildMember extends Base {
this.partial === member.partial &&
this.guild.id === member.guild.id &&
this.joinedTimestamp === member.joinedTimestamp &&
this.lastMessageID === member.lastMessageID &&
this.lastMessageChannelID === member.lastMessageChannelID &&
this.lastMessageId === member.lastMessageId &&
this.lastMessageChannelId === member.lastMessageChannelId &&
this.nickname === member.nickname &&
this.pending === member.pending &&
(this._roles === member._roles ||
@@ -374,11 +374,11 @@ class GuildMember extends Base {
toJSON() {
return super.toJSON({
guild: 'guildID',
user: 'userID',
guild: 'guildId',
user: 'userId',
displayName: true,
lastMessage: false,
lastMessageID: false,
lastMessageId: false,
roles: true,
});
}

View File

@@ -50,10 +50,10 @@ class GuildTemplate extends Base {
this.usageCount = data.usage_count;
/**
* The ID of the user that created this template
* The id of the user that created this template
* @type {Snowflake}
*/
this.creatorID = data.creator_id;
this.creatorId = data.creator_id;
/**
* The user that created this template
@@ -74,10 +74,10 @@ class GuildTemplate extends Base {
this.updatedAt = new Date(data.updated_at);
/**
* The ID of the guild that this template belongs to
* The id of the guild that this template belongs to
* @type {Snowflake}
*/
this.guildID = data.source_guild_id;
this.guildId = data.source_guild_id;
/**
* The data of the guild that this template would create
@@ -148,7 +148,7 @@ class GuildTemplate extends Base {
*/
edit({ name, description } = {}) {
return this.client.api
.guilds(this.guildID)
.guilds(this.guildId)
.templates(this.code)
.patch({ data: { name, description } })
.then(data => this._patch(data));
@@ -160,7 +160,7 @@ class GuildTemplate extends Base {
*/
delete() {
return this.client.api
.guilds(this.guildID)
.guilds(this.guildId)
.templates(this.code)
.delete()
.then(() => this);
@@ -172,7 +172,7 @@ class GuildTemplate extends Base {
*/
sync() {
return this.client.api
.guilds(this.guildID)
.guilds(this.guildId)
.templates(this.code)
.put()
.then(data => this._patch(data));
@@ -202,7 +202,7 @@ class GuildTemplate extends Base {
* @readonly
*/
get guild() {
return this.client.guilds.resolve(this.guildID);
return this.client.guilds.resolve(this.guildId);
}
/**

View File

@@ -90,7 +90,7 @@ class Integration extends Base {
*/
get roles() {
const roles = this.guild.roles.cache;
return roles.filter(role => role.tags?.integrationID === this.id);
return roles.filter(role => role.tags?.integrationId === this.id);
}
_patch(data) {
@@ -186,9 +186,9 @@ class Integration extends Base {
toJSON() {
return super.toJSON({
role: 'roleID',
guild: 'guildID',
user: 'userID',
role: 'roleId',
guild: 'guildId',
user: 'userId',
});
}
}

View File

@@ -13,19 +13,19 @@ class Interaction extends Base {
super(client);
/**
* The type of this interaction
* The interaction's type
* @type {InteractionType}
*/
this.type = InteractionTypes[data.type];
/**
* The ID of this interaction
* The interaction's id
* @type {Snowflake}
*/
this.id = data.id;
/**
* The token of this interaction
* The interaction's token
* @type {string}
* @name Interaction#token
* @readonly
@@ -33,22 +33,22 @@ class Interaction extends Base {
Object.defineProperty(this, 'token', { value: data.token });
/**
* The ID of the application
* The application's id
* @type {Snowflake}
*/
this.applicationID = data.application_id;
this.applicationId = data.application_id;
/**
* The ID of the channel this interaction was sent in
* The id of the channel this interaction was sent in
* @type {?Snowflake}
*/
this.channelID = data.channel_id ?? null;
this.channelId = data.channel_id ?? null;
/**
* The ID of the guild this interaction was sent in
* The id of the guild this interaction was sent in
* @type {?Snowflake}
*/
this.guildID = data.guild_id ?? null;
this.guildId = data.guild_id ?? null;
/**
* The user which sent this interaction
@@ -93,7 +93,7 @@ class Interaction extends Base {
* @readonly
*/
get channel() {
return this.client.channels.cache.get(this.channelID) ?? null;
return this.client.channels.cache.get(this.channelId) ?? null;
}
/**
@@ -102,7 +102,7 @@ class Interaction extends Base {
* @readonly
*/
get guild() {
return this.client.guilds.cache.get(this.guildID) ?? null;
return this.client.guilds.cache.get(this.guildId) ?? null;
}
/**
@@ -110,7 +110,7 @@ class Interaction extends Base {
* @returns {boolean}
*/
inGuild() {
return Boolean(this.guildID && this.member);
return Boolean(this.guildId && this.member);
}
/**

View File

@@ -128,8 +128,8 @@ class InteractionCollector extends Collector {
if (this.interactionType && interaction.type !== this.interactionType) return null;
if (this.componentType && interaction.componentType !== this.componentType) return null;
if (this.message && interaction.message?.id !== this.message.id) return null;
if (this.channel && interaction.channelID !== this.channel.id) return null;
if (this.guild && interaction.guildID !== this.guild.id) return null;
if (this.channel && interaction.channelId !== this.channel.id) return null;
if (this.guild && interaction.guildId !== this.guild.id) return null;
return interaction.id;
}
@@ -148,8 +148,8 @@ class InteractionCollector extends Collector {
if (this.type && interaction.type !== this.type) return null;
if (this.componentType && interaction.componentType !== this.componentType) return null;
if (this.message && interaction.message?.id !== this.message.id) return null;
if (this.channel && interaction.channelID !== this.channel.id) return null;
if (this.guild && interaction.guildID !== this.guild.id) return null;
if (this.channel && interaction.channelId !== this.channel.id) return null;
if (this.guild && interaction.guildId !== this.guild.id) return null;
return interaction.id;
}

View File

@@ -9,8 +9,8 @@ const Webhook = require('./Webhook');
class InteractionWebhook {
/**
* @param {Client} client The instantiating client
* @param {Snowflake} id ID of the application
* @param {string} token Token of the interaction
* @param {Snowflake} id The application's id
* @param {string} token The interaction's token
*/
constructor(client, id, token) {
/**

View File

@@ -211,9 +211,9 @@ class Invite extends Base {
presenceCount: false,
memberCount: false,
uses: false,
channel: 'channelID',
inviter: 'inviterID',
guild: 'guildID',
channel: 'channelId',
inviter: 'inviterId',
guild: 'guildId',
});
}

View File

@@ -8,20 +8,20 @@ const Collection = require('../util/Collection');
* @extends {Base}
*/
class InviteStageInstance extends Base {
constructor(client, data, channelID, guildID) {
constructor(client, data, channelId, guildId) {
super(client);
/**
* The ID of the stage channel this invite is for
* The id of the stage channel this invite is for
* @type {Snowflake}
*/
this.channelID = channelID;
this.channelId = channelId;
/**
* The guild ID of the stage channel
* The stage channel's guild id
* @type {Snowflake}
*/
this.guildID = guildID;
this.guildId = guildId;
/**
* The members speaking in the stage channel
@@ -64,7 +64,7 @@ class InviteStageInstance extends Base {
* @readonly
*/
get channel() {
return this.client.channels.resolve(this.channelID);
return this.client.channels.resolve(this.channelId);
}
/**
@@ -73,7 +73,7 @@ class InviteStageInstance extends Base {
* @readonly
*/
get guild() {
return this.client.guilds.resolve(this.guildID);
return this.client.guilds.resolve(this.guildId);
}
}

View File

@@ -49,7 +49,7 @@ class Message extends Base {
_patch(data) {
/**
* The ID of the message
* The message's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -142,7 +142,7 @@ class Message extends Base {
this.components = data.components?.map(c => BaseMessageComponent.create(c, this.client)) ?? [];
/**
* A collection of attachments in the message - e.g. Pictures - mapped by their ID
* A collection of attachments in the message - e.g. Pictures - mapped by their ids
* @type {Collection<Snowflake, MessageAttachment>}
*/
this.attachments = new Collection();
@@ -200,10 +200,10 @@ class Message extends Base {
);
/**
* ID of the webhook that sent the message, if applicable
* The id of the webhook that sent the message, if applicable
* @type {?Snowflake}
*/
this.webhookID = data.webhook_id ?? null;
this.webhookId = data.webhook_id ?? null;
/**
* Supplemental application information for group activities
@@ -212,10 +212,10 @@ class Message extends Base {
this.groupActivityApplication = data.application ? new ClientApplication(this.client, data.application) : null;
/**
* ID of the application of the interaction that sent this message, if any
* The id of the application of the interaction that sent this message, if any
* @type {?Snowflake}
*/
this.applicationID = data.application_id ?? null;
this.applicationId = data.application_id ?? null;
/**
* Group activity
@@ -223,7 +223,7 @@ class Message extends Base {
*/
this.activity = data.activity
? {
partyID: data.activity.party_id,
partyId: data.activity.party_id,
type: data.activity.type,
}
: null;
@@ -241,11 +241,11 @@ class Message extends Base {
this.flags = new MessageFlags(data.flags).freeze();
/**
* Reference data sent in a message that contains IDs identifying the referenced message
* Reference data sent in a message that contains ids identifying the referenced message
* @typedef {Object} MessageReference
* @property {string} channelID ID of the channel the message was referenced
* @property {?string} guildID ID of the guild the message was referenced
* @property {?string} messageID ID of the message that was referenced
* @property {string} channelId The channel's id the message was referenced
* @property {?string} guildId The guild's id the message was referenced
* @property {?string} messageId The message's id that was referenced
*/
/**
@@ -254,9 +254,9 @@ class Message extends Base {
*/
this.reference = data.message_reference
? {
channelID: data.message_reference.channel_id,
guildID: data.message_reference.guild_id,
messageID: data.message_reference.message_id,
channelId: data.message_reference.channel_id,
guildId: data.message_reference.guild_id,
messageId: data.message_reference.message_id,
}
: null;
@@ -267,7 +267,7 @@ class Message extends Base {
/**
* Partial data of the interaction that a message is a reply to
* @typedef {Object} MessageInteraction
* @property {Snowflake} id The ID of the interaction
* @property {Snowflake} id The interaction's id
* @property {InteractionType} type The type of the interaction
* @property {string} commandName The name of the interaction's application command
* @property {User} user The user that invoked the interaction
@@ -402,7 +402,7 @@ class Message extends Base {
* @returns {ReactionCollector}
* @example
* // Create a reaction collector
* const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID';
* const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someId';
* const collector = message.createReactionCollector({ filter, time: 15000 });
* collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));
* collector.on('end', collected => console.log(`Collected ${collected.size} items`));
@@ -424,7 +424,7 @@ class Message extends Base {
* @returns {Promise<Collection<string, MessageReaction>>}
* @example
* // Create a reaction collector
* const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID'
* const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someId'
* message.awaitReactions({ filter, time: 15000 })
* .then(collected => console.log(`Collected ${collected.size} reactions`))
* .catch(console.error);
@@ -453,9 +453,9 @@ class Message extends Base {
* @returns {InteractionCollector}
* @example
* // Create a message component interaction collector
* const filter = (interaction) => interaction.customID === 'button' && interaction.user.id === 'someID';
* const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
* const collector = message.createMessageComponentCollector({ filter, time: 15000 });
* collector.on('collect', i => console.log(`Collected ${i.customID}`));
* collector.on('collect', i => console.log(`Collected ${i.customId}`));
* collector.on('end', collected => console.log(`Collected ${collected.size} items`));
*/
createMessageComponentCollector(options = {}) {
@@ -481,9 +481,9 @@ class Message extends Base {
* @returns {Promise<MessageComponentInteraction>}
* @example
* // Collect a message component interaction
* const filter = (interaction) => interaction.customID === 'button' && interaction.user.id === 'someID';
* const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
* message.awaitMessageComponent({ filter, time: 15000 })
* .then(interaction => console.log(`${interaction.customID} was clicked!`))
* .then(interaction => console.log(`${interaction.customId} was clicked!`))
* .catch(console.error);
*/
awaitMessageComponent(options = {}) {
@@ -538,10 +538,10 @@ class Message extends Base {
*/
async fetchReference() {
if (!this.reference) throw new Error('MESSAGE_REFERENCE_MISSING');
const { channelID, messageID } = this.reference;
const channel = this.client.channels.resolve(channelID);
const { channelId, messageId } = this.reference;
const channel = this.client.channels.resolve(channelId);
if (!channel) throw new Error('GUILD_CHANNEL_RESOLVE');
const message = await channel.messages.fetch(messageID);
const message = await channel.messages.fetch(messageId);
return message;
}
@@ -733,8 +733,8 @@ class Message extends Base {
* @returns {Promise<?Webhook>}
*/
fetchWebhook() {
if (!this.webhookID) return Promise.reject(new Error('WEBHOOK_MESSAGE'));
return this.client.fetchWebhook(this.webhookID);
if (!this.webhookId) return Promise.reject(new Error('WEBHOOK_MESSAGE'));
return this.client.fetchWebhook(this.webhookId);
}
/**
@@ -807,10 +807,10 @@ class Message extends Base {
toJSON() {
return super.toJSON({
channel: 'channelID',
author: 'authorID',
groupActivityApplication: 'groupActivityApplicationID',
guild: 'guildID',
channel: 'channelId',
author: 'authorId',
groupActivityApplication: 'groupActivityApplicationId',
guild: 'guildId',
cleanContent: true,
member: false,
reactions: false,

View File

@@ -45,7 +45,7 @@ class MessageAttachment {
_patch(data) {
/**
* The ID of this attachment
* The attachment's id
* @type {Snowflake}
*/
this.id = data.id;

View File

@@ -13,7 +13,7 @@ class MessageButton extends BaseMessageComponent {
/**
* @typedef {BaseMessageComponentOptions} MessageButtonOptions
* @property {string} [label] The text to be displayed on this button
* @property {string} [customID] A unique string to be sent in the interaction when clicked
* @property {string} [customId] A unique string to be sent in the interaction when clicked
* @property {MessageButtonStyleResolvable} [style] The style of this button
* @property {EmojiIdentifierResolvable} [emoji] The emoji to be displayed to the left of the text
* @property {string} [url] Optional URL for link-style buttons
@@ -40,7 +40,7 @@ class MessageButton extends BaseMessageComponent {
* A unique string to be sent in the interaction when clicked
* @type {?string}
*/
this.customID = data.custom_id ?? data.customID ?? null;
this.customId = data.custom_id ?? data.customId ?? null;
/**
* The style of this button
@@ -68,12 +68,12 @@ class MessageButton extends BaseMessageComponent {
}
/**
* Sets the custom ID of this button
* @param {string} customID A unique string to be sent in the interaction when clicked
* Sets the custom id for this button
* @param {string} customId A unique string to be sent in the interaction when clicked
* @returns {MessageButton}
*/
setCustomID(customID) {
this.customID = Util.verifyString(customID, RangeError, 'BUTTON_CUSTOM_ID');
setCustomId(customId) {
this.customId = Util.verifyString(customId, RangeError, 'BUTTON_CUSTOM_ID');
return this;
}
@@ -134,7 +134,7 @@ class MessageButton extends BaseMessageComponent {
*/
toJSON() {
return {
custom_id: this.customID,
custom_id: this.customId,
disabled: this.disabled,
emoji: this.emoji,
label: this.label,

View File

@@ -21,10 +21,10 @@ class MessageComponentInteraction extends Interaction {
this.message = this.channel?.messages.add(data.message) ?? data.message;
/**
* The custom ID of the component which was interacted with
* The custom id of the component which was interacted with
* @type {string}
*/
this.customID = data.data.custom_id;
this.customId = data.data.custom_id;
/**
* The type of component which was interacted with
@@ -54,7 +54,7 @@ class MessageComponentInteraction extends Interaction {
* An associated interaction webhook, can be used to further interact with this interaction
* @type {InteractionWebhook}
*/
this.webhook = new InteractionWebhook(this.client, this.applicationID, this.token);
this.webhook = new InteractionWebhook(this.client, this.applicationId, this.token);
}
/**
@@ -73,7 +73,7 @@ class MessageComponentInteraction extends Interaction {
return (
this.message.components
.flatMap(row => row.components)
.find(component => (component.customID ?? component.custom_id) === this.customID) ?? null
.find(component => (component.customId ?? component.custom_id) === this.customId) ?? null
);
}

View File

@@ -95,10 +95,10 @@ class MessageMentions {
/**
* Crossposted channel data.
* @typedef {Object} CrosspostedChannel
* @property {string} channelID ID of the mentioned channel
* @property {string} guildID ID of the guild that has the channel
* @property {string} type Type of the channel
* @property {string} name The name of the channel
* @property {string} channelId The mentioned channel's id
* @property {string} guildId The id of the guild that has the channel
* @property {string} type The channel's type
* @property {string} name The channel's name
*/
if (crosspostedChannels) {
@@ -115,8 +115,8 @@ class MessageMentions {
for (const d of crosspostedChannels) {
const type = channelTypes[d.type];
this.crosspostedChannels.set(d.id, {
channelID: d.id,
guildID: d.guild_id,
channelId: d.id,
guildId: d.guild_id,
type: type?.toLowerCase() ?? 'unknown',
name: d.name,
});
@@ -191,7 +191,7 @@ class MessageMentions {
if (!ignoreDirect) {
const id =
this.guild?.roles.resolveID(data) ?? this.client.channels.resolveID(data) ?? this.client.users.resolveID(data);
this.guild?.roles.resolveId(data) ?? this.client.channels.resolveId(data) ?? this.client.users.resolveId(data);
return typeof id === 'string' && (this.users.has(id) || this.channels.has(id) || this.roles.has(id));
}

View File

@@ -173,8 +173,8 @@ class MessagePayload {
let message_reference;
if (typeof this.options.reply === 'object') {
const message_id = this.isMessage
? this.target.channel.messages.resolveID(this.options.reply.messageReference)
: this.target.messages.resolveID(this.options.reply.messageReference);
? this.target.channel.messages.resolveId(this.options.reply.messageReference)
: this.target.messages.resolveId(this.options.reply.messageReference);
if (message_id) {
message_reference = {
message_id,

View File

@@ -113,7 +113,7 @@ class MessageReaction {
}
toJSON() {
return Util.flatten(this, { emoji: 'emojiID', message: 'messageID' });
return Util.flatten(this, { emoji: 'emojiId', message: 'messageId' });
}
_add(user) {

View File

@@ -11,7 +11,7 @@ const Util = require('../util/Util');
class MessageSelectMenu extends BaseMessageComponent {
/**
* @typedef {BaseMessageComponentOptions} MessageSelectMenuOptions
* @property {string} [customID] A unique string to be sent in the interaction when clicked
* @property {string} [customId] A unique string to be sent in the interaction when clicked
* @property {string} [placeholder] Custom placeholder text to display when nothing is selected
* @property {number} [minValues] The minimum number of selections required
* @property {number} [maxValues] The maximum number of selections allowed
@@ -51,7 +51,7 @@ class MessageSelectMenu extends BaseMessageComponent {
* A unique string to be sent in the interaction when clicked
* @type {?string}
*/
this.customID = data.custom_id ?? data.customID ?? null;
this.customId = data.custom_id ?? data.customId ?? null;
/**
* Custom placeholder text to display when nothing is selected
@@ -85,12 +85,12 @@ class MessageSelectMenu extends BaseMessageComponent {
}
/**
* Sets the custom ID of this select menu
* @param {string} customID A unique string to be sent in the interaction when clicked
* Sets the custom id of this select menu
* @param {string} customId A unique string to be sent in the interaction when clicked
* @returns {MessageSelectMenu}
*/
setCustomID(customID) {
this.customID = Util.verifyString(customID, RangeError, 'SELECT_MENU_CUSTOM_ID');
setCustomId(customId) {
this.customId = Util.verifyString(customId, RangeError, 'SELECT_MENU_CUSTOM_ID');
return this;
}
@@ -163,7 +163,7 @@ class MessageSelectMenu extends BaseMessageComponent {
*/
toJSON() {
return {
custom_id: this.customID,
custom_id: this.customId,
disabled: this.disabled,
placeholder: this.placeholder,
min_values: this.minValues,

View File

@@ -28,9 +28,9 @@ class NewsChannel extends TextChannel {
* }
*/
async addFollower(channel, reason) {
const channelID = this.guild.channels.resolveID(channel);
if (!channelID) throw new Error('GUILD_CHANNEL_RESOLVE');
await this.client.api.channels(this.id).followers.post({ data: { webhook_channel_id: channelID }, reason });
const channelId = this.guild.channels.resolveId(channel);
if (!channelId) throw new Error('GUILD_CHANNEL_RESOLVE');
await this.client.api.channels(this.id).followers.post({ data: { webhook_channel_id: channelId }, reason });
return this;
}
}

View File

@@ -27,7 +27,7 @@ class PermissionOverwrites extends Base {
_patch(data) {
/**
* The ID of this overwrite, either a user ID or a role ID
* The overwrite's id, either a {@link User} or a {@link Role} id
* @type {Snowflake}
*/
this.id = data.id;

View File

@@ -8,7 +8,7 @@ const Util = require('../util/Util');
/**
* Activity sent in a message.
* @typedef {Object} MessageActivity
* @property {string} [partyID] Id of the party represented in activity
* @property {string} [partyId] Id of the party represented in activity
* @property {number} [type] Type of activity sent
*/
@@ -46,13 +46,13 @@ class Presence {
*/
Object.defineProperty(this, 'client', { value: client });
/**
* The user ID of this presence
* The presence's user id
* @type {Snowflake}
*/
this.userID = data.user.id;
this.userId = data.user.id;
/**
* The guild of this presence
* The guild this presence is in
* @type {?Guild}
*/
this.guild = data.guild ?? null;
@@ -66,7 +66,7 @@ class Presence {
* @readonly
*/
get user() {
return this.client.users.resolve(this.userID);
return this.client.users.resolve(this.userId);
}
/**
@@ -75,7 +75,7 @@ class Presence {
* @readonly
*/
get member() {
return this.guild.members.resolve(this.userID);
return this.guild.members.resolve(this.userId);
}
patch(data) {
@@ -148,19 +148,19 @@ class Activity {
Object.defineProperty(this, 'presence', { value: presence });
/**
* The ID of the activity
* The activity's id
* @type {string}
*/
this.id = data.id;
/**
* The name of the activity
* The activity's name
* @type {string}
*/
this.name = data.name;
/**
* The type of the activity status
* The activity status's type
* @type {ActivityType}
*/
this.type = typeof data.type === 'number' ? ActivityTypes[data.type] : data.type;
@@ -184,10 +184,10 @@ class Activity {
this.state = data.state ?? null;
/**
* Application ID associated with this activity
* The id of the application associated with this activity
* @type {?Snowflake}
*/
this.applicationID = data.application_id ?? null;
this.applicationId = data.application_id ?? null;
/**
* Timestamps for the activity
@@ -203,10 +203,10 @@ class Activity {
: null;
/**
* The ID of the song on Spotify
* The Spotify song's id
* @type {?string}
*/
this.syncID = data.sync_id ?? null;
this.syncId = data.sync_id ?? null;
/**
* The platform the game is being played on
@@ -217,7 +217,7 @@ class Activity {
/**
* Party of the activity
* @type {?Object}
* @property {?string} id ID of the party
* @property {?string} id The party's id
* @property {number[]} size Size of the party as `[current, max]`
*/
this.party = data.party ?? null;
@@ -241,10 +241,10 @@ class Activity {
this.emoji = data.emoji ? new Emoji(presence.client, data.emoji) : null;
/**
* The ID of the game or Spotify session
* The game's or Spotify session's id
* @type {?string}
*/
this.sessionID = data.session_id ?? null;
this.sessionId = data.session_id ?? null;
/**
* The labels of the buttons of this rich presence
@@ -318,13 +318,13 @@ class RichPresenceAssets {
this.smallText = assets.small_text ?? null;
/**
* ID of the large image asset
* The large image asset's id
* @type {?Snowflake}
*/
this.largeImage = assets.large_image ?? null;
/**
* ID of the small image asset
* The small image asset's id
* @type {?Snowflake}
*/
this.smallImage = assets.small_image ?? null;
@@ -338,7 +338,7 @@ class RichPresenceAssets {
smallImageURL({ format, size } = {}) {
return (
this.smallImage &&
this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID, this.smallImage, {
this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.smallImage, {
format,
size,
})
@@ -357,7 +357,7 @@ class RichPresenceAssets {
} else if (/^twitch:/.test(this.largeImage)) {
return `https://static-cdn.jtvnw.net/previews-ttv/live_user_${this.largeImage.slice(7)}.png`;
}
return this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID, this.largeImage, {
return this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.largeImage, {
format,
size,
});

View File

@@ -30,7 +30,7 @@ class Role extends Base {
_patch(data) {
/**
* The ID of the role (unique to the guild it is part of)
* The role's id (unique to the guild it is part of)
* @type {Snowflake}
*/
this.id = data.id;
@@ -86,17 +86,17 @@ class Role extends Base {
/**
* The tags this role has
* @type {?Object}
* @property {Snowflake} [botID] The id of the bot this role belongs to
* @property {Snowflake} [integrationID] The id of the integration this role belongs to
* @property {Snowflake} [botId] The id of the bot this role belongs to
* @property {Snowflake} [integrationId] The id of the integration this role belongs to
* @property {true} [premiumSubscriberRole] Whether this is the guild's premium subscription role
*/
this.tags = data.tags ? {} : null;
if (data.tags) {
if ('bot_id' in data.tags) {
this.tags.botID = data.tags.bot_id;
this.tags.botId = data.tags.bot_id;
}
if ('integration_id' in data.tags) {
this.tags.integrationID = data.tags.integration_id;
this.tags.integrationId = data.tags.integration_id;
}
if ('premium_subscriber' in data.tags) {
this.tags.premiumSubscriberRole = true;

View File

@@ -25,7 +25,7 @@ class StageChannel extends BaseGuildVoiceChannel {
* @readonly
*/
get stageInstance() {
return this.guild.stageInstances.cache.find(stageInstance => stageInstance.channelID === this.id) ?? null;
return this.guild.stageInstances.cache.find(stageInstance => stageInstance.channelId === this.id) ?? null;
}
/**

View File

@@ -13,7 +13,7 @@ class StageInstance extends Base {
super(client);
/**
* The ID of this stage instance
* The stage instance's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -29,16 +29,16 @@ class StageInstance extends Base {
_patch(data) {
/**
* The guild ID of the associated stage channel
* The id of the guild associated with the stage channel
* @type {Snowflake}
*/
this.guildID = data.guild_id;
this.guildId = data.guild_id;
/**
* The ID of the associated stage channel
* The id of the channel associated with the stage channel
* @type {Snowflake}
*/
this.channelID = data.channel_id;
this.channelId = data.channel_id;
/**
* The topic of the stage instance
@@ -65,7 +65,7 @@ class StageInstance extends Base {
* @readonly
*/
get channel() {
return this.client.channels.resolve(this.channelID);
return this.client.channels.resolve(this.channelId);
}
/**
@@ -74,7 +74,7 @@ class StageInstance extends Base {
* @readonly
*/
get guild() {
return this.client.guilds.resolve(this.guildID);
return this.client.guilds.resolve(this.guildId);
}
/**
@@ -88,7 +88,7 @@ class StageInstance extends Base {
* .catch(console.error)
*/
edit(options) {
return this.guild.stageInstances.edit(this.channelID, options);
return this.guild.stageInstances.edit(this.channelId, options);
}
/**
@@ -101,7 +101,7 @@ class StageInstance extends Base {
* .catch(console.error);
*/
async delete() {
await this.guild.stageInstances.delete(this.channelID);
await this.guild.stageInstances.delete(this.channelId);
const clone = this._clone();
clone.deleted = true;
return clone;
@@ -118,7 +118,7 @@ class StageInstance extends Base {
* .catch(console.error);
*/
setTopic(topic) {
return this.guild.stageInstances.edit(this.channelID, { topic });
return this.guild.stageInstances.edit(this.channelId, { topic });
}
/**

View File

@@ -12,13 +12,13 @@ class Sticker extends Base {
constructor(client, sticker) {
super(client);
/**
* The ID of the sticker
* The sticker's id
* @type {Snowflake}
*/
this.id = sticker.id;
/**
* The ID of the sticker's image
* The sticker image's id
* @type {string}
*/
this.asset = sticker.asset;
@@ -42,10 +42,10 @@ class Sticker extends Base {
this.name = sticker.name;
/**
* The ID of the pack the sticker is from
* The id of the pack the sticker is from
* @type {Snowflake}
*/
this.packID = sticker.pack_id;
this.packId = sticker.pack_id;
/**
* An array of tags for the sticker, if any

View File

@@ -17,7 +17,7 @@ class Team extends Base {
_patch(data) {
/**
* The ID of the Team
* The Team's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -38,7 +38,7 @@ class Team extends Base {
* The Team's owner id
* @type {?string}
*/
this.ownerID = data.owner_user_id ?? null;
this.ownerId = data.owner_user_id ?? null;
/**
* The Team's members
@@ -58,7 +58,7 @@ class Team extends Base {
* @readonly
*/
get owner() {
return this.members.get(this.ownerID) ?? null;
return this.members.get(this.ownerId) ?? null;
}
/**

View File

@@ -41,7 +41,7 @@ class TeamMember extends Base {
}
/**
* The ID of the Team Member
* The Team Member's id
* @type {Snowflake}
* @readonly
*/

View File

@@ -57,10 +57,10 @@ class TextChannel extends GuildChannel {
if ('last_message_id' in data) {
/**
* The ID of the last message sent in this channel, if one was sent
* The last message id sent in the channel, if one was sent
* @type {?Snowflake}
*/
this.lastMessageID = data.last_message_id;
this.lastMessageId = data.last_message_id;
}
if ('rate_limit_per_user' in data) {

View File

@@ -52,10 +52,10 @@ class ThreadChannel extends Channel {
if ('parent_id' in data) {
/**
* The ID of the parent channel of this thread
* The id of the parent channel of this thread
* @type {Snowflake}
*/
this.parentID = data.parent_id;
this.parentId = data.parent_id;
}
if ('thread_metadata' in data) {
@@ -91,15 +91,15 @@ class ThreadChannel extends Channel {
* The id of the member who created this thread
* @type {?Snowflake}
*/
this.ownerID = data.owner_id;
this.ownerId = data.owner_id;
}
if ('last_message_id' in data) {
/**
* The ID of the last message sent in this thread, if one was sent
* The last message id sent in this thread, if one was sent
* @type {?Snowflake}
*/
this.lastMessageID = data.last_message_id;
this.lastMessageId = data.last_message_id;
}
if ('last_pin_timestamp' in data) {
@@ -167,7 +167,7 @@ class ThreadChannel extends Channel {
* @readonly
*/
get parent() {
return this.guild.channels.resolve(this.parentID);
return this.guild.channels.resolve(this.parentId);
}
/**
@@ -321,7 +321,7 @@ class ThreadChannel extends Channel {
* @readonly
*/
get editable() {
return (this.ownerID === this.client.user.id && (this.type !== 'private_thread' || this.joined)) || this.manageable;
return (this.ownerId === this.client.user.id && (this.type !== 'private_thread' || this.joined)) || this.manageable;
}
/**

View File

@@ -21,7 +21,7 @@ class User extends Base {
super(client);
/**
* The ID of the user
* The user's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -33,16 +33,16 @@ class User extends Base {
this.flags = null;
/**
* The ID of the last message sent by the user, if one was sent
* The user's last message id, if one was sent
* @type {?Snowflake}
*/
this.lastMessageID = null;
this.lastMessageId = null;
/**
* The ID of the channel for the last message sent by the user, if one was sent
* The channel in which the last message was sent by the user, if one was sent
* @type {?Snowflake}
*/
this.lastMessageChannelID = null;
this.lastMessageChannelId = null;
this._patch(data);
}
@@ -80,7 +80,7 @@ class User extends Base {
if ('avatar' in data) {
/**
* The ID of the user's avatar
* The user avatar's hash
* @type {?string}
*/
this.avatar = data.avatar;
@@ -140,7 +140,7 @@ class User extends Base {
* @readonly
*/
get lastMessage() {
return this.client.channels.resolve(this.lastMessageChannelID)?.messages.resolve(this.lastMessageID) ?? null;
return this.client.channels.resolve(this.lastMessageChannelId)?.messages.resolve(this.lastMessageId) ?? null;
}
/**
@@ -262,7 +262,7 @@ class User extends Base {
}
/**
* Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags.
* Checks if the user is equal to another. It compares id, username, discriminator, avatar, and bot flags.
* It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties.
* @param {User} user User to compare with
* @returns {boolean}
@@ -317,7 +317,7 @@ class User extends Base {
defaultAvatarURL: true,
tag: true,
lastMessage: false,
lastMessageID: false,
lastMessageId: false,
},
...props,
);

View File

@@ -8,7 +8,7 @@ const Util = require('../util/Util');
class VoiceRegion {
constructor(data) {
/**
* The ID of the region
* The region's id
* @type {string}
*/
this.id = data.id;

View File

@@ -19,7 +19,7 @@ class VoiceState extends Base {
*/
this.guild = guild;
/**
* The ID of the member of this voice state
* The id of the member of this voice state
* @type {Snowflake}
*/
this.id = data.user_id;
@@ -53,20 +53,20 @@ class VoiceState extends Base {
*/
this.selfVideo = data.self_video ?? null;
/**
* The session ID of this member's connection
* The session id for this member's connection
* @type {?string}
*/
this.sessionID = data.session_id ?? null;
this.sessionId = data.session_id ?? null;
/**
* Whether this member is streaming using "Go Live"
* @type {boolean}
*/
this.streaming = data.self_stream ?? false;
/**
* The ID of the voice or stage channel that this member is in
* The {@link VoiceChannel} or {@link StageChannel} id the member is in
* @type {?Snowflake}
*/
this.channelID = data.channel_id ?? null;
this.channelId = data.channel_id ?? null;
/**
* Whether this member is suppressed from speaking. This property is specific to stage channels only.
* @type {boolean}
@@ -97,7 +97,7 @@ class VoiceState extends Base {
* @readonly
*/
get channel() {
return this.guild.channels.cache.get(this.channelID) ?? null;
return this.guild.channels.cache.get(this.channelId) ?? null;
}
/**
@@ -177,7 +177,7 @@ class VoiceState extends Base {
await this.client.api.guilds(this.guild.id, 'voice-states', '@me').patch({
data: {
channel_id: this.channelID,
channel_id: this.channelId,
request_to_speak_timestamp: request ? new Date().toISOString() : null,
},
});
@@ -209,7 +209,7 @@ class VoiceState extends Base {
await this.client.api.guilds(this.guild.id, 'voice-states', target).patch({
data: {
channel_id: this.channelID,
channel_id: this.channelId,
suppress: suppressed,
},
});
@@ -222,8 +222,8 @@ class VoiceState extends Base {
serverMute: true,
selfDeaf: true,
selfMute: true,
sessionID: true,
channelID: 'channel',
sessionId: true,
channelId: 'channel',
});
}
}

View File

@@ -43,7 +43,7 @@ class Webhook {
this.avatar = data.avatar;
/**
* The ID of the webhook
* The webhook's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -58,13 +58,13 @@ class Webhook {
* The guild the webhook belongs to
* @type {Snowflake}
*/
this.guildID = data.guild_id;
this.guildId = data.guild_id;
/**
* The channel the webhook belongs to
* @type {Snowflake}
*/
this.channelID = data.channel_id;
this.channelId = data.channel_id;
/**
* The owner of the webhook
@@ -92,7 +92,7 @@ class Webhook {
* @typedef {BaseMessageOptions} WebhookMessageOptions
* @property {string} [username=this.name] Username override for the message
* @property {string} [avatarURL] Avatar URL override for the message
* @property {Snowflake} [threadID] The id of the thread in the channel to send to.
* @property {Snowflake} [threadId] The id of the thread in the channel to send to.
* <info>For interaction webhooks, this property is ignored</info>
*/
@@ -118,7 +118,7 @@ class Webhook {
* .catch(console.error);
* @example
* // Send a basic message in a thread
* webhook.send({ content: 'hello!', threadID: '836856309672348295' })
* webhook.send({ content: 'hello!', threadId: '836856309672348295' })
* .then(message => console.log(`Sent message: ${message.content}`))
* .catch(console.error);
* @example
@@ -172,7 +172,7 @@ class Webhook {
.post({
data,
files,
query: { thread_id: messagePayload.options.threadID, wait: true },
query: { thread_id: messagePayload.options.threadId, wait: true },
auth: false,
})
.then(d => this.client.channels?.cache.get(d.channel_id)?.messages.add(d, false) ?? d);
@@ -235,13 +235,13 @@ class Webhook {
this.name = data.name;
this.avatar = data.avatar;
this.channelID = data.channel_id;
this.channelId = data.channel_id;
return this;
}
/**
* Gets a message that was sent by this webhook.
* @param {Snowflake|'@original'} message The ID of the message to fetch
* @param {Snowflake|'@original'} message The id of the message to fetch
* @param {boolean} [cache=true] Whether to cache the message
* @returns {Promise<Message|APIMessage>} Returns the raw message data if the webhook was instantiated as a
* {@link WebhookClient} or if the channel is uncached, otherwise a {@link Message} will be returned

View File

@@ -37,7 +37,7 @@ class WelcomeChannel extends Base {
* The id of this welcome channel
* @type {Snowflake}
*/
this.channelID = data.channel_id;
this.channelId = data.channel_id;
}
/**
@@ -45,7 +45,7 @@ class WelcomeChannel extends Base {
* @type {?(TextChannel|NewsChannel)}
*/
get channel() {
return this.client.channels.resolve(this.channelID);
return this.client.channels.resolve(this.channelId);
}
/**

View File

@@ -32,7 +32,7 @@ class WelcomeScreen extends Base {
for (const channel of data.welcome_channels) {
const welcomeChannel = new WelcomeChannel(this.guild, channel);
this.welcomeChannels.set(welcomeChannel.channelID, welcomeChannel);
this.welcomeChannels.set(welcomeChannel.channelId, welcomeChannel);
}
}

View File

@@ -83,7 +83,7 @@ class WidgetMember extends Base {
* The id of the voice channel the member is in, if any
* @type {?Snowflake}
*/
this.channelID = data.channel_id;
this.channelId = data.channel_id;
/**
* The avatar URL of the member.

View File

@@ -18,7 +18,7 @@ class Application extends Base {
_patch(data) {
/**
* The ID of the application
* The application's id
* @type {Snowflake}
*/
this.id = data.id;
@@ -83,9 +83,9 @@ class Application extends Base {
/**
* Asset data.
* @typedef {Object} ApplicationAsset
* @property {Snowflake} id The asset ID
* @property {string} name The asset name
* @property {string} type The asset type
* @property {Snowflake} id The asset's id
* @property {string} name The asset's name
* @property {string} type The asset's type
*/
/**

View File

@@ -22,10 +22,10 @@ class TextBasedChannel {
this.messages = new MessageManager(this);
/**
* The ID of the last message in the channel, if one was sent
* The channel's last message id, if one was sent
* @type {?Snowflake}
*/
this.lastMessageID = null;
this.lastMessageId = null;
/**
* The timestamp when the last pinned message was pinned, if there was one
@@ -40,7 +40,7 @@ class TextBasedChannel {
* @readonly
*/
get lastMessage() {
return this.messages.resolve(this.lastMessageID);
return this.messages.resolve(this.lastMessageId);
}
/**
@@ -309,9 +309,9 @@ class TextBasedChannel {
* @returns {InteractionCollector}
* @example
* // Create a button interaction collector
* const filter = (interaction) => interaction.customID === 'button' && interaction.user.id === 'someID';
* const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
* const collector = channel.createMessageComponentCollector({ filter, time: 15000 });
* collector.on('collect', i => console.log(`Collected ${i.customID}`));
* collector.on('collect', i => console.log(`Collected ${i.customId}`));
* collector.on('end', collected => console.log(`Collected ${collected.size} items`));
*/
createMessageComponentCollector(options = {}) {
@@ -329,9 +329,9 @@ class TextBasedChannel {
* @returns {Promise<MessageComponentInteraction>}
* @example
* // Collect a message component interaction
* const filter = (interaction) => interaction.customID === 'button' && interaction.user.id === 'someID';
* const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
* channel.awaitMessageComponent({ filter, time: 15000 })
* .then(interaction => console.log(`${interaction.customID} was clicked!`))
* .then(interaction => console.log(`${interaction.customId} was clicked!`))
* .catch(console.error);
*/
awaitMessageComponent(options = {}) {
@@ -360,23 +360,23 @@ class TextBasedChannel {
*/
async bulkDelete(messages, filterOld = false) {
if (Array.isArray(messages) || messages instanceof Collection) {
let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id ?? m);
let messageIds = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id ?? m);
if (filterOld) {
messageIDs = messageIDs.filter(id => Date.now() - SnowflakeUtil.deconstruct(id).timestamp < 1209600000);
messageIds = messageIds.filter(id => Date.now() - SnowflakeUtil.deconstruct(id).timestamp < 1209600000);
}
if (messageIDs.length === 0) return new Collection();
if (messageIDs.length === 1) {
await this.client.api.channels(this.id).messages(messageIDs[0]).delete();
if (messageIds.length === 0) return new Collection();
if (messageIds.length === 1) {
await this.client.api.channels(this.id).messages(messageIds[0]).delete();
const message = this.client.actions.MessageDelete.getMessage(
{
message_id: messageIDs[0],
message_id: messageIds[0],
},
this,
);
return message ? new Collection([[message.id, message]]) : new Collection();
}
await this.client.api.channels[this.id].messages['bulk-delete'].post({ data: { messages: messageIDs } });
return messageIDs.reduce(
await this.client.api.channels[this.id].messages['bulk-delete'].post({ data: { messages: messageIds } });
return messageIds.reduce(
(col, id) =>
col.set(
id,