mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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;
|
||||
|
||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user