@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,98 @@
|
|
|
1
|
+
import { integer, Internal, snowflake } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure */
|
|
4
|
+
export interface StageInstance {
|
|
5
|
+
/** The id of this Stage instance */
|
|
6
|
+
id: snowflake
|
|
7
|
+
/** The guild id of the associated Stage channel */
|
|
8
|
+
guild_id: snowflake
|
|
9
|
+
/** The id of the associated Stage channel */
|
|
10
|
+
channel_id: snowflake
|
|
11
|
+
/** The topic of the Stage instance (1-120 characters) */
|
|
12
|
+
topic: string
|
|
13
|
+
/** The privacy level of the Stage instance */
|
|
14
|
+
privacy_level: integer
|
|
15
|
+
/** Whether or not Stage Discovery is disabled */
|
|
16
|
+
discoverable_disabled: boolean
|
|
17
|
+
/** The id of the scheduled event for this Stage instance */
|
|
18
|
+
guild_scheduled_event_id?: snowflake
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export namespace StageInstance {
|
|
22
|
+
export namespace Event {
|
|
23
|
+
export interface Create extends StageInstance {}
|
|
24
|
+
|
|
25
|
+
export interface Delete extends StageInstance {}
|
|
26
|
+
|
|
27
|
+
export interface Update extends StageInstance {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export namespace Params {
|
|
31
|
+
/** https://discord.com/developers/docs/resources/stage-instance#create-stage-instance-json-params */
|
|
32
|
+
export interface Create {
|
|
33
|
+
/** The id of the Stage channel */
|
|
34
|
+
channel_id: snowflake
|
|
35
|
+
/** The topic of the Stage instance (1-120 characters) */
|
|
36
|
+
topic: string
|
|
37
|
+
/** The privacy level of the Stage instance (default GUILD_ONLY) */
|
|
38
|
+
privacy_level?: integer
|
|
39
|
+
/** Notify @everyone that a Stage instance has started */
|
|
40
|
+
send_start_notification?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance-json-params */
|
|
44
|
+
export interface Modify {
|
|
45
|
+
/** The topic of the Stage instance (1-120 characters) */
|
|
46
|
+
topic?: string
|
|
47
|
+
/** The privacy level of the Stage instance */
|
|
48
|
+
privacy_level?: integer
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module './gateway' {
|
|
54
|
+
interface GatewayEvents {
|
|
55
|
+
/** stage instance was created */
|
|
56
|
+
STAGE_INSTANCE_CREATE: StageInstance.Event.Create
|
|
57
|
+
/** stage instance was deleted or closed */
|
|
58
|
+
STAGE_INSTANCE_DELETE: StageInstance.Event.Delete
|
|
59
|
+
/** stage instance was updated */
|
|
60
|
+
STAGE_INSTANCE_UPDATE: StageInstance.Event.Update
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare module './internal' {
|
|
65
|
+
interface Internal {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new Stage instance associated to a Stage channel.
|
|
68
|
+
* @see https://discord.com/developers/docs/resources/stage-instance#create-stage-instance
|
|
69
|
+
*/
|
|
70
|
+
createStageInstance(params: StageInstance.Params.Create): Promise<StageInstance>
|
|
71
|
+
/**
|
|
72
|
+
* Gets the stage instance associated with the Stage channel, if it exists.
|
|
73
|
+
* @see https://discord.com/developers/docs/resources/stage-instance#get-stage-instance
|
|
74
|
+
*/
|
|
75
|
+
getStageInstance(channel_id: snowflake): Promise<StageInstance>
|
|
76
|
+
/**
|
|
77
|
+
* Updates fields of an existing Stage instance.
|
|
78
|
+
* @see https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance
|
|
79
|
+
*/
|
|
80
|
+
modifyStageInstance(channel_id: snowflake, params: StageInstance.Params.Modify): Promise<StageInstance>
|
|
81
|
+
/**
|
|
82
|
+
* Deletes the Stage instance.
|
|
83
|
+
* @see https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance
|
|
84
|
+
*/
|
|
85
|
+
deleteStageInstance(channel_id: snowflake): Promise<void>
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Internal.define({
|
|
90
|
+
'/stage-instances': {
|
|
91
|
+
POST: 'createStageInstance',
|
|
92
|
+
},
|
|
93
|
+
'/stage-instances/{channel.id}': {
|
|
94
|
+
GET: 'getStageInstance',
|
|
95
|
+
PATCH: 'modifyStageInstance',
|
|
96
|
+
DELETE: 'deleteStageInstance',
|
|
97
|
+
},
|
|
98
|
+
})
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { integer, Internal, snowflake, User } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure */
|
|
4
|
+
export interface Sticker {
|
|
5
|
+
/** id of the sticker */
|
|
6
|
+
id: snowflake
|
|
7
|
+
/** for standard stickers, id of the pack the sticker is from */
|
|
8
|
+
pack_id?: snowflake
|
|
9
|
+
/** name of the sticker */
|
|
10
|
+
name: string
|
|
11
|
+
/** description of the sticker */
|
|
12
|
+
description?: string
|
|
13
|
+
/** autocomplete/suggestion tags for the sticker (max 200 characters) */
|
|
14
|
+
tags: string
|
|
15
|
+
/** Deprecated previously the sticker asset hash, now an empty string */
|
|
16
|
+
asset?: string
|
|
17
|
+
/** type of sticker */
|
|
18
|
+
type: Sticker.Type
|
|
19
|
+
/** type of sticker format */
|
|
20
|
+
format_type: Sticker.FormatType
|
|
21
|
+
/** whether this guild sticker can be used, may be false due to loss of Server Boosts */
|
|
22
|
+
available?: boolean
|
|
23
|
+
/** id of the guild that owns this sticker */
|
|
24
|
+
guild_id?: snowflake
|
|
25
|
+
/** the user that uploaded the guild sticker */
|
|
26
|
+
user?: User
|
|
27
|
+
/** the standard sticker's sort order within its pack */
|
|
28
|
+
sort_value?: integer
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export namespace Sticker {
|
|
32
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types */
|
|
33
|
+
export enum Type {
|
|
34
|
+
/** an official sticker in a pack, part of Nitro or in a removed purchasable pack */
|
|
35
|
+
STANDARD = 1,
|
|
36
|
+
/** a sticker uploaded to a Boosted guild for the guild's members */
|
|
37
|
+
GUILD = 2,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types */
|
|
41
|
+
export enum FormatType {
|
|
42
|
+
PNG = 1,
|
|
43
|
+
APNG = 2,
|
|
44
|
+
LOTTIE = 3,
|
|
45
|
+
GIF = 4
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure */
|
|
49
|
+
export interface Item {
|
|
50
|
+
/** id of the sticker */
|
|
51
|
+
id: snowflake
|
|
52
|
+
/** name of the sticker */
|
|
53
|
+
name: string
|
|
54
|
+
/** type of sticker format */
|
|
55
|
+
format_type: FormatType
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure */
|
|
59
|
+
export interface Pack {
|
|
60
|
+
/** id of the sticker pack */
|
|
61
|
+
id: snowflake
|
|
62
|
+
/** the stickers in the pack */
|
|
63
|
+
stickers: Sticker[]
|
|
64
|
+
/** name of the sticker pack */
|
|
65
|
+
name: string
|
|
66
|
+
/** id of the pack's SKU */
|
|
67
|
+
sku_id: snowflake
|
|
68
|
+
/** id of a sticker in the pack which is shown as the pack's icon */
|
|
69
|
+
cover_sticker_id?: snowflake
|
|
70
|
+
/** description of the sticker pack */
|
|
71
|
+
description: string
|
|
72
|
+
/** id of the sticker pack's banner image */
|
|
73
|
+
banner_asset_id: snowflake
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export namespace Event {
|
|
77
|
+
/** https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update-guild-stickers-update-event-fields */
|
|
78
|
+
export interface Update {
|
|
79
|
+
/** id of the guild */
|
|
80
|
+
guild_id: snowflake
|
|
81
|
+
/** array of stickers */
|
|
82
|
+
stickers: Sticker[]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs-response-structure */
|
|
87
|
+
export interface PackResult {
|
|
88
|
+
sticker_packs: Pack[]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export namespace Params {
|
|
92
|
+
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker-form-params */
|
|
93
|
+
export interface Create {
|
|
94
|
+
/** name of the sticker (2-30 characters) */
|
|
95
|
+
name: string
|
|
96
|
+
/** description of the sticker (empty or 2-100 characters) */
|
|
97
|
+
description: string
|
|
98
|
+
/** autocomplete/suggestion tags for the sticker (max 200 characters) */
|
|
99
|
+
tags: string
|
|
100
|
+
/** the sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KB */
|
|
101
|
+
file: any
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker-json-params */
|
|
105
|
+
export interface Modify {
|
|
106
|
+
/** name of the sticker (2-30 characters) */
|
|
107
|
+
name: string
|
|
108
|
+
/** description of the sticker (2-100 characters) */
|
|
109
|
+
description?: string
|
|
110
|
+
/** autocomplete/suggestion tags for the sticker (max 200 characters) */
|
|
111
|
+
tags: string
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare module './gateway' {
|
|
117
|
+
interface GatewayEvents {
|
|
118
|
+
/** guild stickers were updated */
|
|
119
|
+
GUILD_STICKERS_UPDATE: Sticker.Event.Update
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare module './internal' {
|
|
124
|
+
interface Internal {
|
|
125
|
+
/**
|
|
126
|
+
* Returns a sticker object for the given sticker ID.
|
|
127
|
+
* @see https://discord.com/developers/docs/resources/sticker#get-sticker
|
|
128
|
+
*/
|
|
129
|
+
getSticker(sticker_id: snowflake): Promise<Sticker>
|
|
130
|
+
/**
|
|
131
|
+
* Returns the list of sticker packs available to Nitro subscribers.
|
|
132
|
+
* @see https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs
|
|
133
|
+
*/
|
|
134
|
+
listNitroStickerPacks(): Promise<Sticker.PackResult>
|
|
135
|
+
/**
|
|
136
|
+
* Returns an array of sticker objects for the given guild. Includes user fields if the bot has the MANAGE_EMOJIS_AND_STICKERS permission.
|
|
137
|
+
* @see https://discord.com/developers/docs/resources/sticker#list-guild-stickers
|
|
138
|
+
*/
|
|
139
|
+
listGuildStickers(guild_id: snowflake): Promise<Sticker[]>
|
|
140
|
+
/**
|
|
141
|
+
* Returns a sticker object for the given guild and sticker IDs. Includes the user field if the bot has the MANAGE_EMOJIS_AND_STICKERS permission.
|
|
142
|
+
* @see https://discord.com/developers/docs/resources/sticker#get-guild-sticker
|
|
143
|
+
*/
|
|
144
|
+
getGuildSticker(guild_id: snowflake, sticker_id: snowflake): Promise<Sticker>
|
|
145
|
+
/**
|
|
146
|
+
* Create a new sticker for the guild. Send a multipart/form-data body. Requires the MANAGE_EMOJIS_AND_STICKERS permission. Returns the new sticker object on success.
|
|
147
|
+
* @see https://discord.com/developers/docs/resources/sticker#create-guild-sticker
|
|
148
|
+
*/
|
|
149
|
+
createGuildSticker(guild_id: snowflake, params: Sticker.Params.Create): Promise<Sticker>
|
|
150
|
+
/**
|
|
151
|
+
* Modify the given sticker. Requires the MANAGE_EMOJIS_AND_STICKERS permission. Returns the updated sticker object on success.
|
|
152
|
+
* @see https://discord.com/developers/docs/resources/sticker#modify-guild-sticker
|
|
153
|
+
*/
|
|
154
|
+
modifyGuildSticker(guild_id: snowflake, sticker_id: snowflake, params: Sticker.Params.Modify): Promise<Sticker>
|
|
155
|
+
/**
|
|
156
|
+
* Delete the given sticker. Requires the MANAGE_EMOJIS_AND_STICKERS permission. Returns 204 No Content on success.
|
|
157
|
+
* @see https://discord.com/developers/docs/resources/sticker#delete-guild-sticker
|
|
158
|
+
*/
|
|
159
|
+
deleteGuildSticker(guild_id: snowflake, sticker_id: snowflake): Promise<void>
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
Internal.define({
|
|
164
|
+
'/stickers/{sticker.id}': {
|
|
165
|
+
GET: 'getSticker',
|
|
166
|
+
},
|
|
167
|
+
'/sticker-packs': {
|
|
168
|
+
GET: 'listNitroStickerPacks',
|
|
169
|
+
},
|
|
170
|
+
'/guilds/{guild.id}/stickers': {
|
|
171
|
+
GET: 'listGuildStickers',
|
|
172
|
+
POST: 'createGuildSticker',
|
|
173
|
+
},
|
|
174
|
+
'/guilds/{guild.id}/stickers/{sticker.id}': {
|
|
175
|
+
GET: 'getGuildSticker',
|
|
176
|
+
PATCH: 'modifyGuildSticker',
|
|
177
|
+
DELETE: 'deleteGuildSticker',
|
|
178
|
+
},
|
|
179
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { snowflake, User } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-team-object */
|
|
4
|
+
export interface Team {
|
|
5
|
+
/** a hash of the image of the team's icon */
|
|
6
|
+
icon?: string
|
|
7
|
+
/** the unique id of the team */
|
|
8
|
+
id: snowflake
|
|
9
|
+
/** the members of the team */
|
|
10
|
+
members: TeamMember[]
|
|
11
|
+
/** the name of the team */
|
|
12
|
+
name: string
|
|
13
|
+
/** the user id of the current team owner */
|
|
14
|
+
owner_user_id: snowflake
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-team-member-object */
|
|
18
|
+
export interface TeamMember {
|
|
19
|
+
/** the user's membership state on the team */
|
|
20
|
+
membership_state: MembershipState
|
|
21
|
+
/** will always be ["*"] */
|
|
22
|
+
permissions: string[]
|
|
23
|
+
/** the id of the parent team of which they are a member */
|
|
24
|
+
team_id: snowflake
|
|
25
|
+
/** the avatar, discriminator, id, and username of the user */
|
|
26
|
+
user: Partial<User>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */
|
|
30
|
+
export enum MembershipState {
|
|
31
|
+
INVITED = 1,
|
|
32
|
+
ACCEPTED = 2,
|
|
33
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { AllowedMentions, Attachment, Channel, Component, Embed, GuildMember, integer, Internal, snowflake, timestamp } from '.'
|
|
2
|
+
|
|
3
|
+
declare module './channel' {
|
|
4
|
+
interface Channel {
|
|
5
|
+
/** an approximate count of messages in a thread, stops counting at 50 */
|
|
6
|
+
message_count?: integer
|
|
7
|
+
/** an approximate count of users in a thread, stops counting at 50 */
|
|
8
|
+
member_count?: integer
|
|
9
|
+
/** thread-specific fields not needed by other channels */
|
|
10
|
+
thread_metadata?: ThreadMetadata
|
|
11
|
+
/** thread member object for the current user, if they have joined the thread, only included on certain API endpoints */
|
|
12
|
+
member?: ThreadMember
|
|
13
|
+
/** default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
14
|
+
default_auto_archive_duration?: integer
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure */
|
|
19
|
+
export interface ThreadMember {
|
|
20
|
+
/** the id of the thread */
|
|
21
|
+
id?: snowflake
|
|
22
|
+
/** the id of the user */
|
|
23
|
+
user_id?: snowflake
|
|
24
|
+
/** the time the current user last joined the thread */
|
|
25
|
+
join_timestamp: timestamp
|
|
26
|
+
/** any user-thread settings, currently only used for notifications */
|
|
27
|
+
flags: integer
|
|
28
|
+
/** additional information about the user */
|
|
29
|
+
member?: GuildMember
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure */
|
|
33
|
+
export interface ThreadMetadata {
|
|
34
|
+
/** whether the thread is archived */
|
|
35
|
+
archived: boolean
|
|
36
|
+
/** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
37
|
+
auto_archive_duration: integer
|
|
38
|
+
/** timestamp when the thread's archive status was last changed, used for calculating recent activity */
|
|
39
|
+
archive_timestamp: timestamp
|
|
40
|
+
/** whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it */
|
|
41
|
+
locked: boolean
|
|
42
|
+
/** whether non-moderators can add other non-moderators to a thread; only available on private threads */
|
|
43
|
+
invitable?: boolean
|
|
44
|
+
/** timestamp when the thread was created; only populated for threads created after 2022-01-09 */
|
|
45
|
+
create_timestamp?: timestamp
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** @see https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
|
|
49
|
+
export interface ListActiveGuildThreadsResult {
|
|
50
|
+
/** the active threads */
|
|
51
|
+
threads: Channel[]
|
|
52
|
+
/** a thread member object for each returned thread the current user has joined */
|
|
53
|
+
members: ThreadMember[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface Thread extends Channel {}
|
|
57
|
+
|
|
58
|
+
export namespace Thread {
|
|
59
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
|
|
60
|
+
export interface StartFromMessageParams {
|
|
61
|
+
/** 1-100 character channel name */
|
|
62
|
+
name: string
|
|
63
|
+
/** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
64
|
+
auto_archive_duration?: integer
|
|
65
|
+
/** amount of seconds a user has to wait before sending another message (0-21600) */
|
|
66
|
+
rate_limit_per_user?: integer
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message-json-params */
|
|
70
|
+
export interface StartWithoutMessageParams {
|
|
71
|
+
/** 1-100 character channel name */
|
|
72
|
+
name: string
|
|
73
|
+
/** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
74
|
+
auto_archive_duration?: integer
|
|
75
|
+
/** the type of thread to create */
|
|
76
|
+
type?: integer
|
|
77
|
+
/** whether non-moderators can add other non-moderators to a thread; only available when creating a private thread */
|
|
78
|
+
invitable?: boolean
|
|
79
|
+
/** amount of seconds a user has to wait before sending another message (0-21600) */
|
|
80
|
+
rate_limit_per_user?: integer
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel-forum-thread-message-params-object */
|
|
84
|
+
export interface StartThreadInFormChannelParams {
|
|
85
|
+
/** 1-100 character channel name */
|
|
86
|
+
name: string
|
|
87
|
+
/** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
|
88
|
+
auto_archive_duration?: integer
|
|
89
|
+
/** amount of seconds a user has to wait before sending another message (0-21600) */
|
|
90
|
+
rate_limit_per_user?: integer
|
|
91
|
+
/** contents of the first message in the forum thread */
|
|
92
|
+
message: FormThreadMessageParams
|
|
93
|
+
/** the IDs of the set of tags that have been applied to a thread in a GUILD_FORUM channel */
|
|
94
|
+
applied_tags?: snowflake[]
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel-forum-thread-message-params-object */
|
|
98
|
+
export interface FormThreadMessageParams {
|
|
99
|
+
/** Message contents (up to 2000 characters) */
|
|
100
|
+
content?: string
|
|
101
|
+
/** Embedded rich content (up to 6000 characters) */
|
|
102
|
+
embeds?: Embed[]
|
|
103
|
+
/** Allowed mentions for the message */
|
|
104
|
+
allowed_mentions?: AllowedMentions
|
|
105
|
+
/** Components to include with the message */
|
|
106
|
+
components?: Component[]
|
|
107
|
+
/** IDs of up to 3 stickers in the server to send in the message */
|
|
108
|
+
sticker_ids?: snowflake[]
|
|
109
|
+
/** Contents of the file being sent. */
|
|
110
|
+
files: any[]
|
|
111
|
+
/** JSON-encoded body of non-file params, only for multipart/form-data requests. */
|
|
112
|
+
payload_json?: string
|
|
113
|
+
/** Attachment objects with filename and description. */
|
|
114
|
+
attachments?: Partial<Attachment>[]
|
|
115
|
+
/** Message flags combined as a bitfield (only SUPPRESS_EMBEDS can be set) */
|
|
116
|
+
flags?: integer
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** https://discord.com/developers/docs/resources/channel#list-active-threads-response-body */
|
|
120
|
+
export interface List {
|
|
121
|
+
/** the active threads */
|
|
122
|
+
threads: Channel[]
|
|
123
|
+
/** a thread member object for each returned thread the current user has joined */
|
|
124
|
+
members: ThreadMember[]
|
|
125
|
+
/** whether there are potentially additional threads that could be returned on a subsequent call */
|
|
126
|
+
has_more: boolean
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** https://discord.com/developers/docs/resources/channel#list-public-archived-threads-query-string-params */
|
|
130
|
+
export interface ListPublicArchivedParams {
|
|
131
|
+
/** returns threads before this timestamp */
|
|
132
|
+
before?: timestamp
|
|
133
|
+
/** optional maximum number of threads to return */
|
|
134
|
+
limit?: integer
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** https://discord.com/developers/docs/resources/channel#list-private-archived-threads-query-string-params */
|
|
138
|
+
export interface ListPrivateArchivedParams {
|
|
139
|
+
/** returns threads before this timestamp */
|
|
140
|
+
before?: timestamp
|
|
141
|
+
/** optional maximum number of threads to return */
|
|
142
|
+
limit?: integer
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads-query-string-params */
|
|
146
|
+
export interface ListJoinedPrivateArchivedParams {
|
|
147
|
+
/** returns threads before this id */
|
|
148
|
+
before?: snowflake
|
|
149
|
+
/** optional maximum number of threads to return */
|
|
150
|
+
limit?: integer
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export namespace Event {
|
|
154
|
+
/** https://discord.com/developers/docs/topics/gateway-events#thread-list-sync-thread-list-sync-event-fields */
|
|
155
|
+
export interface ListSync {
|
|
156
|
+
/** the id of the guild */
|
|
157
|
+
guild_id: snowflake
|
|
158
|
+
/** the parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data. */
|
|
159
|
+
channel_ids?: snowflake[]
|
|
160
|
+
/** all active threads in the given channels that the current user can access */
|
|
161
|
+
threads: Channel[]
|
|
162
|
+
/** all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to */
|
|
163
|
+
members: ThreadMember[]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface MemberUpdate extends ThreadMember {}
|
|
167
|
+
|
|
168
|
+
/** https://discord.com/developers/docs/topics/gateway-events#thread-members-update-thread-members-update-event-fields */
|
|
169
|
+
export interface MembersUpdate {
|
|
170
|
+
/** the id of the thread */
|
|
171
|
+
id: snowflake
|
|
172
|
+
/** the id of the guild */
|
|
173
|
+
guild_id: snowflake
|
|
174
|
+
/** the approximate number of members in the thread, capped at 50 */
|
|
175
|
+
member_count: integer
|
|
176
|
+
/** the users who were added to the thread */
|
|
177
|
+
added_members?: ThreadMember[]
|
|
178
|
+
/** the id of the users who were removed from the thread */
|
|
179
|
+
removed_member_ids?: snowflake[]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
declare module './gateway' {
|
|
185
|
+
interface GatewayEvents {
|
|
186
|
+
/** sent when gaining access to a channel, contains all active threads in that channel */
|
|
187
|
+
THREAD_LIST_SYNC: Thread.Event.ListSync
|
|
188
|
+
/** thread member for the current user was updated */
|
|
189
|
+
THREAD_MEMBER_UPDATE: Thread.Event.MemberUpdate
|
|
190
|
+
/** some user(s) were added to or removed from a thread */
|
|
191
|
+
THREAD_MEMBERS_UPDATE: Thread.Event.MembersUpdate
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare module './internal' {
|
|
196
|
+
interface Internal {
|
|
197
|
+
/**
|
|
198
|
+
* Returns all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.
|
|
199
|
+
* @see https://discord.com/developers/docs/resources/guild#list-active-guild-threads
|
|
200
|
+
*/
|
|
201
|
+
listActiveGuildThreads(guild_id: snowflake): Promise<ListActiveGuildThreadsResult>
|
|
202
|
+
/**
|
|
203
|
+
* Creates a new thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.
|
|
204
|
+
* @see https://discord.com/developers/docs/resources/channel#start-thread-from-message
|
|
205
|
+
*/
|
|
206
|
+
startThreadFromMessage(channel_id: snowflake, message_id: snowflake, params: Thread.StartFromMessageParams): Promise<Channel>
|
|
207
|
+
/**
|
|
208
|
+
* Creates a new thread in a forum channel, and sends a message within the created thread. Returns a channel, with a nested message object, on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create and Message Create Gateway event.
|
|
209
|
+
* @see https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel
|
|
210
|
+
*/
|
|
211
|
+
startThreadInForumChannel(channel_id: snowflake, params: Thread.StartThreadInFormChannelParams): Promise<Channel>
|
|
212
|
+
/**
|
|
213
|
+
* Creates a new thread that is not connected to an existing message. The created thread defaults to a GUILD_PRIVATE_THREAD*. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.
|
|
214
|
+
* @see https://discord.com/developers/docs/resources/channel#start-thread-without-message
|
|
215
|
+
*/
|
|
216
|
+
startThreadWithoutMessage(channel_id: snowflake, params: Thread.StartWithoutMessageParams): Promise<Channel>
|
|
217
|
+
/**
|
|
218
|
+
* Adds the current user to a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.
|
|
219
|
+
* @see https://discord.com/developers/docs/resources/channel#join-thread
|
|
220
|
+
*/
|
|
221
|
+
joinThread(channel_id: snowflake): Promise<void>
|
|
222
|
+
/**
|
|
223
|
+
* Adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns a 204 empty response if the member is successfully added or was already a member of the thread. Fires a Thread Members Update Gateway event.
|
|
224
|
+
* @see https://discord.com/developers/docs/resources/channel#add-thread-member
|
|
225
|
+
*/
|
|
226
|
+
addThreadMember(channel_id: snowflake, user_id: snowflake): Promise<void>
|
|
227
|
+
/**
|
|
228
|
+
* Removes the current user from a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.
|
|
229
|
+
* @see https://discord.com/developers/docs/resources/channel#leave-thread
|
|
230
|
+
*/
|
|
231
|
+
leaveThread(channel_id: snowflake): Promise<void>
|
|
232
|
+
/**
|
|
233
|
+
* Removes another member from a thread. Requires the MANAGE_THREADS permission, or the creator of the thread if it is a GUILD_PRIVATE_THREAD. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.
|
|
234
|
+
* @see https://discord.com/developers/docs/resources/channel#remove-thread-member
|
|
235
|
+
*/
|
|
236
|
+
removeThreadMember(channel_id: snowflake, user_id: snowflake): Promise<void>
|
|
237
|
+
/**
|
|
238
|
+
* Returns a thread member object for the specified user if they are a member of the thread, returns a 404 response otherwise.
|
|
239
|
+
* @see https://discord.com/developers/docs/resources/channel#get-thread-member
|
|
240
|
+
*/
|
|
241
|
+
getThreadMember(channel_id: snowflake, user_id: snowflake): Promise<ThreadMember>
|
|
242
|
+
/**
|
|
243
|
+
* Returns array of thread members objects that are members of the thread.
|
|
244
|
+
* @see https://discord.com/developers/docs/resources/channel#list-thread-members
|
|
245
|
+
*/
|
|
246
|
+
listThreadMembers(channel_id: snowflake): Promise<ThreadMember[]>
|
|
247
|
+
/**
|
|
248
|
+
* Returns all active threads in the channel, including public and private threads. Threads are ordered by their id, in descending order.
|
|
249
|
+
* @see https://discord.com/developers/docs/resources/channel#list-active-threads
|
|
250
|
+
*/
|
|
251
|
+
listActiveThreads(channel_id: snowflake): Promise<Thread.List>
|
|
252
|
+
/**
|
|
253
|
+
* Returns archived threads in the channel that are public. When called on a GUILD_TEXT channel, returns threads of type GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel returns threads of type GUILD_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.
|
|
254
|
+
* @see https://discord.com/developers/docs/resources/channel#list-public-archived-threads
|
|
255
|
+
*/
|
|
256
|
+
listPublicArchivedThreads(channel_id: snowflake, params?: Thread.ListPublicArchivedParams): Promise<Thread.List>
|
|
257
|
+
/**
|
|
258
|
+
* Returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.
|
|
259
|
+
* @see https://discord.com/developers/docs/resources/channel#list-private-archived-threads
|
|
260
|
+
*/
|
|
261
|
+
listPrivateArchivedThreads(channel_id: snowflake, params?: Thread.ListPrivateArchivedParams): Promise<Thread.List>
|
|
262
|
+
/**
|
|
263
|
+
* Returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD, and the user has joined. Threads are ordered by their id, in descending order. Requires the READ_MESSAGE_HISTORY permission.
|
|
264
|
+
* @see https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads
|
|
265
|
+
*/
|
|
266
|
+
listJoinedPrivateArchivedThreads(channel_id: snowflake, params?: Thread.ListJoinedPrivateArchivedParams): Promise<Thread.List>
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
Internal.define({
|
|
271
|
+
'/channels/{channel.id}/messages/{message.id}/threads': {
|
|
272
|
+
POST: 'startThreadFromMessage',
|
|
273
|
+
},
|
|
274
|
+
'/channels/{channel.id}/threads': {
|
|
275
|
+
POST: ['startThreadWithoutMessage', 'startThreadInForumChannel'],
|
|
276
|
+
},
|
|
277
|
+
'/channels/{channel.id}/thread-members/@me': {
|
|
278
|
+
PUT: 'joinThread',
|
|
279
|
+
DELETE: 'leaveThread',
|
|
280
|
+
},
|
|
281
|
+
'/channels/{channel.id}/thread-members/{user.id}': {
|
|
282
|
+
PUT: 'addThreadMember',
|
|
283
|
+
DELETE: 'removeThreadMember',
|
|
284
|
+
GET: 'getThreadMember',
|
|
285
|
+
},
|
|
286
|
+
'/channels/{channel.id}/thread-members': {
|
|
287
|
+
GET: 'listThreadMembers',
|
|
288
|
+
},
|
|
289
|
+
'/channels/{channel.id}/threads/archived/public': {
|
|
290
|
+
GET: 'listPublicArchivedThreads',
|
|
291
|
+
},
|
|
292
|
+
'/channels/{channel.id}/threads/archived/private': {
|
|
293
|
+
GET: 'listPrivateArchivedThreads',
|
|
294
|
+
},
|
|
295
|
+
'/channels/{channel.id}/users/@me/threads/archived/private': {
|
|
296
|
+
GET: 'listJoinedPrivateArchivedThreads',
|
|
297
|
+
},
|
|
298
|
+
})
|