mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
feat(GuildMember): add method to check timeout (#7146)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
@@ -303,6 +303,14 @@ class GuildMember extends Base {
|
|||||||
return this.manageable && (this.guild.me?.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS) ?? false);
|
return this.manageable && (this.guild.me?.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this member is currently timed out
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isCommunicationDisabled() {
|
||||||
|
return this.communicationDisabledUntilTimestamp > Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `channel.permissionsFor(guildMember)`. Returns permissions for a member in a guild channel,
|
* Returns `channel.permissionsFor(guildMember)`. Returns permissions for a member in a guild channel,
|
||||||
* taking into account roles and permission overwrites.
|
* taking into account roles and permission overwrites.
|
||||||
|
|||||||
11
typings/index.d.ts
vendored
11
typings/index.d.ts
vendored
@@ -469,9 +469,10 @@ export type KeyedEnum<K, T> = {
|
|||||||
[Key in keyof K]: T | string;
|
[Key in keyof K]: T | string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EnumValueMapped<E extends KeyedEnum<T, number>, T extends Partial<Record<keyof E, unknown>>> = T & {
|
export type EnumValueMapped<E extends KeyedEnum<T, number>, T extends Partial<Record<keyof E, unknown>>> = T &
|
||||||
[Key in keyof T as E[Key]]: T[Key];
|
{
|
||||||
};
|
[Key in keyof T as E[Key]]: T[Key];
|
||||||
|
};
|
||||||
|
|
||||||
export type MappedChannelCategoryTypes = EnumValueMapped<
|
export type MappedChannelCategoryTypes = EnumValueMapped<
|
||||||
typeof ChannelTypes,
|
typeof ChannelTypes,
|
||||||
@@ -1122,6 +1123,10 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
|
|||||||
public deleteDM(): Promise<DMChannel>;
|
public deleteDM(): Promise<DMChannel>;
|
||||||
public displayAvatarURL(options?: ImageURLOptions): string;
|
public displayAvatarURL(options?: ImageURLOptions): string;
|
||||||
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
|
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
|
||||||
|
public isCommunicationDisabled(): this is GuildMember & {
|
||||||
|
communicationDisabledUntilTimestamp: number;
|
||||||
|
readonly communicationDisabledUntil: Date;
|
||||||
|
};
|
||||||
public kick(reason?: string): Promise<GuildMember>;
|
public kick(reason?: string): Promise<GuildMember>;
|
||||||
public permissionsIn(channel: GuildChannelResolvable): Readonly<Permissions>;
|
public permissionsIn(channel: GuildChannelResolvable): Readonly<Permissions>;
|
||||||
public setNickname(nickname: string | null, reason?: string): Promise<GuildMember>;
|
public setNickname(nickname: string | null, reason?: string): Promise<GuildMember>;
|
||||||
|
|||||||
Reference in New Issue
Block a user