feat(AutoModerationActionExecution): add channel, user and member getters (#9142)

* feat(AutoModerationActionExecution): add channel prop

* feat(AutoModerationActionExecution): add user prop

* fix: sintax

* feat: add guildmember getter

* Apply suggestions from code review

Co-authored-by: Almeida <almeidx@pm.me>

---------

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Jaworek
2023-02-25 15:41:10 +01:00
committed by GitHub
parent e78b8ad3fb
commit 095bd77515
2 changed files with 30 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;