diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index 3837c139f..f271def0e 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -303,6 +303,14 @@ class GuildMember extends Base { 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, * taking into account roles and permission overwrites. diff --git a/typings/index.d.ts b/typings/index.d.ts index 8a111cf47..186ba0ffd 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -469,9 +469,10 @@ export type KeyedEnum = { [Key in keyof K]: T | string; }; -export type EnumValueMapped, T extends Partial>> = T & { - [Key in keyof T as E[Key]]: T[Key]; -}; +export type EnumValueMapped, T extends Partial>> = T & + { + [Key in keyof T as E[Key]]: T[Key]; + }; export type MappedChannelCategoryTypes = EnumValueMapped< typeof ChannelTypes, @@ -1122,6 +1123,10 @@ export class GuildMember extends PartialTextBasedChannel(Base) { public deleteDM(): Promise; public displayAvatarURL(options?: ImageURLOptions): string; public edit(data: GuildMemberEditData, reason?: string): Promise; + public isCommunicationDisabled(): this is GuildMember & { + communicationDisabledUntilTimestamp: number; + readonly communicationDisabledUntil: Date; + }; public kick(reason?: string): Promise; public permissionsIn(channel: GuildChannelResolvable): Readonly; public setNickname(nickname: string | null, reason?: string): Promise;