disgroove 1.2.9 → 1.3.0-dev.19adbb0
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/dist/Client.d.ts +40 -40
- package/dist/Client.js +75 -75
- package/dist/Client.js.map +1 -1
- package/dist/gateway/Shard.js +30 -34
- package/dist/gateway/Shard.js.map +1 -1
- package/dist/rest/RequestsManager.js +1 -1
- package/dist/rest/RequestsManager.js.map +1 -1
- package/dist/structures/Application.d.ts +70 -70
- package/dist/structures/Application.js +128 -155
- package/dist/structures/Application.js.map +1 -1
- package/dist/structures/ApplicationCommand.d.ts +4 -4
- package/dist/structures/ApplicationCommand.js +19 -19
- package/dist/structures/ApplicationCommand.js.map +1 -1
- package/dist/structures/AutoModerationRule.d.ts +2 -2
- package/dist/structures/AutoModerationRule.js +7 -7
- package/dist/structures/AutoModerationRule.js.map +1 -1
- package/dist/structures/Channel.d.ts +126 -126
- package/dist/structures/Channel.js +258 -258
- package/dist/structures/Channel.js.map +1 -1
- package/dist/structures/Emoji.d.ts +2 -2
- package/dist/structures/Emoji.js +9 -9
- package/dist/structures/Emoji.js.map +1 -1
- package/dist/structures/Entitlement.d.ts +24 -0
- package/dist/structures/Entitlement.js +68 -0
- package/dist/structures/Entitlement.js.map +1 -0
- package/dist/structures/Guild.d.ts +305 -305
- package/dist/structures/Guild.js +616 -624
- package/dist/structures/Guild.js.map +1 -1
- package/dist/structures/GuildMember.d.ts +9 -9
- package/dist/structures/GuildMember.js +30 -30
- package/dist/structures/GuildMember.js.map +1 -1
- package/dist/structures/GuildScheduledEvent.d.ts +2 -2
- package/dist/structures/GuildScheduledEvent.js +5 -5
- package/dist/structures/GuildScheduledEvent.js.map +1 -1
- package/dist/structures/GuildTemplate.d.ts +4 -4
- package/dist/structures/GuildTemplate.js +9 -9
- package/dist/structures/GuildTemplate.js.map +1 -1
- package/dist/structures/Integration.js +2 -2
- package/dist/structures/Integration.js.map +1 -1
- package/dist/structures/Interaction.d.ts +27 -27
- package/dist/structures/Interaction.js +90 -83
- package/dist/structures/Interaction.js.map +1 -1
- package/dist/structures/Invite.js +1 -1
- package/dist/structures/Invite.js.map +1 -1
- package/dist/structures/Message.d.ts +20 -17
- package/dist/structures/Message.js +81 -55
- package/dist/structures/Message.js.map +1 -1
- package/dist/structures/PartialApplication.d.ts +70 -70
- package/dist/structures/PartialApplication.js +128 -155
- package/dist/structures/PartialApplication.js.map +1 -1
- package/dist/structures/Role.d.ts +2 -2
- package/dist/structures/Role.js +7 -7
- package/dist/structures/Role.js.map +1 -1
- package/dist/structures/SKU.d.ts +23 -0
- package/dist/structures/SKU.js +63 -0
- package/dist/structures/SKU.js.map +1 -0
- package/dist/structures/StageInstance.d.ts +2 -2
- package/dist/structures/StageInstance.js +7 -7
- package/dist/structures/StageInstance.js.map +1 -1
- package/dist/structures/Sticker.d.ts +2 -2
- package/dist/structures/Sticker.js +9 -9
- package/dist/structures/Sticker.js.map +1 -1
- package/dist/structures/Team.js +2 -2
- package/dist/structures/Team.js.map +1 -1
- package/dist/structures/TestEntitlement.d.ts +23 -0
- package/dist/structures/TestEntitlement.js +61 -0
- package/dist/structures/TestEntitlement.js.map +1 -0
- package/dist/structures/UnavailableGuild.d.ts +305 -305
- package/dist/structures/UnavailableGuild.js +609 -610
- package/dist/structures/UnavailableGuild.js.map +1 -1
- package/dist/structures/User.d.ts +11 -11
- package/dist/structures/User.js +35 -34
- package/dist/structures/User.js.map +1 -1
- package/dist/structures/Webhook.d.ts +26 -26
- package/dist/structures/Webhook.js +115 -147
- package/dist/structures/Webhook.js.map +1 -1
- package/dist/structures/index.d.ts +3 -0
- package/dist/structures/index.js +3 -0
- package/dist/structures/index.js.map +1 -1
- package/dist/types/interaction.d.ts +12 -12
- package/dist/types/message-components.d.ts +4 -4
- package/dist/utils/Util.d.ts +8 -482
- package/dist/utils/Util.js +169 -150
- package/dist/utils/Util.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,133 +13,57 @@ class UnavailableGuild extends _1.Base {
|
|
|
13
13
|
this.raw = data;
|
|
14
14
|
this.unavailable = data.unavailable;
|
|
15
15
|
}
|
|
16
|
-
/** https://discord.com/developers/docs/
|
|
17
|
-
async
|
|
16
|
+
/** https://discord.com/developers/docs/resources/guild#add-guild-member */
|
|
17
|
+
async addMember(userId, options) {
|
|
18
18
|
return this.client.rest
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
.put(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
20
|
+
json: {
|
|
21
|
+
access_token: options.accessToken,
|
|
22
|
+
nick: options.nick,
|
|
23
|
+
roles: options.roles,
|
|
24
|
+
mute: options.mute,
|
|
25
|
+
deaf: options.deaf,
|
|
22
26
|
},
|
|
23
27
|
})
|
|
24
|
-
.then((response) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
|
33
|
-
async getApplicationCommand(applicationId, commandId) {
|
|
34
|
-
return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
|
|
35
|
-
}
|
|
36
|
-
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
|
37
|
-
async editApplicationCommand(applicationId, commandId, options) {
|
|
38
|
-
return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
|
|
39
|
-
json: this.client.util.applicationCommandToRaw(options),
|
|
40
|
-
}), this.client);
|
|
28
|
+
.then((response) => {
|
|
29
|
+
if (response !== null) {
|
|
30
|
+
return new _1.GuildMember(response, this.client);
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
return null;
|
|
34
|
+
});
|
|
41
35
|
}
|
|
42
|
-
/** https://discord.com/developers/docs/
|
|
43
|
-
|
|
44
|
-
this.client.rest.
|
|
36
|
+
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
|
37
|
+
addMemberRole(userId, roleId, reason) {
|
|
38
|
+
this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
|
|
39
|
+
reason,
|
|
40
|
+
});
|
|
45
41
|
}
|
|
46
42
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
|
47
|
-
async
|
|
43
|
+
async bulkEditApplicationCommands(applicationId, commands) {
|
|
48
44
|
return this.client.rest
|
|
49
45
|
.put(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
|
|
50
46
|
json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
|
|
51
47
|
})
|
|
52
48
|
.then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
|
|
53
49
|
}
|
|
54
|
-
/** https://discord.com/developers/docs/
|
|
55
|
-
async
|
|
56
|
-
return this.client.rest
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
permissions: permissions.permissions.map((permission) => ({
|
|
63
|
-
id: permission.id,
|
|
64
|
-
type: permission.type,
|
|
65
|
-
permission: permission.permission,
|
|
66
|
-
})),
|
|
67
|
-
})));
|
|
68
|
-
}
|
|
69
|
-
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
|
70
|
-
async getApplicationCommandPermissions(applicationId, commandId) {
|
|
71
|
-
return this.client.rest
|
|
72
|
-
.get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
|
|
73
|
-
.then((response) => response.map((permissions) => ({
|
|
74
|
-
id: permissions.id,
|
|
75
|
-
applicationId: permissions.application_id,
|
|
76
|
-
guildId: permissions.guild_id,
|
|
77
|
-
permissions: permissions.permissions.map((permission) => ({
|
|
78
|
-
id: permission.id,
|
|
79
|
-
type: permission.type,
|
|
80
|
-
permission: permission.permission,
|
|
81
|
-
})),
|
|
82
|
-
})));
|
|
83
|
-
}
|
|
84
|
-
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
|
|
85
|
-
async getAuditLog(options) {
|
|
86
|
-
return this.client.rest
|
|
87
|
-
.get(rest_1.Endpoints.guildAuditLog(this.id), {
|
|
88
|
-
query: {
|
|
89
|
-
user_id: options?.userId,
|
|
90
|
-
action_type: options?.actionType,
|
|
91
|
-
before: options?.before,
|
|
92
|
-
after: options?.after,
|
|
93
|
-
limit: options?.limit,
|
|
50
|
+
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
|
51
|
+
async beginGuildPrune(options, reason) {
|
|
52
|
+
return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
|
|
53
|
+
json: {
|
|
54
|
+
days: options.days,
|
|
55
|
+
compute_prune_count: options.computePruneCount,
|
|
56
|
+
include_roles: options.includeRoles,
|
|
57
|
+
reason: options.reason,
|
|
94
58
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
applicationCommands: response.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
|
|
98
|
-
auditLogEntries: response.audit_log_entries.map((auditLogEntry) => ({
|
|
99
|
-
targetId: auditLogEntry.target_id,
|
|
100
|
-
changes: auditLogEntry.changes?.map((change) => ({
|
|
101
|
-
newValue: change.new_value,
|
|
102
|
-
oldValue: change.old_value,
|
|
103
|
-
key: change.key,
|
|
104
|
-
})),
|
|
105
|
-
userId: auditLogEntry.user_id,
|
|
106
|
-
id: auditLogEntry.id,
|
|
107
|
-
actionType: auditLogEntry.action_type,
|
|
108
|
-
options: auditLogEntry.options !== undefined
|
|
109
|
-
? {
|
|
110
|
-
applicationId: auditLogEntry.options.application_id,
|
|
111
|
-
autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
|
|
112
|
-
autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
|
|
113
|
-
channelId: auditLogEntry.options.channel_id,
|
|
114
|
-
count: auditLogEntry.options.count,
|
|
115
|
-
deleteMemberDays: auditLogEntry.options.delete_member_days,
|
|
116
|
-
id: auditLogEntry.options.id,
|
|
117
|
-
membersRemoved: auditLogEntry.options.members_removed,
|
|
118
|
-
messageId: auditLogEntry.options.message_id,
|
|
119
|
-
roleName: auditLogEntry.options.role_name,
|
|
120
|
-
type: auditLogEntry.options.type,
|
|
121
|
-
integrationType: auditLogEntry.options.integration_type,
|
|
122
|
-
}
|
|
123
|
-
: undefined,
|
|
124
|
-
reason: auditLogEntry.reason,
|
|
125
|
-
})),
|
|
126
|
-
autoModerationRules: response.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client)),
|
|
127
|
-
guildScheduledEvents: response.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client)),
|
|
128
|
-
integrations: response.integrations.map((integration) => new _1.Integration(integration, this.client)),
|
|
129
|
-
threads: response.threads.map((thread) => new _1.Channel(thread, this.client)),
|
|
130
|
-
users: response.users.map((user) => new _1.User(user, this.client)),
|
|
131
|
-
webhooks: response.webhooks.map((webhook) => new _1.Webhook(webhook, this.client)),
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
|
135
|
-
async getAutoModerationRules() {
|
|
136
|
-
return this.client.rest
|
|
137
|
-
.get(rest_1.Endpoints.guildAutoModerationRules(this.id))
|
|
138
|
-
.then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
|
|
59
|
+
reason,
|
|
60
|
+
});
|
|
139
61
|
}
|
|
140
|
-
/** https://discord.com/developers/docs/
|
|
141
|
-
async
|
|
142
|
-
return new _1.
|
|
62
|
+
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
|
63
|
+
async createApplicationCommand(applicationId, options) {
|
|
64
|
+
return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
|
|
65
|
+
json: this.client.util.applicationCommandToRaw(options),
|
|
66
|
+
}), this.client);
|
|
143
67
|
}
|
|
144
68
|
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
|
|
145
69
|
async createAutoModerationRule(options, reason) {
|
|
@@ -164,44 +88,44 @@ class UnavailableGuild extends _1.Base {
|
|
|
164
88
|
reason,
|
|
165
89
|
}), this.client);
|
|
166
90
|
}
|
|
167
|
-
/** https://discord.com/developers/docs/resources/
|
|
168
|
-
|
|
169
|
-
|
|
91
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
|
92
|
+
createBan(userId, options, reason) {
|
|
93
|
+
this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
|
|
170
94
|
json: {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
trigger_type: options.triggerType,
|
|
174
|
-
trigger_metadata: options.triggerMetadata,
|
|
175
|
-
actions: options.actions?.map((action) => ({
|
|
176
|
-
type: action.type,
|
|
177
|
-
metadata: {
|
|
178
|
-
channel_id: action.metadata.channelId,
|
|
179
|
-
duration_seconds: action.metadata.durationSeconds,
|
|
180
|
-
custom_message: action.metadata.customMessage,
|
|
181
|
-
},
|
|
182
|
-
})),
|
|
183
|
-
enabled: options.enabled,
|
|
184
|
-
exempt_roles: options.exemptRoles,
|
|
185
|
-
exempt_channels: options.exemptChannels,
|
|
95
|
+
delete_message_days: options?.deleteMessageDays,
|
|
96
|
+
delete_message_seconds: options?.deleteMessageSeconds,
|
|
186
97
|
},
|
|
187
98
|
reason,
|
|
188
|
-
}), this.client);
|
|
189
|
-
}
|
|
190
|
-
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
|
191
|
-
deleteAutoModerationRule(ruleId, reason) {
|
|
192
|
-
this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
|
|
193
|
-
reason,
|
|
194
99
|
});
|
|
195
100
|
}
|
|
196
|
-
/** https://discord.com/developers/docs/resources/
|
|
197
|
-
async
|
|
198
|
-
return this.client.rest
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
101
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
|
102
|
+
async createChannel(options, reason) {
|
|
103
|
+
return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
|
|
104
|
+
json: {
|
|
105
|
+
name: options.name,
|
|
106
|
+
type: options.type,
|
|
107
|
+
topic: options.topic,
|
|
108
|
+
bitrate: options.bitrate,
|
|
109
|
+
user_limit: options.userLimit,
|
|
110
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
|
111
|
+
position: options.position,
|
|
112
|
+
permission_overwrites: options.permissionOverwrites,
|
|
113
|
+
parent_id: options.parentId,
|
|
114
|
+
nsfw: options.nsfw,
|
|
115
|
+
rtc_region: options.rtcRegion,
|
|
116
|
+
video_quality_mode: options.videoQualityMode,
|
|
117
|
+
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
|
118
|
+
default_reaction_emoji: {
|
|
119
|
+
emojiId: options.defaultReactionEmoji?.emojiId,
|
|
120
|
+
emojiName: options.defaultReactionEmoji?.emojiName,
|
|
121
|
+
},
|
|
122
|
+
available_tags: options.availableTags,
|
|
123
|
+
default_sort_order: options.defaultSortOrder,
|
|
124
|
+
default_forum_layout: options.defaultForumLayout,
|
|
125
|
+
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
|
126
|
+
},
|
|
127
|
+
reason,
|
|
128
|
+
}), this.client);
|
|
205
129
|
}
|
|
206
130
|
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
|
207
131
|
async createEmoji(options, reason) {
|
|
@@ -214,54 +138,108 @@ class UnavailableGuild extends _1.Base {
|
|
|
214
138
|
reason,
|
|
215
139
|
}), this.client);
|
|
216
140
|
}
|
|
217
|
-
/** https://discord.com/developers/docs/resources/
|
|
218
|
-
async
|
|
219
|
-
return new _1.
|
|
141
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
|
142
|
+
async createRole(options, reason) {
|
|
143
|
+
return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
|
|
220
144
|
json: {
|
|
221
145
|
name: options.name,
|
|
222
|
-
|
|
146
|
+
permissions: options.permissions,
|
|
147
|
+
color: options.color,
|
|
148
|
+
hoist: options.hoist,
|
|
149
|
+
icon: options.icon,
|
|
150
|
+
unicode_emoji: options.unicodeEmoji,
|
|
151
|
+
mentionable: options.mentionable,
|
|
223
152
|
},
|
|
224
153
|
reason,
|
|
225
154
|
}), this.client);
|
|
226
155
|
}
|
|
227
|
-
/** https://discord.com/developers/docs/resources/
|
|
228
|
-
|
|
229
|
-
this.client.rest.
|
|
156
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
|
157
|
+
async createScheduledEvent(options, reason) {
|
|
158
|
+
return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
|
|
159
|
+
json: {
|
|
160
|
+
channel_id: options.channelId,
|
|
161
|
+
entity_metadata: options.entityMetadata,
|
|
162
|
+
name: options.name,
|
|
163
|
+
privacy_level: options.privacyLevel,
|
|
164
|
+
scheduled_start_time: options.scheduledEndTime,
|
|
165
|
+
scheduled_end_time: options.scheduledEndTime,
|
|
166
|
+
description: options.description,
|
|
167
|
+
entity_type: options.entityType,
|
|
168
|
+
image: options.image,
|
|
169
|
+
},
|
|
230
170
|
reason,
|
|
231
|
-
});
|
|
171
|
+
}), this.client);
|
|
232
172
|
}
|
|
233
|
-
/** https://discord.com/developers/docs/resources/
|
|
234
|
-
async
|
|
173
|
+
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
|
|
174
|
+
async createSticker(options, reason) {
|
|
175
|
+
const formData = new undici_1.FormData();
|
|
176
|
+
formData.set("name", options.name);
|
|
177
|
+
formData.set("description", options.description);
|
|
178
|
+
formData.set("tags", options.tags);
|
|
179
|
+
formData.set("file", new undici_1.File([options.file.contents], options.file.name));
|
|
235
180
|
return this.client.rest
|
|
236
|
-
.
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
181
|
+
.post(rest_1.Endpoints.guildStickers(this.id), {
|
|
182
|
+
form: formData,
|
|
183
|
+
reason,
|
|
184
|
+
})
|
|
185
|
+
.then((response) => new _1.Sticker(response, this.client));
|
|
186
|
+
}
|
|
187
|
+
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
|
188
|
+
async createTemplate(options) {
|
|
189
|
+
return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
|
|
190
|
+
json: {
|
|
191
|
+
name: options.name,
|
|
192
|
+
description: options.description,
|
|
193
|
+
},
|
|
194
|
+
}), this.client);
|
|
195
|
+
}
|
|
196
|
+
/** https://discord.com/developers/docs/resources/guild#delete-guild */
|
|
197
|
+
delete() {
|
|
198
|
+
this.client.rest.delete(rest_1.Endpoints.guild(this.id));
|
|
199
|
+
}
|
|
200
|
+
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
|
201
|
+
deleteApplicationCommand(applicationId, commandId) {
|
|
202
|
+
this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
|
|
203
|
+
}
|
|
204
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
|
205
|
+
deleteAutoModerationRule(ruleId, reason) {
|
|
206
|
+
this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
|
|
207
|
+
reason,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
|
|
211
|
+
deleteEmoji(emojiId, reason) {
|
|
212
|
+
this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
|
|
213
|
+
reason,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
|
|
217
|
+
deleteIntegration(integrationId, reason) {
|
|
218
|
+
this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
|
|
219
|
+
reason,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/** https://discord.com/developers/docs/resources/guild#delete-guild-role */
|
|
223
|
+
deleteRole(roleId, reason) {
|
|
224
|
+
this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
|
|
225
|
+
reason,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
|
|
229
|
+
deleteScheduledEvent(scheduledEventId) {
|
|
230
|
+
this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
|
|
231
|
+
}
|
|
232
|
+
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
|
233
|
+
deleteSticker(stickerId, reason) {
|
|
234
|
+
this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
|
|
235
|
+
reason,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
|
239
|
+
async deleteTemplate(code) {
|
|
240
|
+
return this.client.rest
|
|
241
|
+
.delete(rest_1.Endpoints.guildTemplate(this.id, code))
|
|
242
|
+
.then((response) => new _1.GuildTemplate(response, this.client).toJSON());
|
|
265
243
|
}
|
|
266
244
|
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
|
267
245
|
async edit(options, reason) {
|
|
@@ -292,41 +270,31 @@ class UnavailableGuild extends _1.Base {
|
|
|
292
270
|
reason,
|
|
293
271
|
}), this.client);
|
|
294
272
|
}
|
|
295
|
-
/** https://discord.com/developers/docs/
|
|
296
|
-
|
|
297
|
-
this.client.rest.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
async getChannels() {
|
|
301
|
-
return this.client.rest
|
|
302
|
-
.get(rest_1.Endpoints.guildChannels(this.id))
|
|
303
|
-
.then((response) => response.map((data) => new _1.Channel(data, this.client)));
|
|
273
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
|
274
|
+
async editApplicationCommand(applicationId, commandId, options) {
|
|
275
|
+
return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
|
|
276
|
+
json: this.client.util.applicationCommandToRaw(options),
|
|
277
|
+
}), this.client);
|
|
304
278
|
}
|
|
305
|
-
/** https://discord.com/developers/docs/resources/
|
|
306
|
-
async
|
|
307
|
-
return new _1.
|
|
279
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
|
|
280
|
+
async editAutoModerationRule(ruleId, options, reason) {
|
|
281
|
+
return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
|
|
308
282
|
json: {
|
|
309
283
|
name: options.name,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
emojiName: options.defaultReactionEmoji?.emojiName,
|
|
325
|
-
},
|
|
326
|
-
available_tags: options.availableTags,
|
|
327
|
-
default_sort_order: options.defaultSortOrder,
|
|
328
|
-
default_forum_layout: options.defaultForumLayout,
|
|
329
|
-
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
|
284
|
+
event_type: options.eventType,
|
|
285
|
+
trigger_type: options.triggerType,
|
|
286
|
+
trigger_metadata: options.triggerMetadata,
|
|
287
|
+
actions: options.actions?.map((action) => ({
|
|
288
|
+
type: action.type,
|
|
289
|
+
metadata: {
|
|
290
|
+
channel_id: action.metadata.channelId,
|
|
291
|
+
duration_seconds: action.metadata.durationSeconds,
|
|
292
|
+
custom_message: action.metadata.customMessage,
|
|
293
|
+
},
|
|
294
|
+
})),
|
|
295
|
+
enabled: options.enabled,
|
|
296
|
+
exempt_roles: options.exemptRoles,
|
|
297
|
+
exempt_channels: options.exemptChannels,
|
|
330
298
|
},
|
|
331
299
|
reason,
|
|
332
300
|
}), this.client);
|
|
@@ -342,64 +310,34 @@ class UnavailableGuild extends _1.Base {
|
|
|
342
310
|
})),
|
|
343
311
|
});
|
|
344
312
|
}
|
|
345
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
346
|
-
async
|
|
347
|
-
return this.client.rest
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
userId: data.user_id,
|
|
354
|
-
joinTimestamp: data.join_timestamp,
|
|
355
|
-
flags: data.flags,
|
|
356
|
-
member: data.member !== undefined
|
|
357
|
-
? new _1.GuildMember(data.member, this.client)
|
|
358
|
-
: undefined,
|
|
359
|
-
})),
|
|
360
|
-
})));
|
|
361
|
-
}
|
|
362
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
|
363
|
-
async getMember(userId) {
|
|
364
|
-
return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
|
|
365
|
-
}
|
|
366
|
-
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
|
367
|
-
async getMembers() {
|
|
368
|
-
return this.client.rest
|
|
369
|
-
.get(rest_1.Endpoints.guildMembers(this.id))
|
|
370
|
-
.then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
|
|
313
|
+
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
|
314
|
+
async editCurrentMember(options, reason) {
|
|
315
|
+
return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
|
|
316
|
+
json: {
|
|
317
|
+
nick: options.nick,
|
|
318
|
+
},
|
|
319
|
+
reason,
|
|
320
|
+
}), this.client);
|
|
371
321
|
}
|
|
372
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
322
|
+
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
|
323
|
+
editCurrentUserVoiceState(options) {
|
|
324
|
+
this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
|
|
325
|
+
json: {
|
|
326
|
+
channel_id: options.channelId,
|
|
327
|
+
suppress: options.suppress,
|
|
328
|
+
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
|
379
329
|
},
|
|
380
|
-
})
|
|
381
|
-
.then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
|
|
330
|
+
});
|
|
382
331
|
}
|
|
383
|
-
/** https://discord.com/developers/docs/resources/
|
|
384
|
-
async
|
|
385
|
-
return this.client.rest
|
|
386
|
-
.put(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
332
|
+
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
|
333
|
+
async editEmoji(emojiId, options, reason) {
|
|
334
|
+
return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
|
|
387
335
|
json: {
|
|
388
|
-
|
|
389
|
-
nick: options.nick,
|
|
336
|
+
name: options.name,
|
|
390
337
|
roles: options.roles,
|
|
391
|
-
mute: options.mute,
|
|
392
|
-
deaf: options.deaf,
|
|
393
338
|
},
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (response !== null) {
|
|
397
|
-
return new _1.GuildMember(response, this.client);
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
return null;
|
|
401
|
-
}
|
|
402
|
-
});
|
|
339
|
+
reason,
|
|
340
|
+
}), this.client);
|
|
403
341
|
}
|
|
404
342
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
|
405
343
|
async editMember(userId, options, reason) {
|
|
@@ -416,90 +354,64 @@ class UnavailableGuild extends _1.Base {
|
|
|
416
354
|
reason,
|
|
417
355
|
}), this.client);
|
|
418
356
|
}
|
|
419
|
-
/** https://discord.com/developers/docs/resources/guild#modify-
|
|
420
|
-
async
|
|
421
|
-
return
|
|
357
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
|
358
|
+
async editMFALevel(options, reason) {
|
|
359
|
+
return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), {
|
|
422
360
|
json: {
|
|
423
|
-
|
|
361
|
+
level: options.level,
|
|
424
362
|
},
|
|
425
363
|
reason,
|
|
426
|
-
}), this.client);
|
|
427
|
-
}
|
|
428
|
-
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
|
429
|
-
addMemberRole(userId, roleId, reason) {
|
|
430
|
-
this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
|
|
431
|
-
reason,
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
435
|
-
removeMemberRole(userId, roleId, reason) {
|
|
436
|
-
this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
|
|
437
|
-
reason,
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
441
|
-
removeMember(userId, reason) {
|
|
442
|
-
this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
443
|
-
reason,
|
|
444
364
|
});
|
|
445
365
|
}
|
|
446
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
.get(rest_1.Endpoints.guildBans(this.id), {
|
|
450
|
-
query: {
|
|
451
|
-
limit: options?.limit,
|
|
452
|
-
before: options?.before,
|
|
453
|
-
after: options?.after,
|
|
454
|
-
},
|
|
455
|
-
})
|
|
456
|
-
.then((response) => response.map((data) => ({
|
|
457
|
-
reason: data.reason,
|
|
458
|
-
user: new _1.User(data.user, this.client),
|
|
459
|
-
})));
|
|
460
|
-
}
|
|
461
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
|
462
|
-
async getBan(userId) {
|
|
463
|
-
return this.client.rest
|
|
464
|
-
.get(rest_1.Endpoints.guildBan(this.id, userId))
|
|
465
|
-
.then((response) => ({
|
|
466
|
-
reason: response.reason,
|
|
467
|
-
user: new _1.User(response.user, this.client),
|
|
468
|
-
}));
|
|
469
|
-
}
|
|
470
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
|
471
|
-
createBan(userId, options, reason) {
|
|
472
|
-
this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
|
|
366
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
|
|
367
|
+
editOnboarding(options, reason) {
|
|
368
|
+
this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
|
|
473
369
|
json: {
|
|
474
|
-
|
|
475
|
-
|
|
370
|
+
prompts: options.prompts.map((prompt) => ({
|
|
371
|
+
id: prompt.id,
|
|
372
|
+
type: prompt.type,
|
|
373
|
+
options: prompt.options.map((option) => ({
|
|
374
|
+
id: option.id,
|
|
375
|
+
channel_ids: option.channelIds,
|
|
376
|
+
role_ids: option.roleIds,
|
|
377
|
+
emoji: option.emoji !== undefined
|
|
378
|
+
? {
|
|
379
|
+
id: option.emoji.id,
|
|
380
|
+
name: option.emoji.name,
|
|
381
|
+
roles: option.emoji.roles,
|
|
382
|
+
user: option.emoji.user,
|
|
383
|
+
require_colons: option.emoji.requireColons,
|
|
384
|
+
managed: option.emoji.managed,
|
|
385
|
+
animated: option.emoji.animated,
|
|
386
|
+
available: option.emoji.available,
|
|
387
|
+
}
|
|
388
|
+
: undefined,
|
|
389
|
+
emoji_id: option.emojiId,
|
|
390
|
+
emoji_name: option.emojiName,
|
|
391
|
+
emoji_animated: option.emojiAnimated,
|
|
392
|
+
title: option.title,
|
|
393
|
+
description: option.description,
|
|
394
|
+
})),
|
|
395
|
+
title: prompt.title,
|
|
396
|
+
single_select: prompt.singleSelect,
|
|
397
|
+
required: prompt.required,
|
|
398
|
+
in_onboarding: prompt.inOnboarding,
|
|
399
|
+
})),
|
|
476
400
|
},
|
|
477
401
|
reason,
|
|
478
402
|
});
|
|
479
403
|
}
|
|
480
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
481
|
-
|
|
482
|
-
this.client.rest.
|
|
483
|
-
reason,
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
|
487
|
-
async getRoles() {
|
|
488
|
-
return this.client.rest
|
|
489
|
-
.get(rest_1.Endpoints.guildRoles(this.id))
|
|
490
|
-
.then((response) => response.map((data) => new _1.Role(data, this.client)));
|
|
491
|
-
}
|
|
492
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
|
493
|
-
async createRole(options, reason) {
|
|
494
|
-
return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
|
|
404
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-role */
|
|
405
|
+
async editRole(roleId, options, reason) {
|
|
406
|
+
return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
|
|
495
407
|
json: {
|
|
496
|
-
name: options
|
|
497
|
-
permissions: options
|
|
498
|
-
color: options
|
|
499
|
-
hoist: options
|
|
500
|
-
icon: options
|
|
501
|
-
unicode_emoji: options
|
|
502
|
-
mentionable: options
|
|
408
|
+
name: options?.name,
|
|
409
|
+
permissions: options?.permissions,
|
|
410
|
+
color: options?.color,
|
|
411
|
+
hoist: options?.hoist,
|
|
412
|
+
icon: options?.icon,
|
|
413
|
+
unicode_emoji: options?.unicodeEmoji,
|
|
414
|
+
mentionable: options?.mentionable,
|
|
503
415
|
},
|
|
504
416
|
reason,
|
|
505
417
|
}), this.client);
|
|
@@ -515,94 +427,75 @@ class UnavailableGuild extends _1.Base {
|
|
|
515
427
|
})
|
|
516
428
|
.then((response) => response.map((data) => new _1.Role(data, this.client)));
|
|
517
429
|
}
|
|
518
|
-
/** https://discord.com/developers/docs/resources/guild#modify-guild-
|
|
519
|
-
async
|
|
520
|
-
return new _1.
|
|
430
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
|
431
|
+
async editScheduledEvent(scheduledEventId, options, reason) {
|
|
432
|
+
return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
|
|
521
433
|
json: {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
434
|
+
channel_id: options.channelId,
|
|
435
|
+
entity_metadata: options.entityMetadata,
|
|
436
|
+
name: options.name,
|
|
437
|
+
privacy_level: options.privacyLevel,
|
|
438
|
+
scheduled_start_time: options.scheduledStartTime,
|
|
439
|
+
scheduled_end_time: options.scheduledEndTime,
|
|
440
|
+
description: options.description,
|
|
441
|
+
entityType: options.entityType,
|
|
442
|
+
status: options.status,
|
|
443
|
+
image: options.image,
|
|
529
444
|
},
|
|
530
445
|
reason,
|
|
531
446
|
}), this.client);
|
|
532
447
|
}
|
|
533
|
-
/** https://discord.com/developers/docs/resources/
|
|
534
|
-
async
|
|
535
|
-
return this.client.rest
|
|
448
|
+
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
|
449
|
+
async editSticker(stickerId, options, reason) {
|
|
450
|
+
return this.client.rest
|
|
451
|
+
.patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
|
|
536
452
|
json: {
|
|
537
|
-
|
|
453
|
+
name: options.name,
|
|
454
|
+
description: options.description,
|
|
455
|
+
tags: options.tags,
|
|
538
456
|
},
|
|
539
457
|
reason,
|
|
540
|
-
})
|
|
541
|
-
|
|
542
|
-
/** https://discord.com/developers/docs/resources/guild#delete-guild-role */
|
|
543
|
-
deleteRole(roleId, reason) {
|
|
544
|
-
this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
|
|
545
|
-
reason,
|
|
546
|
-
});
|
|
458
|
+
})
|
|
459
|
+
.then((response) => new _1.Sticker(response, this.client));
|
|
547
460
|
}
|
|
548
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
549
|
-
async
|
|
550
|
-
return this.client.rest.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
461
|
+
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
|
462
|
+
async editTemplate(code, options) {
|
|
463
|
+
return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
|
|
464
|
+
json: {
|
|
465
|
+
name: options.name,
|
|
466
|
+
description: options.description,
|
|
554
467
|
},
|
|
555
|
-
});
|
|
468
|
+
}), this.client);
|
|
556
469
|
}
|
|
557
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
558
|
-
|
|
559
|
-
|
|
470
|
+
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
|
471
|
+
editUserVoiceState(userId, options) {
|
|
472
|
+
this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
|
|
560
473
|
json: {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
reason: options.reason,
|
|
474
|
+
channel_id: options.channelId,
|
|
475
|
+
suppress: options.suppress,
|
|
476
|
+
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
|
565
477
|
},
|
|
566
|
-
reason,
|
|
567
478
|
});
|
|
568
479
|
}
|
|
569
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
570
|
-
async
|
|
571
|
-
return this.client.rest
|
|
572
|
-
.get(rest_1.Endpoints.guildVoiceRegions(this.id))
|
|
573
|
-
.then((response) => response.map((data) => ({
|
|
574
|
-
id: data.id,
|
|
575
|
-
name: data.name,
|
|
576
|
-
optimal: data.optimal,
|
|
577
|
-
deprecated: data.deprecated,
|
|
578
|
-
custom: data.custom,
|
|
579
|
-
})));
|
|
580
|
-
}
|
|
581
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
|
582
|
-
async getInvites() {
|
|
583
|
-
return this.client.rest
|
|
584
|
-
.get(rest_1.Endpoints.guildInvites(this.id))
|
|
585
|
-
.then((response) => response.map((data) => new _1.Invite(data, this.client)));
|
|
586
|
-
}
|
|
587
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
|
588
|
-
async getIntegrations() {
|
|
480
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
|
481
|
+
async editWelcomeScreen(options, reason) {
|
|
589
482
|
return this.client.rest
|
|
590
|
-
.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
483
|
+
.patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
|
|
484
|
+
json: {
|
|
485
|
+
enabled: options.enabled,
|
|
486
|
+
welcome_channels: options.welcomeChannels,
|
|
487
|
+
description: options.description,
|
|
488
|
+
},
|
|
596
489
|
reason,
|
|
597
|
-
})
|
|
598
|
-
}
|
|
599
|
-
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
|
|
600
|
-
async getWidgetSettings() {
|
|
601
|
-
return this.client.rest
|
|
602
|
-
.get(rest_1.Endpoints.guildWidgetSettings(this.id))
|
|
490
|
+
})
|
|
603
491
|
.then((response) => ({
|
|
604
|
-
|
|
605
|
-
|
|
492
|
+
description: response.description,
|
|
493
|
+
welcomeChannels: response.welcome_channels.map((data) => ({
|
|
494
|
+
channelId: data.channel_id,
|
|
495
|
+
description: data.description,
|
|
496
|
+
emojiId: data.emoji_id,
|
|
497
|
+
emojiName: data.emoji_name,
|
|
498
|
+
})),
|
|
606
499
|
}));
|
|
607
500
|
}
|
|
608
501
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
|
|
@@ -620,66 +513,189 @@ class UnavailableGuild extends _1.Base {
|
|
|
620
513
|
channelId: response.channel_id,
|
|
621
514
|
}));
|
|
622
515
|
}
|
|
623
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
624
|
-
async
|
|
516
|
+
/** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
|
|
517
|
+
async getActiveThreads() {
|
|
625
518
|
return this.client.rest
|
|
626
|
-
.get(rest_1.Endpoints.
|
|
627
|
-
.then((response) => ({
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
519
|
+
.get(rest_1.Endpoints.guildActiveThreads(this.id))
|
|
520
|
+
.then((response) => response.map((data) => ({
|
|
521
|
+
threads: data.threads.map((data) => new _1.Channel(data, this.client)),
|
|
522
|
+
members: data.members.map((data) => ({
|
|
523
|
+
id: data.id,
|
|
524
|
+
userId: data.user_id,
|
|
525
|
+
joinTimestamp: data.join_timestamp,
|
|
526
|
+
flags: data.flags,
|
|
527
|
+
member: data.member !== undefined
|
|
528
|
+
? new _1.GuildMember(data.member, this.client)
|
|
529
|
+
: undefined,
|
|
530
|
+
})),
|
|
531
|
+
})));
|
|
635
532
|
}
|
|
636
|
-
/** https://discord.com/developers/docs/
|
|
637
|
-
|
|
638
|
-
return this.client.rest.get(rest_1.Endpoints.
|
|
533
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
|
534
|
+
async getApplicationCommand(applicationId, commandId) {
|
|
535
|
+
return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
|
|
639
536
|
}
|
|
640
|
-
/** https://discord.com/developers/docs/
|
|
641
|
-
async
|
|
642
|
-
return this.client.rest
|
|
537
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
|
538
|
+
async getApplicationCommands(applicationId, options) {
|
|
539
|
+
return this.client.rest
|
|
540
|
+
.get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
|
|
643
541
|
query: {
|
|
644
|
-
|
|
542
|
+
with_localizations: options?.withLocalizations,
|
|
645
543
|
},
|
|
646
|
-
})
|
|
544
|
+
})
|
|
545
|
+
.then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
|
|
647
546
|
}
|
|
648
|
-
/** https://discord.com/developers/docs/
|
|
649
|
-
async
|
|
547
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
|
548
|
+
async getApplicationCommandPermissions(applicationId, commandId) {
|
|
650
549
|
return this.client.rest
|
|
651
|
-
.get(rest_1.Endpoints.
|
|
652
|
-
.then((response) => ({
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
550
|
+
.get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
|
|
551
|
+
.then((response) => response.map((permissions) => ({
|
|
552
|
+
id: permissions.id,
|
|
553
|
+
applicationId: permissions.application_id,
|
|
554
|
+
guildId: permissions.guild_id,
|
|
555
|
+
permissions: permissions.permissions.map((permission) => ({
|
|
556
|
+
id: permission.id,
|
|
557
|
+
type: permission.type,
|
|
558
|
+
permission: permission.permission,
|
|
659
559
|
})),
|
|
660
|
-
}));
|
|
560
|
+
})));
|
|
661
561
|
}
|
|
662
|
-
/** https://discord.com/developers/docs/
|
|
663
|
-
async
|
|
562
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
|
563
|
+
async getApplicationCommandsPermissions(applicationId) {
|
|
664
564
|
return this.client.rest
|
|
665
|
-
.
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
565
|
+
.get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
|
|
566
|
+
.then((response) => response.map((permissions) => ({
|
|
567
|
+
id: permissions.id,
|
|
568
|
+
applicationId: permissions.application_id,
|
|
569
|
+
guildId: permissions.guild_id,
|
|
570
|
+
permissions: permissions.permissions.map((permission) => ({
|
|
571
|
+
id: permission.id,
|
|
572
|
+
type: permission.type,
|
|
573
|
+
permission: permission.permission,
|
|
574
|
+
})),
|
|
575
|
+
})));
|
|
576
|
+
}
|
|
577
|
+
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
|
|
578
|
+
async getAuditLog(options) {
|
|
579
|
+
return this.client.rest
|
|
580
|
+
.get(rest_1.Endpoints.guildAuditLog(this.id), {
|
|
581
|
+
query: {
|
|
582
|
+
user_id: options?.userId,
|
|
583
|
+
action_type: options?.actionType,
|
|
584
|
+
before: options?.before,
|
|
585
|
+
after: options?.after,
|
|
586
|
+
limit: options?.limit,
|
|
670
587
|
},
|
|
671
|
-
reason,
|
|
672
588
|
})
|
|
673
589
|
.then((response) => ({
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
590
|
+
applicationCommands: response.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
|
|
591
|
+
auditLogEntries: response.audit_log_entries.map((auditLogEntry) => ({
|
|
592
|
+
targetId: auditLogEntry.target_id,
|
|
593
|
+
changes: auditLogEntry.changes?.map((change) => ({
|
|
594
|
+
newValue: change.new_value,
|
|
595
|
+
oldValue: change.old_value,
|
|
596
|
+
key: change.key,
|
|
597
|
+
})),
|
|
598
|
+
userId: auditLogEntry.user_id,
|
|
599
|
+
id: auditLogEntry.id,
|
|
600
|
+
actionType: auditLogEntry.action_type,
|
|
601
|
+
options: auditLogEntry.options !== undefined
|
|
602
|
+
? {
|
|
603
|
+
applicationId: auditLogEntry.options.application_id,
|
|
604
|
+
autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
|
|
605
|
+
autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
|
|
606
|
+
channelId: auditLogEntry.options.channel_id,
|
|
607
|
+
count: auditLogEntry.options.count,
|
|
608
|
+
deleteMemberDays: auditLogEntry.options.delete_member_days,
|
|
609
|
+
id: auditLogEntry.options.id,
|
|
610
|
+
membersRemoved: auditLogEntry.options.members_removed,
|
|
611
|
+
messageId: auditLogEntry.options.message_id,
|
|
612
|
+
roleName: auditLogEntry.options.role_name,
|
|
613
|
+
type: auditLogEntry.options.type,
|
|
614
|
+
integrationType: auditLogEntry.options.integration_type,
|
|
615
|
+
}
|
|
616
|
+
: undefined,
|
|
617
|
+
reason: auditLogEntry.reason,
|
|
680
618
|
})),
|
|
619
|
+
autoModerationRules: response.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client)),
|
|
620
|
+
guildScheduledEvents: response.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client)),
|
|
621
|
+
integrations: response.integrations.map((integration) => new _1.Integration(integration, this.client)),
|
|
622
|
+
threads: response.threads.map((thread) => new _1.Channel(thread, this.client)),
|
|
623
|
+
users: response.users.map((user) => new _1.User(user, this.client)),
|
|
624
|
+
webhooks: response.webhooks.map((webhook) => new _1.Webhook(webhook, this.client)),
|
|
681
625
|
}));
|
|
682
626
|
}
|
|
627
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
|
|
628
|
+
async getAutoModerationRule(ruleId) {
|
|
629
|
+
return new _1.AutoModerationRule(await this.client.rest.get(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
|
|
630
|
+
}
|
|
631
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
|
632
|
+
async getAutoModerationRules() {
|
|
633
|
+
return this.client.rest
|
|
634
|
+
.get(rest_1.Endpoints.guildAutoModerationRules(this.id))
|
|
635
|
+
.then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
|
|
636
|
+
}
|
|
637
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
|
638
|
+
async getBan(userId) {
|
|
639
|
+
return this.client.rest
|
|
640
|
+
.get(rest_1.Endpoints.guildBan(this.id, userId))
|
|
641
|
+
.then((response) => ({
|
|
642
|
+
reason: response.reason,
|
|
643
|
+
user: new _1.User(response.user, this.client),
|
|
644
|
+
}));
|
|
645
|
+
}
|
|
646
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-bans */
|
|
647
|
+
async getBans(options) {
|
|
648
|
+
return this.client.rest
|
|
649
|
+
.get(rest_1.Endpoints.guildBans(this.id), {
|
|
650
|
+
query: {
|
|
651
|
+
limit: options?.limit,
|
|
652
|
+
before: options?.before,
|
|
653
|
+
after: options?.after,
|
|
654
|
+
},
|
|
655
|
+
})
|
|
656
|
+
.then((response) => response.map((data) => ({
|
|
657
|
+
reason: data.reason,
|
|
658
|
+
user: new _1.User(data.user, this.client),
|
|
659
|
+
})));
|
|
660
|
+
}
|
|
661
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
|
662
|
+
async getChannels() {
|
|
663
|
+
return this.client.rest
|
|
664
|
+
.get(rest_1.Endpoints.guildChannels(this.id))
|
|
665
|
+
.then((response) => response.map((data) => new _1.Channel(data, this.client)));
|
|
666
|
+
}
|
|
667
|
+
/** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
|
|
668
|
+
async getEmoji(emojiId) {
|
|
669
|
+
return new _1.Emoji(await this.client.rest.get(rest_1.Endpoints.guildEmoji(this.id, emojiId)), this.client);
|
|
670
|
+
}
|
|
671
|
+
/** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
|
|
672
|
+
async getEmojis() {
|
|
673
|
+
return this.client.rest
|
|
674
|
+
.get(rest_1.Endpoints.guildEmojis(this.id))
|
|
675
|
+
.then((response) => response.map((data) => new _1.Emoji(data, this.client)));
|
|
676
|
+
}
|
|
677
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
|
678
|
+
async getIntegrations() {
|
|
679
|
+
return this.client.rest
|
|
680
|
+
.get(rest_1.Endpoints.guildIntegrations(this.id))
|
|
681
|
+
.then((response) => response.map((data) => new _1.Integration(data, this.client)));
|
|
682
|
+
}
|
|
683
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
|
684
|
+
async getInvites() {
|
|
685
|
+
return this.client.rest
|
|
686
|
+
.get(rest_1.Endpoints.guildInvites(this.id))
|
|
687
|
+
.then((response) => response.map((data) => new _1.Invite(data, this.client)));
|
|
688
|
+
}
|
|
689
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
|
690
|
+
async getMember(userId) {
|
|
691
|
+
return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
|
|
692
|
+
}
|
|
693
|
+
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
|
694
|
+
async getMembers() {
|
|
695
|
+
return this.client.rest
|
|
696
|
+
.get(rest_1.Endpoints.guildMembers(this.id))
|
|
697
|
+
.then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
|
|
698
|
+
}
|
|
683
699
|
/** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
|
|
684
700
|
async getOnboarding() {
|
|
685
701
|
return this.client.rest
|
|
@@ -712,63 +728,53 @@ class UnavailableGuild extends _1.Base {
|
|
|
712
728
|
mode: response.mode,
|
|
713
729
|
}));
|
|
714
730
|
}
|
|
715
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
716
|
-
|
|
717
|
-
this.client.rest
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
in_onboarding: prompt.inOnboarding,
|
|
748
|
-
})),
|
|
749
|
-
},
|
|
750
|
-
reason,
|
|
751
|
-
});
|
|
731
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-preview */
|
|
732
|
+
async getPreview() {
|
|
733
|
+
return this.client.rest
|
|
734
|
+
.get(rest_1.Endpoints.guildPreview(this.id))
|
|
735
|
+
.then((response) => ({
|
|
736
|
+
id: response.id,
|
|
737
|
+
name: response.name,
|
|
738
|
+
icon: response.icon,
|
|
739
|
+
splash: response.splash,
|
|
740
|
+
discoverySplash: response.discovery_splash,
|
|
741
|
+
emojis: response.emojis.map((emoji) => new _1.Emoji(emoji, this.client)),
|
|
742
|
+
features: response.features,
|
|
743
|
+
approximateMemberCount: response.approximate_member_count,
|
|
744
|
+
approximatePresenceCount: response.approximate_presence_count,
|
|
745
|
+
description: response.description,
|
|
746
|
+
stickers: response.stickers?.map((sticker) => ({
|
|
747
|
+
id: sticker.id,
|
|
748
|
+
packId: sticker.pack_id,
|
|
749
|
+
name: sticker.name,
|
|
750
|
+
description: sticker.description,
|
|
751
|
+
tags: sticker.tags,
|
|
752
|
+
asset: sticker.asset,
|
|
753
|
+
type: sticker.type,
|
|
754
|
+
formatType: sticker.format_type,
|
|
755
|
+
available: sticker.available,
|
|
756
|
+
guildId: sticker.guild_id,
|
|
757
|
+
user: sticker.user !== undefined
|
|
758
|
+
? new _1.User(sticker.user, this.client)
|
|
759
|
+
: undefined,
|
|
760
|
+
sortValue: sticker.sort_value,
|
|
761
|
+
})),
|
|
762
|
+
}));
|
|
752
763
|
}
|
|
753
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
754
|
-
|
|
755
|
-
this.client.rest.
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
|
764
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
|
765
|
+
async getPruneCount(options) {
|
|
766
|
+
return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
|
|
767
|
+
query: {
|
|
768
|
+
days: options.days,
|
|
769
|
+
include_roles: options.includeRoles,
|
|
760
770
|
},
|
|
761
771
|
});
|
|
762
772
|
}
|
|
763
|
-
/** https://discord.com/developers/docs/resources/guild#
|
|
764
|
-
|
|
765
|
-
this.client.rest
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
suppress: options.suppress,
|
|
769
|
-
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
|
770
|
-
},
|
|
771
|
-
});
|
|
773
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
|
774
|
+
async getRoles() {
|
|
775
|
+
return this.client.rest
|
|
776
|
+
.get(rest_1.Endpoints.guildRoles(this.id))
|
|
777
|
+
.then((response) => response.map((data) => new _1.Role(data, this.client)));
|
|
772
778
|
}
|
|
773
779
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
|
|
774
780
|
async getScheduledEvents(options) {
|
|
@@ -780,45 +786,6 @@ class UnavailableGuild extends _1.Base {
|
|
|
780
786
|
})
|
|
781
787
|
.then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
|
|
782
788
|
}
|
|
783
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
|
784
|
-
async createScheduledEvent(options, reason) {
|
|
785
|
-
return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
|
|
786
|
-
json: {
|
|
787
|
-
channel_id: options.channelId,
|
|
788
|
-
entity_metadata: options.entityMetadata,
|
|
789
|
-
name: options.name,
|
|
790
|
-
privacy_level: options.privacyLevel,
|
|
791
|
-
scheduled_start_time: options.scheduledEndTime,
|
|
792
|
-
scheduled_end_time: options.scheduledEndTime,
|
|
793
|
-
description: options.description,
|
|
794
|
-
entity_type: options.entityType,
|
|
795
|
-
image: options.image,
|
|
796
|
-
},
|
|
797
|
-
reason,
|
|
798
|
-
}), this.client);
|
|
799
|
-
}
|
|
800
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
|
801
|
-
async editScheduledEvent(scheduledEventId, options, reason) {
|
|
802
|
-
return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
|
|
803
|
-
json: {
|
|
804
|
-
channel_id: options.channelId,
|
|
805
|
-
entity_metadata: options.entityMetadata,
|
|
806
|
-
name: options.name,
|
|
807
|
-
privacy_level: options.privacyLevel,
|
|
808
|
-
scheduled_start_time: options.scheduledStartTime,
|
|
809
|
-
scheduled_end_time: options.scheduledEndTime,
|
|
810
|
-
description: options.description,
|
|
811
|
-
entityType: options.entityType,
|
|
812
|
-
status: options.status,
|
|
813
|
-
image: options.image,
|
|
814
|
-
},
|
|
815
|
-
reason,
|
|
816
|
-
}), this.client);
|
|
817
|
-
}
|
|
818
|
-
/** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
|
|
819
|
-
deleteScheduledEvent(scheduledEventId) {
|
|
820
|
-
this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
|
|
821
|
-
}
|
|
822
789
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
|
823
790
|
async getScheduledEventUsers(scheduledEventId, options) {
|
|
824
791
|
return this.client.rest
|
|
@@ -838,6 +805,18 @@ class UnavailableGuild extends _1.Base {
|
|
|
838
805
|
: undefined,
|
|
839
806
|
})));
|
|
840
807
|
}
|
|
808
|
+
/** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
|
|
809
|
+
async getSticker(stickerId) {
|
|
810
|
+
return this.client.rest
|
|
811
|
+
.get(rest_1.Endpoints.guildSticker(this.id, stickerId))
|
|
812
|
+
.then((response) => new _1.Sticker(response, this.client));
|
|
813
|
+
}
|
|
814
|
+
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
|
815
|
+
async getStickers() {
|
|
816
|
+
return this.client.rest
|
|
817
|
+
.get(rest_1.Endpoints.guildStickers(this.id))
|
|
818
|
+
.then((response) => response.map((data) => new _1.Sticker(data, this.client)));
|
|
819
|
+
}
|
|
841
820
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
|
842
821
|
async getTemplate(code) {
|
|
843
822
|
return new _1.GuildTemplate(await this.client.rest.get(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
|
|
@@ -848,91 +827,111 @@ class UnavailableGuild extends _1.Base {
|
|
|
848
827
|
.get(rest_1.Endpoints.guildTemplates(this.id))
|
|
849
828
|
.then((response) => response.map((data) => new _1.GuildTemplate(data, this.client)));
|
|
850
829
|
}
|
|
851
|
-
/** https://discord.com/developers/docs/resources/guild
|
|
852
|
-
|
|
853
|
-
return
|
|
854
|
-
json: {
|
|
855
|
-
name: options.name,
|
|
856
|
-
description: options.description,
|
|
857
|
-
},
|
|
858
|
-
}), this.client);
|
|
859
|
-
}
|
|
860
|
-
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
|
861
|
-
async syncTemplate(code) {
|
|
862
|
-
return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
|
|
830
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
|
831
|
+
getVanityURL() {
|
|
832
|
+
return this.client.rest.get(rest_1.Endpoints.guildVanityUrl(this.id));
|
|
863
833
|
}
|
|
864
|
-
/** https://discord.com/developers/docs/resources/guild
|
|
865
|
-
async
|
|
866
|
-
return
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
834
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
|
|
835
|
+
async getVoiceRegions() {
|
|
836
|
+
return this.client.rest
|
|
837
|
+
.get(rest_1.Endpoints.guildVoiceRegions(this.id))
|
|
838
|
+
.then((response) => response.map((data) => ({
|
|
839
|
+
id: data.id,
|
|
840
|
+
name: data.name,
|
|
841
|
+
optimal: data.optimal,
|
|
842
|
+
deprecated: data.deprecated,
|
|
843
|
+
custom: data.custom,
|
|
844
|
+
})));
|
|
872
845
|
}
|
|
873
|
-
/** https://discord.com/developers/docs/resources/
|
|
874
|
-
async
|
|
846
|
+
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
|
847
|
+
async getWebhooks() {
|
|
875
848
|
return this.client.rest
|
|
876
|
-
.
|
|
877
|
-
.then((response) => new _1.
|
|
849
|
+
.get(rest_1.Endpoints.guildWebhooks(this.id))
|
|
850
|
+
.then((response) => response.map((data) => new _1.Webhook(data, this.client)));
|
|
878
851
|
}
|
|
879
|
-
/** https://discord.com/developers/docs/resources/
|
|
880
|
-
async
|
|
852
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
|
|
853
|
+
async getWelcomeScreen() {
|
|
881
854
|
return this.client.rest
|
|
882
|
-
.get(rest_1.Endpoints.
|
|
883
|
-
.then((response) =>
|
|
855
|
+
.get(rest_1.Endpoints.guildWelcomeScreen(this.id))
|
|
856
|
+
.then((response) => ({
|
|
857
|
+
description: response.description,
|
|
858
|
+
welcomeChannels: response.welcome_channels.map((data) => ({
|
|
859
|
+
channelId: data.channel_id,
|
|
860
|
+
description: data.description,
|
|
861
|
+
emojiId: data.emoji_id,
|
|
862
|
+
emojiName: data.emoji_name,
|
|
863
|
+
})),
|
|
864
|
+
}));
|
|
884
865
|
}
|
|
885
|
-
/** https://discord.com/developers/docs/resources/
|
|
886
|
-
async
|
|
866
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget */
|
|
867
|
+
async getWidget() {
|
|
887
868
|
return this.client.rest
|
|
888
|
-
.get(rest_1.Endpoints.
|
|
889
|
-
.then((response) =>
|
|
869
|
+
.get(rest_1.Endpoints.guildWidgetJSON(this.id))
|
|
870
|
+
.then((response) => ({
|
|
871
|
+
id: response.id,
|
|
872
|
+
name: response.name,
|
|
873
|
+
instantInvite: response.instant_invite,
|
|
874
|
+
channels: response.channels.map((data) => new _1.Channel(data, this.client)),
|
|
875
|
+
members: response.members.map((data) => new _1.User(data, this.client)),
|
|
876
|
+
presenceCount: response.presence_count,
|
|
877
|
+
}));
|
|
890
878
|
}
|
|
891
|
-
/** https://discord.com/developers/docs/resources/
|
|
892
|
-
async
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
879
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
|
|
880
|
+
async getWidgetImage(options) {
|
|
881
|
+
return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
|
|
882
|
+
query: {
|
|
883
|
+
style: options?.style,
|
|
884
|
+
},
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
|
|
888
|
+
async getWidgetSettings() {
|
|
898
889
|
return this.client.rest
|
|
899
|
-
.
|
|
900
|
-
|
|
890
|
+
.get(rest_1.Endpoints.guildWidgetSettings(this.id))
|
|
891
|
+
.then((response) => ({
|
|
892
|
+
enabled: response.enabled,
|
|
893
|
+
channelId: response.channel_id,
|
|
894
|
+
}));
|
|
895
|
+
}
|
|
896
|
+
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
|
897
|
+
removeBan(userId, reason) {
|
|
898
|
+
this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
|
|
901
899
|
reason,
|
|
902
|
-
})
|
|
903
|
-
.then((response) => new _1.Sticker(response, this.client));
|
|
900
|
+
});
|
|
904
901
|
}
|
|
905
|
-
/** https://discord.com/developers/docs/resources/
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
.patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
|
|
909
|
-
json: {
|
|
910
|
-
name: options.name,
|
|
911
|
-
description: options.description,
|
|
912
|
-
tags: options.tags,
|
|
913
|
-
},
|
|
902
|
+
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
903
|
+
removeMember(userId, reason) {
|
|
904
|
+
this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
914
905
|
reason,
|
|
915
|
-
})
|
|
916
|
-
.then((response) => new _1.Sticker(response, this.client));
|
|
906
|
+
});
|
|
917
907
|
}
|
|
918
|
-
/** https://discord.com/developers/docs/resources/
|
|
919
|
-
|
|
920
|
-
this.client.rest.delete(rest_1.Endpoints.
|
|
908
|
+
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
909
|
+
removeMemberRole(userId, roleId, reason) {
|
|
910
|
+
this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
|
|
921
911
|
reason,
|
|
922
912
|
});
|
|
923
913
|
}
|
|
924
|
-
/** https://discord.com/developers/docs/resources/
|
|
925
|
-
async
|
|
914
|
+
/** https://discord.com/developers/docs/resources/guild#search-guild-members */
|
|
915
|
+
async searchMembers(options) {
|
|
926
916
|
return this.client.rest
|
|
927
|
-
.get(rest_1.Endpoints.
|
|
928
|
-
|
|
917
|
+
.get(rest_1.Endpoints.guildMembersSearch(this.id), {
|
|
918
|
+
query: {
|
|
919
|
+
query: options.query,
|
|
920
|
+
limit: options.limit,
|
|
921
|
+
},
|
|
922
|
+
})
|
|
923
|
+
.then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
|
|
924
|
+
}
|
|
925
|
+
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
|
926
|
+
async syncTemplate(code) {
|
|
927
|
+
return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
|
|
929
928
|
}
|
|
930
929
|
toRaw() {
|
|
931
930
|
return this.raw;
|
|
932
931
|
}
|
|
933
932
|
toJSON() {
|
|
934
933
|
return {
|
|
935
|
-
|
|
934
|
+
...super.toJSON(),
|
|
936
935
|
unavailable: this.unavailable,
|
|
937
936
|
};
|
|
938
937
|
}
|