@satorijs/adapter-discord 4.1.3 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -2
- package/lib/utils.d.ts +1 -1
- package/package.json +4 -3
- package/src/bot.ts +221 -0
- package/src/index.ts +27 -0
- package/src/message.ts +446 -0
- package/src/types/.eslintrc.yml +2 -0
- package/src/types/application-role-connection.ts +61 -0
- package/src/types/application.ts +120 -0
- package/src/types/audit-log.ts +219 -0
- package/src/types/auto-moderation.ts +189 -0
- package/src/types/ban.ts +92 -0
- package/src/types/channel.ts +501 -0
- package/src/types/command.ts +320 -0
- package/src/types/component.ts +125 -0
- package/src/types/device.ts +44 -0
- package/src/types/emoji.ts +96 -0
- package/src/types/gateway.ts +334 -0
- package/src/types/guild-member.ts +260 -0
- package/src/types/guild-template.ts +109 -0
- package/src/types/guild.ts +476 -0
- package/src/types/index.ts +49 -0
- package/src/types/integration.ts +130 -0
- package/src/types/interaction.ts +283 -0
- package/src/types/internal.ts +44 -0
- package/src/types/invite.ts +192 -0
- package/src/types/message.ts +470 -0
- package/src/types/presence.ts +163 -0
- package/src/types/reaction.ts +139 -0
- package/src/types/role.ts +252 -0
- package/src/types/scheduled-event.ts +200 -0
- package/src/types/stage-instance.ts +98 -0
- package/src/types/sticker.ts +179 -0
- package/src/types/team.ts +33 -0
- package/src/types/thread.ts +298 -0
- package/src/types/user.ts +154 -0
- package/src/types/voice.ts +124 -0
- package/src/types/webhook.ts +246 -0
- package/src/utils.ts +391 -0
- package/src/ws.ts +124 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ApplicationCommand, AutoModerationRule, Channel, GuildScheduledEvent, integer, Integration, Internal, snowflake, User, Webhook } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure */
|
|
4
|
+
export interface AuditLog {
|
|
5
|
+
/** list of application commands referenced in the audit log */
|
|
6
|
+
application_commands: ApplicationCommand[]
|
|
7
|
+
/** list of audit log entries */
|
|
8
|
+
audit_log_entries: AuditLog.Entry[]
|
|
9
|
+
/** list of auto moderation rules referenced in the audit log */
|
|
10
|
+
auto_moderation_rules: AutoModerationRule[]
|
|
11
|
+
/** list of guild scheduled events referenced in the audit log */
|
|
12
|
+
guild_scheduled_events: GuildScheduledEvent[]
|
|
13
|
+
/** list of partial integration objects */
|
|
14
|
+
integrations: Partial<Integration>[]
|
|
15
|
+
/** list of threads found in the audit log* */
|
|
16
|
+
threads: Channel[]
|
|
17
|
+
/** list of users found in the audit log */
|
|
18
|
+
users: User[]
|
|
19
|
+
/** list of webhooks found in the audit log */
|
|
20
|
+
webhooks: Webhook[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export namespace AuditLog {
|
|
24
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
|
25
|
+
export interface Entry {
|
|
26
|
+
/** id of the affected entity (webhook, user, role, etc.) */
|
|
27
|
+
target_id?: string
|
|
28
|
+
/** changes made to the target_id */
|
|
29
|
+
changes?: Change[]
|
|
30
|
+
/** the user who made the changes */
|
|
31
|
+
user_id?: snowflake
|
|
32
|
+
/** id of the entry */
|
|
33
|
+
id: snowflake
|
|
34
|
+
/** type of action that occurred */
|
|
35
|
+
action_type: Type
|
|
36
|
+
/** additional info for certain action types */
|
|
37
|
+
options?: OptionalInfo
|
|
38
|
+
/** the reason for the change (0-512 characters) */
|
|
39
|
+
reason?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
|
|
43
|
+
export enum Type {
|
|
44
|
+
/** Server settings were updated */
|
|
45
|
+
GUILD_UPDATE = 1,
|
|
46
|
+
/** Channel was created */
|
|
47
|
+
CHANNEL_CREATE = 10,
|
|
48
|
+
/** Channel settings were updated */
|
|
49
|
+
CHANNEL_UPDATE = 11,
|
|
50
|
+
/** Channel was deleted */
|
|
51
|
+
CHANNEL_DELETE = 12,
|
|
52
|
+
/** Permission overwrite was added to a channel */
|
|
53
|
+
CHANNEL_OVERWRITE_CREATE = 13,
|
|
54
|
+
/** Permission overwrite was updated for a channel */
|
|
55
|
+
CHANNEL_OVERWRITE_UPDATE = 14,
|
|
56
|
+
/** Permission overwrite was deleted from a channel */
|
|
57
|
+
CHANNEL_OVERWRITE_DELETE = 15,
|
|
58
|
+
/** Member was removed from server */
|
|
59
|
+
MEMBER_KICK = 20,
|
|
60
|
+
/** Members were pruned from server */
|
|
61
|
+
MEMBER_PRUNE = 21,
|
|
62
|
+
/** Member was banned from server */
|
|
63
|
+
MEMBER_BAN_ADD = 22,
|
|
64
|
+
/** Server ban was lifted for a member */
|
|
65
|
+
MEMBER_BAN_REMOVE = 23,
|
|
66
|
+
/** Member was updated in server */
|
|
67
|
+
MEMBER_UPDATE = 24,
|
|
68
|
+
/** Member was added or removed from a role */
|
|
69
|
+
MEMBER_ROLE_UPDATE = 25,
|
|
70
|
+
/** Member was moved to a different voice channel */
|
|
71
|
+
MEMBER_MOVE = 26,
|
|
72
|
+
/** Member was disconnected from a voice channel */
|
|
73
|
+
MEMBER_DISCONNECT = 27,
|
|
74
|
+
/** Bot user was added to server */
|
|
75
|
+
BOT_ADD = 28,
|
|
76
|
+
/** Role was created */
|
|
77
|
+
ROLE_CREATE = 30,
|
|
78
|
+
/** Role was edited */
|
|
79
|
+
ROLE_UPDATE = 31,
|
|
80
|
+
/** Role was deleted */
|
|
81
|
+
ROLE_DELETE = 32,
|
|
82
|
+
/** Server invite was created */
|
|
83
|
+
INVITE_CREATE = 40,
|
|
84
|
+
/** Server invite was updated */
|
|
85
|
+
INVITE_UPDATE = 41,
|
|
86
|
+
/** Server invite was deleted */
|
|
87
|
+
INVITE_DELETE = 42,
|
|
88
|
+
/** Webhook was created */
|
|
89
|
+
WEBHOOK_CREATE = 50,
|
|
90
|
+
/** Webhook properties or channel were updated */
|
|
91
|
+
WEBHOOK_UPDATE = 51,
|
|
92
|
+
/** Webhook was deleted */
|
|
93
|
+
WEBHOOK_DELETE = 52,
|
|
94
|
+
/** Emoji was created */
|
|
95
|
+
EMOJI_CREATE = 60,
|
|
96
|
+
/** Emoji name was updated */
|
|
97
|
+
EMOJI_UPDATE = 61,
|
|
98
|
+
/** Emoji was deleted */
|
|
99
|
+
EMOJI_DELETE = 62,
|
|
100
|
+
/** Single message was deleted */
|
|
101
|
+
MESSAGE_DELETE = 72,
|
|
102
|
+
/** Multiple messages were deleted */
|
|
103
|
+
MESSAGE_BULK_DELETE = 73,
|
|
104
|
+
/** Message was pinned to a channel */
|
|
105
|
+
MESSAGE_PIN = 74,
|
|
106
|
+
/** Message was unpinned from a channel */
|
|
107
|
+
MESSAGE_UNPIN = 75,
|
|
108
|
+
/** App was added to server */
|
|
109
|
+
INTEGRATION_CREATE = 80,
|
|
110
|
+
/** App was updated (as an example, its scopes were updated) */
|
|
111
|
+
INTEGRATION_UPDATE = 81,
|
|
112
|
+
/** App was removed from server */
|
|
113
|
+
INTEGRATION_DELETE = 82,
|
|
114
|
+
/** Stage instance was created (stage channel becomes live) */
|
|
115
|
+
STAGE_INSTANCE_CREATE = 83,
|
|
116
|
+
/** Stage instance details were updated */
|
|
117
|
+
STAGE_INSTANCE_UPDATE = 84,
|
|
118
|
+
/** Stage instance was deleted (stage channel no longer live) */
|
|
119
|
+
STAGE_INSTANCE_DELETE = 85,
|
|
120
|
+
/** Sticker was created */
|
|
121
|
+
STICKER_CREATE = 90,
|
|
122
|
+
/** Sticker details were updated */
|
|
123
|
+
STICKER_UPDATE = 91,
|
|
124
|
+
/** Sticker was deleted */
|
|
125
|
+
STICKER_DELETE = 92,
|
|
126
|
+
/** Event was created */
|
|
127
|
+
GUILD_SCHEDULED_EVENT_CREATE = 100,
|
|
128
|
+
/** Event was updated */
|
|
129
|
+
GUILD_SCHEDULED_EVENT_UPDATE = 101,
|
|
130
|
+
/** Event was cancelled */
|
|
131
|
+
GUILD_SCHEDULED_EVENT_DELETE = 102,
|
|
132
|
+
/** Thread was created in a channel */
|
|
133
|
+
THREAD_CREATE = 110,
|
|
134
|
+
/** Thread was updated */
|
|
135
|
+
THREAD_UPDATE = 111,
|
|
136
|
+
/** Thread was deleted */
|
|
137
|
+
THREAD_DELETE = 112,
|
|
138
|
+
/** Permissions were updated for a command */
|
|
139
|
+
APPLICATION_COMMAND_PERMISSION_UPDATE = 121,
|
|
140
|
+
/** Auto Moderation rule was created */
|
|
141
|
+
AUTO_MODERATION_RULE_CREATE = 140,
|
|
142
|
+
/** Auto Moderation rule was updated */
|
|
143
|
+
AUTO_MODERATION_RULE_UPDATE = 141,
|
|
144
|
+
/** Auto Moderation rule was deleted */
|
|
145
|
+
AUTO_MODERATION_RULE_DELETE = 142,
|
|
146
|
+
/** Message was blocked by AutoMod */
|
|
147
|
+
AUTO_MODERATION_BLOCK_MESSAGE = 143,
|
|
148
|
+
/** Message was flagged by AutoMod */
|
|
149
|
+
AUTO_MODERATION_FLAG_TO_CHANNEL = 144,
|
|
150
|
+
/** Member was timed out by AutoMod */
|
|
151
|
+
AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
|
155
|
+
export interface OptionalInfo {
|
|
156
|
+
/** ID of the app whose permissions were targeted */
|
|
157
|
+
application_id: snowflake
|
|
158
|
+
/** name of the Auto Moderation rule that was triggered */
|
|
159
|
+
auto_moderation_rule_name: string
|
|
160
|
+
/** trigger type of the Auto Moderation rule that was triggered */
|
|
161
|
+
auto_moderation_rule_trigger_type: string
|
|
162
|
+
/** channel in which the entities were targeted */
|
|
163
|
+
channel_id: snowflake
|
|
164
|
+
/** number of entities that were targeted */
|
|
165
|
+
count: string
|
|
166
|
+
/** number of days after which inactive members were kicked */
|
|
167
|
+
delete_member_days: string
|
|
168
|
+
/** id of the overwritten entity */
|
|
169
|
+
id: snowflake
|
|
170
|
+
/** number of members removed by the prune */
|
|
171
|
+
members_removed: string
|
|
172
|
+
/** id of the message that was targeted */
|
|
173
|
+
message_id: snowflake
|
|
174
|
+
/** name of the role if type is "0" (not present if type is "1") */
|
|
175
|
+
role_name: string
|
|
176
|
+
/** type of overwritten entity - "0" for "role" or "1" for "member" */
|
|
177
|
+
type: string
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
|
181
|
+
export interface Change {
|
|
182
|
+
/** new value of the key */
|
|
183
|
+
new_value?: any
|
|
184
|
+
/** old value of the key */
|
|
185
|
+
old_value?: any
|
|
186
|
+
/** name of audit log change key */
|
|
187
|
+
key: string
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-params */
|
|
191
|
+
export interface GetParams {
|
|
192
|
+
/** entries from a specific user ID */
|
|
193
|
+
user_id?: snowflake
|
|
194
|
+
/** entries for a specific audit log event */
|
|
195
|
+
action_type?: Type
|
|
196
|
+
/** entries that preceded a specific audit log entry ID */
|
|
197
|
+
before?: snowflake
|
|
198
|
+
/** entries that succeeded a specific audit log entry ID */
|
|
199
|
+
after?: snowflake
|
|
200
|
+
/** maximum number of entries (between 1-100) to return, defaults to 50 */
|
|
201
|
+
limit?: integer
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare module './internal' {
|
|
206
|
+
interface Internal {
|
|
207
|
+
/**
|
|
208
|
+
* Returns an audit log object for the guild. Requires the 'VIEW_AUDIT_LOG' permission.
|
|
209
|
+
* @see https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
|
|
210
|
+
*/
|
|
211
|
+
getGuildAuditLog(guildId: snowflake, params?: AuditLog.GetParams): Promise<AuditLog>
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
Internal.define({
|
|
216
|
+
'/guilds/{guild.id}/audit-logs': {
|
|
217
|
+
GET: 'getGuildAuditLog',
|
|
218
|
+
},
|
|
219
|
+
})
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { integer, Internal, snowflake } from '.'
|
|
2
|
+
|
|
3
|
+
/** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure */
|
|
4
|
+
export interface AutoModerationRule {
|
|
5
|
+
/** the id of this rule */
|
|
6
|
+
id: snowflake
|
|
7
|
+
/** the id of the guild which this rule belongs to */
|
|
8
|
+
guild_id: snowflake
|
|
9
|
+
/** the rule name */
|
|
10
|
+
name: string
|
|
11
|
+
/** the user which first created this rule */
|
|
12
|
+
creator_id: snowflake
|
|
13
|
+
/** the rule event type */
|
|
14
|
+
event_type: AutoModerationRule.EventType
|
|
15
|
+
/** the rule trigger type */
|
|
16
|
+
trigger_type: AutoModerationRule.TriggerType
|
|
17
|
+
/** the rule trigger metadata */
|
|
18
|
+
trigger_metadata: AutoModerationRule.TriggerMetadata
|
|
19
|
+
/** the actions which will execute when the rule is triggered */
|
|
20
|
+
actions: AutoModerationAction[]
|
|
21
|
+
/** whether the rule is enabled */
|
|
22
|
+
enabled: boolean
|
|
23
|
+
/** the role ids that should not be affected by the rule (Maximum of 20) */
|
|
24
|
+
exempt_roles: snowflake[]
|
|
25
|
+
/** the channel ids that should not be affected by the rule (Maximum of 50) */
|
|
26
|
+
exempt_channels: snowflake[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export namespace AutoModerationRule {
|
|
30
|
+
/**
|
|
31
|
+
* Indicates in what event context a rule should be checked.
|
|
32
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
|
|
33
|
+
*/
|
|
34
|
+
export const enum EventType {
|
|
35
|
+
/** when a member sends or edits a message in the guild */
|
|
36
|
+
MESSAGE_SEND = 1,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Characterizes the type of content which can trigger the rule.
|
|
41
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types
|
|
42
|
+
*/
|
|
43
|
+
export const enum TriggerType {
|
|
44
|
+
/** check if content contains words from a user defined list of keywords (max per guild: 3) */
|
|
45
|
+
KEYWORD = 1,
|
|
46
|
+
/** check if content represents generic spam (max per guild: 1) */
|
|
47
|
+
SPAM = 3,
|
|
48
|
+
/** check if content contains words from internal pre-defined wordsets (max per guild: 1) */
|
|
49
|
+
KEYWORD_PRESET = 4,
|
|
50
|
+
/** check if content contains more unique mentions than allowed (max per guild: 1) */
|
|
51
|
+
MENTION_SPAM = 5,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Additional data used to determine whether a rule should be triggered.
|
|
56
|
+
* Different fields are relevant based on the value of trigger_type.
|
|
57
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata
|
|
58
|
+
*/
|
|
59
|
+
export interface TriggerMetadata {
|
|
60
|
+
/** associated with `KEYWORD`: substrings which will be searched for in content */
|
|
61
|
+
keyword_filter: string[]
|
|
62
|
+
/** regular expression patterns which will be matched against content (Maximum of 10) */
|
|
63
|
+
regex_patterns: string[]
|
|
64
|
+
/** associated with `KEYWORD_PRESET`: the internally pre-defined wordsets which will be searched for in content */
|
|
65
|
+
presets: KeywordPresetType[]
|
|
66
|
+
/** associated with `KEYWORD_PRESET`: substrings which will be exempt from triggering the preset trigger type */
|
|
67
|
+
allow_list: string[]
|
|
68
|
+
/** associated with `MENTION_SPAM`: total number of unique role and user mentions allowed per message (Maximum of 50) */
|
|
69
|
+
mention_total_limit: integer
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types */
|
|
73
|
+
export const enum KeywordPresetType {
|
|
74
|
+
/** Words that may be considered forms of swearing or cursing */
|
|
75
|
+
PROFANITY = 1,
|
|
76
|
+
/** Words that refer to sexually explicit behavior or activity */
|
|
77
|
+
SEXUAL_CONTEN = 2,
|
|
78
|
+
/** Personal insults or words that may be considered hate speech */
|
|
79
|
+
SLURS = 3,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** @see https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule-json-params */
|
|
83
|
+
export interface CreateParams {
|
|
84
|
+
/** the rule name */
|
|
85
|
+
name: string
|
|
86
|
+
/** the event type */
|
|
87
|
+
event_type: EventType
|
|
88
|
+
/** the trigger type */
|
|
89
|
+
trigger_type: TriggerType
|
|
90
|
+
/** the trigger metadata */
|
|
91
|
+
trigger_metadata?: TriggerMetadata
|
|
92
|
+
/** the actions which will execute when the rule is triggered */
|
|
93
|
+
actions: AutoModerationAction[]
|
|
94
|
+
/** whether the rule is enabled (False by default) */
|
|
95
|
+
enabled?: boolean
|
|
96
|
+
/** the role ids that should not be affected by the rule (Maximum of 20) */
|
|
97
|
+
exempt_roles?: snowflake[]
|
|
98
|
+
/** the channel ids that should not be affected by the rule (Maximum of 50) */
|
|
99
|
+
exempt_channels?: snowflake[]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure */
|
|
104
|
+
export interface AutoModerationAction {
|
|
105
|
+
/** the type of action */
|
|
106
|
+
type: AutoModerationAction.Type
|
|
107
|
+
/** additional metadata needed during execution for this specific action type */
|
|
108
|
+
metadata?: AutoModerationAction.Metadata
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export namespace AutoModerationAction {
|
|
112
|
+
/** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types */
|
|
113
|
+
export const enum Type {
|
|
114
|
+
/** blocks the content of a message according to the rule */
|
|
115
|
+
BLOCK_MESSAGE = 1,
|
|
116
|
+
/** logs user content to a specified channel */
|
|
117
|
+
SEND_ALERT_MESSAGE = 2,
|
|
118
|
+
/**
|
|
119
|
+
* timeout user for a specified duration
|
|
120
|
+
*
|
|
121
|
+
* A `TIMEOUT` action can only be set up for `KEYWORD` and `MENTION_SPAM` rules.
|
|
122
|
+
* The `MODERATE_MEMBERS` permission is required to use the `TIMEOUT` action type.)
|
|
123
|
+
*/
|
|
124
|
+
TIMEOUT = 3,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata */
|
|
128
|
+
export interface Metadata {
|
|
129
|
+
/**
|
|
130
|
+
* associated with `SEND_ALERT_MESSAGE`:
|
|
131
|
+
* channel to which user content should be logged
|
|
132
|
+
*/
|
|
133
|
+
channel_id?: snowflake
|
|
134
|
+
/**
|
|
135
|
+
* associated with `TIMEOUT`:
|
|
136
|
+
* timeout duration in seconds, maximum of 2419200 seconds (4 weeks)
|
|
137
|
+
*/
|
|
138
|
+
duration_seconds?: integer
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
declare module './internal' {
|
|
143
|
+
interface Internal {
|
|
144
|
+
/**
|
|
145
|
+
* Get a list of all rules currently configured for the guild.
|
|
146
|
+
* Returns a list of auto moderation rule objects for the given guild.
|
|
147
|
+
* This endpoint requires the `MANAGE_GUILD` permission.
|
|
148
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
|
|
149
|
+
*/
|
|
150
|
+
listAutoModerationRules(guildId: snowflake): Promise<AutoModerationRule[]>
|
|
151
|
+
/**
|
|
152
|
+
* Get a single rule. Returns an auto moderation rule object.
|
|
153
|
+
* This endpoint requires the `MANAGE_GUILD` permission.
|
|
154
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
|
|
155
|
+
*/
|
|
156
|
+
getAutoModerationRule(guildId: snowflake, ruleId: snowflake): Promise<AutoModerationRule>
|
|
157
|
+
/**
|
|
158
|
+
* Create a new rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Create Gateway event.
|
|
159
|
+
* This endpoint requires the `MANAGE_GUILD` permission.
|
|
160
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
|
|
161
|
+
*/
|
|
162
|
+
createAutoModerationRule(guildId: snowflake, data: AutoModerationRule.CreateParams): Promise<AutoModerationRule>
|
|
163
|
+
/**
|
|
164
|
+
* Modify an existing rule. Returns an auto moderation rule on success.
|
|
165
|
+
* Fires an Auto Moderation Rule Update Gateway event.
|
|
166
|
+
* This endpoint requires the `MANAGE_GUILD` permission.
|
|
167
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
|
|
168
|
+
*/
|
|
169
|
+
modifyAutoModerationRule(guildId: snowflake, ruleId: snowflake, data: Partial<AutoModerationRule.CreateParams>): Promise<AutoModerationRule>
|
|
170
|
+
/**
|
|
171
|
+
* Delete a rule. Returns a 204 on success. Fires an Auto Moderation Rule Delete Gateway event.
|
|
172
|
+
* This endpoint requires the `MANAGE_GUILD` permission.
|
|
173
|
+
* @see https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
|
|
174
|
+
*/
|
|
175
|
+
deleteAutoModerationRule(guildId: snowflake, ruleId: snowflake): Promise<void>
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Internal.define({
|
|
180
|
+
'/guilds/{guild.id}/auto-moderation/rules': {
|
|
181
|
+
GET: 'listAutoModerationRules',
|
|
182
|
+
POST: 'createAutoModerationRule',
|
|
183
|
+
},
|
|
184
|
+
'/guilds/{guild.id}/auto-moderation/rules/{rule.id}': {
|
|
185
|
+
GET: 'getAutoModerationRule',
|
|
186
|
+
PATCH: 'modifyAutoModerationRule',
|
|
187
|
+
DELETE: 'deleteAutoModerationRule',
|
|
188
|
+
},
|
|
189
|
+
})
|
package/src/types/ban.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { integer, Internal, snowflake, User } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/guild#ban-object-ban-structure */
|
|
4
|
+
export interface Ban {
|
|
5
|
+
/** the reason for the ban */
|
|
6
|
+
reason?: string
|
|
7
|
+
/** the banned user */
|
|
8
|
+
user: User
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export namespace Ban {
|
|
12
|
+
export namespace Event {
|
|
13
|
+
/** https://discord.com/developers/docs/topics/gateway-events#guild-ban-add-guild-ban-add-event-fields */
|
|
14
|
+
export interface Add {
|
|
15
|
+
/** id of the guild */
|
|
16
|
+
guild_id: snowflake
|
|
17
|
+
/** the banned user */
|
|
18
|
+
user: User
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** https://discord.com/developers/docs/topics/gateway-events#guild-ban-remove-guild-ban-remove-event-fields */
|
|
22
|
+
export interface Remove {
|
|
23
|
+
/** id of the guild */
|
|
24
|
+
guild_id: snowflake
|
|
25
|
+
/** the unbanned user */
|
|
26
|
+
user: User
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** @see https://discord.com/developers/docs/resources/guild#get-guild-bans-query-string-params */
|
|
31
|
+
export interface GetParams {
|
|
32
|
+
/** number of users to return (up to maximum 1000) */
|
|
33
|
+
limit?: number
|
|
34
|
+
/** consider only users before given user id */
|
|
35
|
+
before?: snowflake
|
|
36
|
+
/** consider only users after given user id */
|
|
37
|
+
after?: snowflake
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** @see https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params */
|
|
41
|
+
export interface CreateParams {
|
|
42
|
+
/** number of days to delete messages for (0-7) (deprecated) */
|
|
43
|
+
delete_message_days?: integer
|
|
44
|
+
/** number of seconds to delete messages for, between 0 and 604800 (7 days) */
|
|
45
|
+
delete_message_seconds?: integer
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare module './gateway' {
|
|
50
|
+
interface GatewayEvents {
|
|
51
|
+
/** user was banned from a guild */
|
|
52
|
+
GUILD_BAN_ADD: Ban.Event.Add
|
|
53
|
+
/** user was unbanned from a guild */
|
|
54
|
+
GUILD_BAN_REMOVE: Ban.Event.Remove
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare module './internal' {
|
|
59
|
+
interface Internal {
|
|
60
|
+
/**
|
|
61
|
+
* Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission.
|
|
62
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-bans
|
|
63
|
+
*/
|
|
64
|
+
getGuildBans(guild_id: snowflake, params: Ban.GetParams): Promise<Ban[]>
|
|
65
|
+
/**
|
|
66
|
+
* Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.
|
|
67
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-ban
|
|
68
|
+
*/
|
|
69
|
+
getGuildBan(guild_id: snowflake, user_id: snowflake): Promise<Ban>
|
|
70
|
+
/**
|
|
71
|
+
* Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BAN_MEMBERS permission. Returns a 204 empty response on success. Fires a Guild Ban Add Gateway event.
|
|
72
|
+
* @see https://discord.com/developers/docs/resources/guild#create-guild-ban
|
|
73
|
+
*/
|
|
74
|
+
createGuildBan(guild_id: snowflake, user_id: snowflake, params?: Ban.CreateParams): Promise<void>
|
|
75
|
+
/**
|
|
76
|
+
* Remove the ban for a user. Requires the BAN_MEMBERS permissions. Returns a 204 empty response on success. Fires a Guild Ban Remove Gateway event.
|
|
77
|
+
* @see https://discord.com/developers/docs/resources/guild#remove-guild-ban
|
|
78
|
+
*/
|
|
79
|
+
removeGuildBan(guild_id: snowflake, user_id: snowflake): Promise<void>
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Internal.define({
|
|
84
|
+
'/guilds/{guild.id}/bans': {
|
|
85
|
+
GET: 'getGuildBans',
|
|
86
|
+
},
|
|
87
|
+
'/guilds/{guild.id}/bans/{user.id}': {
|
|
88
|
+
GET: 'getGuildBan',
|
|
89
|
+
PUT: 'createGuildBan',
|
|
90
|
+
DELETE: 'removeGuildBan',
|
|
91
|
+
},
|
|
92
|
+
})
|