Skip to content

Commit

Permalink
docs: remove GuildMemberResolvable
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jan 19, 2025
1 parent aa90f00 commit eb8fb96
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 30 deletions.
17 changes: 5 additions & 12 deletions packages/discord.js/src/managers/GuildMemberManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,8 @@ class GuildMemberManager extends CachedManager {
}

/**
* Data that resolves to give a GuildMember object. This can be:
* * A GuildMember object
* * A User resolvable
* @typedef {GuildMember|UserResolvable} GuildMemberResolvable
*/

/**
* Resolves a {@link GuildMemberResolvable} to a {@link GuildMember} object.
* @param {GuildMemberResolvable} member The user that is part of the guild
* Resolves a {@link UserResolvable} to a {@link GuildMember} object.
* @param {UserResolvable} member The user that is part of the guild
* @returns {?GuildMember}
*/
resolve(member) {
Expand All @@ -60,8 +53,8 @@ class GuildMemberManager extends CachedManager {
}

/**
* Resolves a {@link GuildMemberResolvable} to a member id.
* @param {GuildMemberResolvable} member The user that is part of the guild
* Resolves a {@link UserResolvable} to a member id.
* @param {UserResolvable} member The user that is part of the guild
* @returns {?Snowflake}
*/
resolveId(member) {
Expand Down Expand Up @@ -523,7 +516,7 @@ class GuildMemberManager extends CachedManager {
/**
* Options used for adding or removing a role from a member.
* @typedef {Object} AddOrRemoveGuildMemberRoleOptions
* @property {GuildMemberResolvable} user The user to add/remove the role from
* @property {UserResolvable} user The user to add/remove the role from
* @property {RoleResolvable} role The role to add/remove
* @property {string} [reason] Reason for adding/removing the role
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/managers/VoiceStateManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class VoiceStateManager extends CachedManager {

/**
* Obtains a user's voice state from discord or from the cache if it's already available.
* @param {GuildMemberResolvable|'@me'} member The member whose voice state is to be fetched
* @param {UserResolvable|'@me'} member The member whose voice state is to be fetched
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<VoiceState>}
* @example
Expand Down
4 changes: 2 additions & 2 deletions packages/discord.js/src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class Guild extends AnonymousGuild {
* @property {?VoiceChannelResolvable} [afkChannel] The AFK channel of the guild
* @property {number} [afkTimeout] The AFK timeout of the guild
* @property {?(BufferResolvable|Base64Resolvable)} [icon] The icon of the guild
* @property {GuildMemberResolvable} [owner] The owner of the guild
* @property {UserResolvable} [owner] The owner of the guild
* @property {?(BufferResolvable|Base64Resolvable)} [splash] The invite splash image of the guild
* @property {?(BufferResolvable|Base64Resolvable)} [discoverySplash] The discovery splash image of the guild
* @property {?(BufferResolvable|Base64Resolvable)} [banner] The banner of the guild
Expand Down Expand Up @@ -1148,7 +1148,7 @@ class Guild extends AnonymousGuild {

/**
* Sets a new owner of the guild.
* @param {GuildMemberResolvable} owner The new owner of the guild
* @param {UserResolvable} owner The new owner of the guild
* @param {string} [reason] Reason for setting the new owner
* @returns {Promise<Guild>}
* @example
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class GuildChannel extends BaseChannel {

/**
* Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
* @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
* @param {UserResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
* will return all permissions
* @returns {?Readonly<PermissionsBitField>}
Expand Down
4 changes: 2 additions & 2 deletions packages/discord.js/src/structures/PermissionOverwrites.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class PermissionOverwrites extends Base {
/**
* Data that can be used for a permission overwrite
* @typedef {Object} OverwriteData
* @property {GuildMemberResolvable|RoleResolvable} id Member or role this overwrite is for
* @property {UserResolvable|RoleResolvable} id Member or role this overwrite is for
* @property {PermissionResolvable} [allow] The permissions to allow
* @property {PermissionResolvable} [deny] The permissions to deny
* @property {OverwriteType} [type] The type of this OverwriteData (mandatory if `id` is a Snowflake)
Expand All @@ -174,7 +174,7 @@ class PermissionOverwrites extends Base {

const id = guild.roles.resolveId(overwrite.id) ?? guild.client.users.resolveId(overwrite.id);
if (!id) {
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'overwrite.id', 'GuildMemberResolvable or RoleResolvable');
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'overwrite.id', 'UserResolvable or RoleResolvable');
}

if (overwrite.type !== undefined && (typeof overwrite.type !== 'number' || !(overwrite.type in OverwriteType))) {
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/ThreadChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class ThreadChannel extends BaseChannel {
/**
* Gets the overall set of permissions for a member or role in this thread's parent channel, taking overwrites into
* account.
* @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
* @param {UserResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
* will return all permissions
* @returns {?Readonly<PermissionsBitField>}
Expand Down
20 changes: 9 additions & 11 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ export class Guild extends AnonymousGuild {
): Promise<Guild>;
public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setName(name: string, reason?: string): Promise<Guild>;
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
public setOwner(owner: UserResolvable, reason?: string): Promise<Guild>;
public setPreferredLocale(preferredLocale: Locale | null, reason?: string): Promise<Guild>;
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
Expand Down Expand Up @@ -1605,7 +1605,7 @@ export abstract class GuildChannel extends BaseChannel {
public lockPermissions(): Promise<this>;
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
public permissionsFor(
memberOrRole: GuildMemberResolvable | RoleResolvable,
memberOrRole: UserResolvable | RoleResolvable,
checkAdmin?: boolean,
): Readonly<PermissionsBitField> | null;
public setName(name: string, reason?: string): Promise<this>;
Expand Down Expand Up @@ -3400,7 +3400,7 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
public leave(): Promise<this>;
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
public permissionsFor(
memberOrRole: GuildMemberResolvable | RoleResolvable,
memberOrRole: UserResolvable | RoleResolvable,
checkAdmin?: boolean,
): Readonly<PermissionsBitField> | null;
public fetchOwner(options?: FetchThreadOwnerOptions): Promise<ThreadMember>;
Expand Down Expand Up @@ -4256,12 +4256,12 @@ export class GuildManager extends CachedManager<Snowflake, Guild, GuildResolvabl
}

export interface AddOrRemoveGuildMemberRoleOptions {
user: GuildMemberResolvable;
user: UserResolvable;
role: RoleResolvable;
reason?: string;
}

export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, GuildMemberResolvable> {
export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, UserResolvable> {
private constructor(guild: Guild, iterable?: Iterable<RawGuildMemberData>);
public guild: Guild;
public get me(): GuildMember | null;
Expand Down Expand Up @@ -4553,7 +4553,7 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
private constructor(guild: Guild, iterable?: Iterable<RawVoiceStateData>);
public guild: Guild;
public fetch(member: GuildMemberResolvable | '@me', options?: BaseFetchOptions): Promise<VoiceState>;
public fetch(member: UserResolvable | '@me', options?: BaseFetchOptions): Promise<VoiceState>;
}

//#endregion
Expand Down Expand Up @@ -5935,7 +5935,7 @@ export interface GuildEditOptions {
afkTimeout?: number;
afkChannel?: VoiceChannelResolvable | null;
icon?: BufferResolvable | Base64Resolvable | null;
owner?: GuildMemberResolvable;
owner?: UserResolvable;
splash?: BufferResolvable | Base64Resolvable | null;
discoverySplash?: BufferResolvable | Base64Resolvable | null;
banner?: BufferResolvable | Base64Resolvable | null;
Expand Down Expand Up @@ -5990,8 +5990,6 @@ export interface GuildMemberEditOptions {
reason?: string;
}

export type GuildMemberResolvable = GuildMember | UserResolvable;

export type GuildResolvable = Guild | NonThreadGuildBasedChannel | GuildMember | GuildEmoji | Invite | Role | Snowflake;

export interface GuildPruneMembersOptions {
Expand Down Expand Up @@ -6513,7 +6511,7 @@ export interface MultipleShardSpawnOptions {
export interface BaseOverwriteData {
allow?: PermissionResolvable;
deny?: PermissionResolvable;
id: GuildMemberResolvable | RoleResolvable;
id: UserResolvable | RoleResolvable;
type?: OverwriteType;
}

Expand All @@ -6522,7 +6520,7 @@ export interface OverwriteDataWithMandatoryType extends BaseOverwriteData {
}

export interface OverwriteDataWithOptionalType extends BaseOverwriteData {
id: Exclude<GuildMemberResolvable | RoleResolvable, Snowflake>;
id: Exclude<UserResolvable | RoleResolvable, Snowflake>;
}

export type OverwriteData = OverwriteDataWithMandatoryType | OverwriteDataWithOptionalType;
Expand Down

0 comments on commit eb8fb96

Please sign in to comment.