diff --git a/packages/discord.js/src/structures/AutoModerationActionExecution.js b/packages/discord.js/src/structures/AutoModerationActionExecution.js index ca40856d0..ca09a7fbf 100644 --- a/packages/discord.js/src/structures/AutoModerationActionExecution.js +++ b/packages/discord.js/src/structures/AutoModerationActionExecution.js @@ -84,6 +84,33 @@ class AutoModerationActionExecution { get autoModerationRule() { return this.guild.autoModerationRules.cache.get(this.ruleId) ?? null; } + + /** + * The channel where this action was triggered from. + * @type {?TextBasedChannel} + * @readonly + */ + get channel() { + return this.guild.channels.cache.get(this.channelId) ?? null; + } + + /** + * The user that triggered this action. + * @type {?User} + * @readonly + */ + get user() { + return this.guild.client.users.cache.get(this.userId) ?? null; + } + + /** + * The guild member that triggered this action. + * @type {?GuildMember} + * @readonly + */ + get member() { + return this.guild.members.cache.get(this.userId) ?? null; + } } module.exports = AutoModerationActionExecution; diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index c67988c66..75f1d9bc2 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -341,8 +341,11 @@ export class AutoModerationActionExecution { public action: AutoModerationAction; public ruleId: Snowflake; public ruleTriggerType: AutoModerationRuleTriggerType; + public get user(): User | null; public userId: Snowflake; + public get channel(): TextBasedChannel | null; public channelId: Snowflake | null; + public get member(): GuildMember | null; public messageId: Snowflake | null; public alertSystemMessageId: Snowflake | null; public content: string;