-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
auto-moderation.d.ts
99 lines (90 loc) · 3.79 KB
/
auto-moderation.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/** @module Types/AutoModeration */
import type { AutoModerationActionTypes, AutoModerationEventTypes, AutoModerationKeywordPresetTypes, AutoModerationTriggerTypes } from "../Constants";
export interface RawAutoModerationRule {
actions: Array<RawAutoModerationAction>;
creator_id: string;
enabled: boolean;
event_type: AutoModerationEventTypes;
exempt_channels: Array<string>;
exempt_roles: Array<string>;
guild_id: string;
id: string;
name: string;
trigger_metadata: RawTriggerMetadata;
trigger_type: AutoModerationTriggerTypes;
}
export interface RawTriggerMetadata {
/** `KEYWORD`, `KEYWORD_PRESET`, `MEMBER_PROFILE` */
allow_list?: Array<string>;
/** `KEYWORD`, `MEMBER_PROFILE` */
keyword_filter?: Array<string>;
/** `MENTION_SPAM` */
mention_raid_protection_enabled?: boolean;
/** `MENTION_SPAM` */
mention_total_limit?: number;
/** `KEYWORD_PRESET` */
presets?: Array<AutoModerationKeywordPresetTypes>;
/** `KEYWORD`, `MEMBER_PROFILE` */
regex_patterns?: Array<string>;
}
export interface RawAutoModerationAction {
metadata: RawActionMetadata;
type: AutoModerationActionTypes;
}
export interface RawActionMetadata {
/** `SEND_ALERT_MESSAGE` */
channel_id?: string;
/** `BLOCK_MESSAGE` */
custom_message?: string;
/** `TIMEOUT` */
duration_seconds?: number;
}
export interface TriggerMetadata {
/** The keywords to allow. Valid for `KEYWORD`, `KEYWORD_PRESET` & `MEMBER_PROFILE`. `KEYWORD`, `MEMBER_PROFILE`: Max 100 total, 60 characters each. `KEYWORD_PRESET`: Max 1000 total, 60 characters each. */
allowList?: Array<string>;
/** The keywords to filter. Valid for `KEYWORD` & `MEMBER_PROFILE`. Max 1000 total, 60 characters each. */
keywordFilter?: Array<string>;
/** Whether to enable mention raid protection. Valid for `MENTION_SPAM`. */
mentionRaidProtectionEnabled?: boolean;
/** The maximum number of mentions to allow. Valid for `MENTION_SPAM`. */
mentionTotalLimit?: number;
/** The presets to use. Valid for `KEYWORD_PRESET`. */
presets?: Array<AutoModerationKeywordPresetTypes>;
/** The regular expressions to match the content against and filter. Currently only Rust flavored regex such as `Rustexp` are supported. Valid for `KEYWORD`& `MEMBER_PROFILE`. Max 10 total, 260 characters each. */
regexPatterns?: Array<string>;
}
export interface AutoModerationAction {
/** The metadata for the action. */
metadata: ActionMetadata;
/** The type of the action. */
type: AutoModerationActionTypes;
}
export interface ActionMetadata {
/** The ID of the channel to send the message to. Valid for `SEND_ALERT_MESSAGE`. */
channelID?: string;
/** The custom message to send. Valid for `BLOCK_MESSAGE`. */
customMessage?: string;
/** The duration of the timeout in seconds. Valid for `TIMEOUT`. */
durationSeconds?: number;
}
export interface CreateAutoModerationRuleOptions {
/** The actions for the rule. */
actions: Array<AutoModerationAction>;
/** If the rule is enabled. */
enabled?: boolean;
/** The event type to trigger on. */
eventType: AutoModerationEventTypes;
/** The channels to exempt from the rule. */
exemptChannels?: Array<string>;
/** The roles to exempt from the rule. */
exemptRoles?: Array<string>;
/** The name of the rule. */
name: string;
/** The reason for creating the rule. */
reason?: string;
/** The metadata to use for the trigger. */
triggerMetadata?: TriggerMetadata;
/** The type of trigger to use. */
triggerType: AutoModerationTriggerTypes;
}
export type EditAutoModerationRuleOptions = Partial<Pick<CreateAutoModerationRuleOptions, "name" | "eventType" | "triggerMetadata" | "actions" | "enabled" | "exemptRoles" | "exemptChannels" | "reason">>;