snowtransfer 0.18.0 → 0.19.0
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/CHANGELOG.md +33 -0
- package/dist/Constants.d.ts +59 -0
- package/dist/Constants.js +123 -0
- package/dist/Endpoints.d.ts +120 -0
- package/dist/Endpoints.js +121 -0
- package/dist/RequestHandler.d.ts +258 -0
- package/dist/RequestHandler.js +629 -0
- package/dist/SnowTransfer.d.ts +70 -0
- package/dist/SnowTransfer.js +105 -0
- package/dist/StateMachine.d.ts +104 -0
- package/dist/StateMachine.js +238 -0
- package/dist/StateMachineGraph.d.ts +3 -0
- package/dist/StateMachineGraph.js +23 -0
- package/dist/Types.d.ts +76 -0
- package/dist/Types.js +2 -0
- package/dist/index.d.ts +25 -718
- package/dist/index.js +63 -44
- package/dist/methods/Assets.d.ts +290 -0
- package/dist/methods/Assets.js +326 -0
- package/dist/methods/AuditLog.d.ts +40 -0
- package/dist/methods/AuditLog.js +44 -0
- package/dist/methods/AutoModeration.d.ts +122 -0
- package/dist/methods/AutoModeration.js +135 -0
- package/dist/methods/Bot.d.ts +65 -0
- package/dist/methods/Bot.js +75 -0
- package/dist/methods/Channel.d.ts +866 -0
- package/dist/methods/Channel.js +982 -0
- package/dist/methods/Entitlements.d.ts +87 -0
- package/dist/methods/Entitlements.js +99 -0
- package/dist/methods/Guild.d.ts +722 -0
- package/dist/methods/Guild.js +785 -0
- package/dist/methods/GuildScheduledEvent.d.ts +138 -0
- package/dist/methods/GuildScheduledEvent.js +155 -0
- package/dist/methods/GuildTemplate.d.ts +110 -0
- package/dist/methods/GuildTemplate.js +124 -0
- package/dist/methods/Interaction.d.ts +339 -0
- package/dist/methods/Interaction.js +359 -0
- package/dist/methods/Invite.d.ts +81 -0
- package/dist/methods/Invite.js +107 -0
- package/dist/methods/Sku.d.ts +58 -0
- package/dist/methods/Sku.js +66 -0
- package/dist/methods/StageInstance.d.ts +86 -0
- package/dist/methods/StageInstance.js +97 -0
- package/dist/methods/User.d.ts +167 -0
- package/dist/methods/User.js +184 -0
- package/dist/methods/Voice.d.ts +44 -0
- package/dist/methods/Voice.js +52 -0
- package/dist/methods/Webhook.d.ts +265 -0
- package/dist/methods/Webhook.js +256 -0
- package/dist/tokenless.d.ts +19 -0
- package/dist/tokenless.js +31 -0
- package/package.json +9 -9
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Endpoints = require("../Endpoints");
|
|
3
|
+
const Constants = require("../Constants");
|
|
4
|
+
/**
|
|
5
|
+
* Methods for interacting with Guilds
|
|
6
|
+
* @since 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
class GuildMethods {
|
|
9
|
+
requestHandler;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new Guild Method Handler
|
|
12
|
+
*
|
|
13
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
14
|
+
*
|
|
15
|
+
* You can access the methods listed via `client.guild.method`, where `client` is an initialized SnowTransfer instance
|
|
16
|
+
* @param requestHandler request handler that calls the rest api
|
|
17
|
+
*/
|
|
18
|
+
constructor(requestHandler) {
|
|
19
|
+
this.requestHandler = requestHandler;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a guild via Id
|
|
23
|
+
*
|
|
24
|
+
* CurrentUser must be a member of the guild
|
|
25
|
+
* @since 0.1.0
|
|
26
|
+
* @param guildId Id of the guild
|
|
27
|
+
* @param withCounts when true, will return approximate member and presence counts for the guild
|
|
28
|
+
* @returns [Guild object](https://discord.com/developers/docs/resources/guild#guild-object)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const client = new SnowTransfer("TOKEN")
|
|
32
|
+
* const guild = await client.guild.getGuild("guild id")
|
|
33
|
+
*/
|
|
34
|
+
async getGuild(guildId, withCounts) {
|
|
35
|
+
return this.requestHandler.request(Endpoints.GUILD(guildId), { with_counts: withCounts }, "get", "json");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets a guild's preview. If the CurrentUser is not in the guild, the guild must be lurkable
|
|
39
|
+
* @since 0.3.0
|
|
40
|
+
* @param guildId Id of the guild
|
|
41
|
+
* @returns [Guild preview](https://discord.com/developers/docs/resources/guild#guild-preview-object)
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const client = new SnowTransfer("TOKEN")
|
|
45
|
+
* const guildPreview = await client.guild.getGuildPreview("guild id")
|
|
46
|
+
*/
|
|
47
|
+
async getGuildPreview(guildId) {
|
|
48
|
+
return this.requestHandler.request(Endpoints.GUILD_PREVIEW(guildId), {}, "get", "json");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Update a guild
|
|
52
|
+
* @since 0.18.0
|
|
53
|
+
* @param guildId Id of the guild
|
|
54
|
+
* @param data Updated guild data
|
|
55
|
+
* @param reason Reason for updating the guild
|
|
56
|
+
* @returns [Guild object](https://discord.com/developers/docs/resources/guild#guild-object)
|
|
57
|
+
*
|
|
58
|
+
* | Permissions needed | Condition |
|
|
59
|
+
* |--------------------|-----------|
|
|
60
|
+
* | MANAGE_GUILD | always |
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Update the name of a guild to "Nice Guild"
|
|
64
|
+
* const client = new SnowTransfer("TOKEN")
|
|
65
|
+
* const guildData = {
|
|
66
|
+
* name: "Nice Guild"
|
|
67
|
+
* }
|
|
68
|
+
* client.guild.editGuild("guild Id", guildData)
|
|
69
|
+
*/
|
|
70
|
+
async editGuild(guildId, data, reason) {
|
|
71
|
+
return this.requestHandler.request(Endpoints.GUILD(guildId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get a list of all channels for a guild. Does not include threads
|
|
75
|
+
*
|
|
76
|
+
* CurrentUser must be a member of the guild
|
|
77
|
+
* @since 0.1.0
|
|
78
|
+
* @param guildId Id of the guild
|
|
79
|
+
* @returns list of [channels](https://discord.com/developers/docs/resources/channel#channel-object-channel-structure)
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const client = new SnowTransfer("TOKEN")
|
|
83
|
+
* const channels = await client.guild.getGuildChannels("guild id")
|
|
84
|
+
*/
|
|
85
|
+
async getGuildChannels(guildId) {
|
|
86
|
+
return this.requestHandler.request(Endpoints.GUILD_CHANNELS(guildId), {}, "get", "json");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create a channel within a guild
|
|
90
|
+
* @since 0.1.0
|
|
91
|
+
* @param guildId Id of the guild
|
|
92
|
+
* @param data channel properties
|
|
93
|
+
* @param reason Reason for creating the channel
|
|
94
|
+
* @returns [channel object](https://discord.com/developers/docs/resources/channel#channel-object-channel-structure)
|
|
95
|
+
*
|
|
96
|
+
* | Permissions needed | Condition |
|
|
97
|
+
* |--------------------|-----------------------------------------------------------------|
|
|
98
|
+
* | MANAGE_CHANNELS | always |
|
|
99
|
+
* | ADMINISTRATOR | setting MANAGE_ROLES in permission_overwrites |
|
|
100
|
+
* | * | if setting * permission in overwrites where * is any permission |
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // Creates a guild voice channel with the name "nice voice channel" and with permission connect denied for the @ everyone role
|
|
104
|
+
* const client = new SnowTransfer("TOKEN")
|
|
105
|
+
* const channelData = \{
|
|
106
|
+
* name: "nice voice channel",
|
|
107
|
+
* type: 2,
|
|
108
|
+
* permission_overwrites: [\{ id: "guild id", type: 0, allow: "0" deny: (BigInt(1) << BigInt(20)).toString() \}]
|
|
109
|
+
* \}
|
|
110
|
+
* const channel = await client.guild.createGuildChannel("guild id", channelData)
|
|
111
|
+
*/
|
|
112
|
+
async createGuildChannel(guildId, data, reason) {
|
|
113
|
+
return this.requestHandler.request(Endpoints.GUILD_CHANNELS(guildId), {}, "post", "json", data, Constants.reasonHeader(reason));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Batch update the positions of channels. Only those being moved needs to be included here
|
|
117
|
+
* @since 0.18.0
|
|
118
|
+
* @param guildId Id of the guild
|
|
119
|
+
* @param data Positional data to send
|
|
120
|
+
* @param reason Reason for updating the channels' positions
|
|
121
|
+
* @returns Resolves the Promise on successful execution
|
|
122
|
+
*
|
|
123
|
+
* | Permissions needed | Condition |
|
|
124
|
+
* |--------------------|-----------|
|
|
125
|
+
* | MANAGE_CHANNELS | always |
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* // Sets the position of a channel to 2 under a category channel
|
|
129
|
+
* const client = new SnowTransfer("TOKEN")
|
|
130
|
+
* client.guild.editChannelPositions("guild id", [{ id: "channel id", position: 2, parent_id: "category id" }], "they looked out of order")
|
|
131
|
+
*/
|
|
132
|
+
async editChannelPositions(guildId, data, reason) {
|
|
133
|
+
return this.requestHandler.request(Endpoints.GUILD_CHANNELS(guildId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns all active threads in the guild, including public and private threads. Threads are ordered by their `id`, in descending order
|
|
137
|
+
* @since 0.3.0
|
|
138
|
+
* @param guildId Id of the guild
|
|
139
|
+
* @returns All active threads and member objects of the CurrentUser that the CurrentUser has access to.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* const client = new SnowTransfer("TOKEN")
|
|
143
|
+
* const threads = await client.guild.listActiveThreads("guild id")
|
|
144
|
+
*/
|
|
145
|
+
async listActiveThreads(guildId) {
|
|
146
|
+
return this.requestHandler.request(Endpoints.GUILD_THREADS_ACTIVE(guildId), {}, "get", "json");
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get a guild member via Id
|
|
150
|
+
*
|
|
151
|
+
* CurrentUser must be a member of the guild
|
|
152
|
+
* @since 0.1.0
|
|
153
|
+
* @param guildId Id of the guild
|
|
154
|
+
* @param memberId Id of the guild member
|
|
155
|
+
* @returns [guild member](https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure)
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* const client = new SnowTransfer("TOKEN")
|
|
159
|
+
* const member = await client.guild.getGuildMember("guild id", "member id")
|
|
160
|
+
*/
|
|
161
|
+
async getGuildMember(guildId, memberId) {
|
|
162
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER(guildId, memberId), {}, "get", "json");
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get a list of guild members
|
|
166
|
+
*
|
|
167
|
+
* CurrentUser must be a member of the guild
|
|
168
|
+
* @since 0.1.0
|
|
169
|
+
* @param guildId Id of the guild
|
|
170
|
+
* @param options query data
|
|
171
|
+
* @returns list of [guild members](https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure)
|
|
172
|
+
*
|
|
173
|
+
* | Intents |
|
|
174
|
+
* |---------------|
|
|
175
|
+
* | GUILD_MEMBERS |
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* // Gets 10 members from a guild
|
|
179
|
+
* const client = new SnowTransfer("TOKEN")
|
|
180
|
+
* const members = await client.guild.getGuildMembers("guild id", { limit: 10 })
|
|
181
|
+
*/
|
|
182
|
+
async getGuildMembers(guildId, options) {
|
|
183
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBERS(guildId), options, "get", "json");
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get a list of guild members that match a query
|
|
187
|
+
* @since 0.3.0
|
|
188
|
+
* @param guildId Id of the guild
|
|
189
|
+
* @param options query data
|
|
190
|
+
* @returns list of [guild members](https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure)
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* // Gets all members with the username "Wolke"
|
|
194
|
+
* const client = new SnowTransfer("TOKEN")
|
|
195
|
+
* const members = await client.guild.searchGuildMembers("guild id", { query: "Wolke" })
|
|
196
|
+
*/
|
|
197
|
+
async searchGuildMembers(guildId, options) {
|
|
198
|
+
if (options.limit !== undefined && (options.limit < Constants.SEARCH_MEMBERS_MIN_RESULTS || options.limit > Constants.SEARCH_MEMBERS_MAX_RESULTS))
|
|
199
|
+
throw new RangeError(`Limit for searching guild members has to be between ${Constants.SEARCH_MEMBERS_MIN_RESULTS} and ${Constants.SEARCH_MEMBERS_MAX_RESULTS}`);
|
|
200
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBERS_SEARCH(guildId), options, "get", "json");
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Add a guild member to a guild via oauth2 access token
|
|
204
|
+
*
|
|
205
|
+
* CurrentUser must be a member of the guild
|
|
206
|
+
* @since 0.1.0
|
|
207
|
+
* @param guildId Id of the guild
|
|
208
|
+
* @param memberId Id of the guild member
|
|
209
|
+
* @param data object containing the needed request data
|
|
210
|
+
* @returns [guild member](https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure) or void if the member is already in the guild
|
|
211
|
+
*
|
|
212
|
+
* | Permissions needed | Condition |
|
|
213
|
+
* |-----------------------|-----------|
|
|
214
|
+
* | CREATE_INSTANT_INVITE | always |
|
|
215
|
+
*
|
|
216
|
+
* | OAUTH2 Scopes |
|
|
217
|
+
* |---------------|
|
|
218
|
+
* | guilds.join |
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* // add a user to a server
|
|
222
|
+
* const client = new SnowTransfer("TOKEN")
|
|
223
|
+
* const memberData = {
|
|
224
|
+
* access_token: "access token of a user with the guilds.join scope"
|
|
225
|
+
* }
|
|
226
|
+
* client.guild.addGuildMember("guildId", "memberId", memberData)
|
|
227
|
+
*/
|
|
228
|
+
async addGuildMember(guildId, memberId, data) {
|
|
229
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER(guildId, memberId), {}, "put", "json", data);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Update properties of a guild member
|
|
233
|
+
* @since 0.18.0
|
|
234
|
+
* @param guildId Id of the guild
|
|
235
|
+
* @param memberId Id of the guild member
|
|
236
|
+
* @param data Updated properties
|
|
237
|
+
* @param reason Reason for updating the guild member
|
|
238
|
+
* @returns Resolves the Promise on successful execution
|
|
239
|
+
*
|
|
240
|
+
* | Permissions needed | Condition |
|
|
241
|
+
* |--------------------|--------------|
|
|
242
|
+
* | MANAGE_NICKNAMES | Nick Updates |
|
|
243
|
+
* | MANAGE_ROLES | Role Updates |
|
|
244
|
+
* | MUTE_MEMBERS | Mute Updates |
|
|
245
|
+
* | DEAFEN_MEMBERS | Deaf Updates |
|
|
246
|
+
* | MOVE_MEMBERS | Voice Move |
|
|
247
|
+
* | CONNECT | Voice Move |
|
|
248
|
+
* | MODERATE_MEMBERS | Timeouts |
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* // Reset the nickname of a guild member
|
|
252
|
+
* const client = new SnowTransfer("TOKEN")
|
|
253
|
+
* const memberData = {
|
|
254
|
+
* nick: "" // You can reset nicknames by providing an empty string as the value of data.nick
|
|
255
|
+
* }
|
|
256
|
+
* const member = await client.guild.editGuildMember("guild Id", "memberId", memberData)
|
|
257
|
+
*/
|
|
258
|
+
async editGuildMember(guildId, memberId, data, reason) {
|
|
259
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER(guildId, memberId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Update the nick of the CurrentMember
|
|
263
|
+
* @since 0.18.0
|
|
264
|
+
* @param guildId Id of the guild
|
|
265
|
+
* @param data Data to update self with
|
|
266
|
+
* @param reason Reason for updating self
|
|
267
|
+
* @returns Resolves the Promise on successful execution
|
|
268
|
+
*
|
|
269
|
+
* | Permissions needed | Condition |
|
|
270
|
+
* |--------------------|-----------|
|
|
271
|
+
* | CHANGE_NICKNAME | always |
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* // change nick of bot to "Nice Nick"
|
|
275
|
+
* const client = new SnowTransfer("TOKEN")
|
|
276
|
+
* const nickData = {
|
|
277
|
+
* nick: "Nice Nick"
|
|
278
|
+
* }
|
|
279
|
+
* client.guild.editSelf("guildId", nickData)
|
|
280
|
+
*/
|
|
281
|
+
async editSelf(guildId, data, reason) {
|
|
282
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER(guildId, "@me"), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Add a role to a guild member
|
|
286
|
+
* @since 0.1.0
|
|
287
|
+
* @param guildId Id of the guild
|
|
288
|
+
* @param memberId Id of the guild member
|
|
289
|
+
* @param roleId Id of the role
|
|
290
|
+
* @param reason The reason for the role to be added
|
|
291
|
+
* @returns Resolves the Promise on successful execution
|
|
292
|
+
*
|
|
293
|
+
* | Permissions needed | Condition |
|
|
294
|
+
* |--------------------|-----------|
|
|
295
|
+
* | MANAGE_ROLES | always |
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* // add a role to a member with a reason of "I want to add a role"
|
|
299
|
+
* const client = new SnowTransfer("TOKEN")
|
|
300
|
+
* client.guild.addGuildMemberRole("guildId", "memberId", "roleId", "I want to add a role")
|
|
301
|
+
*/
|
|
302
|
+
async addGuildMemberRole(guildId, memberId, roleId, reason) {
|
|
303
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId), {}, "put", "json", {}, Constants.reasonHeader(reason));
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Remove a role from a guild member
|
|
307
|
+
* @since 0.18.0
|
|
308
|
+
* @param guildId Id of the guild
|
|
309
|
+
* @param memberId Id of the guild member
|
|
310
|
+
* @param roleId Id of the role
|
|
311
|
+
* @param reason The reason for the role to be removed
|
|
312
|
+
* @returns Resolves the Promise on successful execution
|
|
313
|
+
*
|
|
314
|
+
* | Permissions needed | Condition |
|
|
315
|
+
* |--------------------|-----------|
|
|
316
|
+
* | MANAGE_ROLES | always |
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* // remove a role from a member with a reason of "I want to remove a role"
|
|
320
|
+
* const client = new SnowTransfer("TOKEN")
|
|
321
|
+
* client.guild.deleteGuildMemberRole("guildId", "memberId", "roleId", "I want to remove a role")
|
|
322
|
+
*/
|
|
323
|
+
async deleteGuildMemberRole(guildId, memberId, roleId, reason) {
|
|
324
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId), {}, "delete", "json", {}, Constants.reasonHeader(reason));
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Remove a guild member (aka kick them)
|
|
328
|
+
* @since 0.18.0
|
|
329
|
+
* @param guildId Id of the guild
|
|
330
|
+
* @param memberId Id of the guild member
|
|
331
|
+
* @param reason Reason for kicking the member
|
|
332
|
+
* @returns Resolves the Promise on successful execution
|
|
333
|
+
*
|
|
334
|
+
* | Permissions needed | Condition |
|
|
335
|
+
* |--------------------|-----------|
|
|
336
|
+
* | KICK_MEMBERS | always |
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* // Kick a member with a reason of "spam"
|
|
340
|
+
* const client = new SnowTransfer("TOKEN")
|
|
341
|
+
* client.guild.deleteGuildMember("guild Id", "memberId", "spam")
|
|
342
|
+
*/
|
|
343
|
+
async deleteGuildMember(guildId, memberId, reason) {
|
|
344
|
+
return this.requestHandler.request(Endpoints.GUILD_MEMBER(guildId, memberId), {}, "delete", "json", {}, Constants.reasonHeader(reason));
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Get bans of a guild
|
|
348
|
+
* @since 0.1.0
|
|
349
|
+
* @param guildId Id of the guild
|
|
350
|
+
* @param options Query string options
|
|
351
|
+
* @returns List of [bans](https://discord.com/developers/docs/resources/guild#ban-object-ban-structure)
|
|
352
|
+
*
|
|
353
|
+
* | Permissions needed | Condition |
|
|
354
|
+
* |--------------------|-----------|
|
|
355
|
+
* | BAN_MEMBERS | always |
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* const client = new SnowTransfer("TOKEN")
|
|
359
|
+
* const bans = await client.guild.getGuildBans("guildId")
|
|
360
|
+
*/
|
|
361
|
+
async getGuildBans(guildId, options) {
|
|
362
|
+
return this.requestHandler.request(Endpoints.GUILD_BANS(guildId), options, "get", "json");
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Get a specific ban of a guild member
|
|
366
|
+
* @since 0.4.2
|
|
367
|
+
* @param guildId Id of the guild
|
|
368
|
+
* @param memberId Id of the member
|
|
369
|
+
* @returns [ban](https://discord.com/developers/docs/resources/guild#ban-object-ban-structure) object
|
|
370
|
+
*
|
|
371
|
+
* @throws a `DiscordAPIError` if the member is not banned
|
|
372
|
+
*
|
|
373
|
+
* | Permissions needed | Condition |
|
|
374
|
+
* |--------------------|-----------|
|
|
375
|
+
* | BAN_MEMBERS | always |
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* const client = new SnowTransfer("TOKEN")
|
|
379
|
+
* const ban = await client.guild.getGuildBan("guildId", "memberId")
|
|
380
|
+
*/
|
|
381
|
+
async getGuildBan(guildId, memberId) {
|
|
382
|
+
return this.requestHandler.request(Endpoints.GUILD_BAN(guildId, memberId), {}, "get", "json");
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Ban a guild member
|
|
386
|
+
* @since 0.1.0
|
|
387
|
+
* @param guildId Id of the guild
|
|
388
|
+
* @param memberId Id of the guild member
|
|
389
|
+
* @param data object with delete_message_days property
|
|
390
|
+
* @param reason Reason for banning the member
|
|
391
|
+
* @returns Resolves the Promise on successful execution
|
|
392
|
+
*
|
|
393
|
+
* | Permissions needed | Condition |
|
|
394
|
+
* |--------------------|-----------|
|
|
395
|
+
* | BAN_MEMBERS | always |
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* // Ban a user with a reason and delete the last 2 days of their messages
|
|
399
|
+
* const client = new SnowTransfer("TOKEN")
|
|
400
|
+
* const banData = {
|
|
401
|
+
* delete_message_days: 2
|
|
402
|
+
* }
|
|
403
|
+
* client.guild.createGuildBan("guild Id", "memberId", banData, "Memes were not good enough")
|
|
404
|
+
*/
|
|
405
|
+
async createGuildBan(guildId, memberId, data, reason) {
|
|
406
|
+
return this.requestHandler.request(Endpoints.GUILD_BAN(guildId, memberId), {}, "put", "json", data, Constants.reasonHeader(reason));
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Remove a ban of a user
|
|
410
|
+
* @since 0.18.0
|
|
411
|
+
* @param guildId Id of the guild
|
|
412
|
+
* @param memberId Id of the guild member
|
|
413
|
+
* @param reason Reason for removing the ban
|
|
414
|
+
* @returns Resolves the Promise on successful execution
|
|
415
|
+
*
|
|
416
|
+
* | Permissions needed | Condition |
|
|
417
|
+
* |--------------------|-----------|
|
|
418
|
+
* | BAN_MEMBERS | always |
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* // Remove a ban of a user with a reason
|
|
422
|
+
* const client = new SnowTransfer("TOKEN")
|
|
423
|
+
* client.guild.deleteGuildBan("guildId", "memberId", "This guy was cool")
|
|
424
|
+
*/
|
|
425
|
+
async deleteGuildBan(guildId, memberId, reason) {
|
|
426
|
+
return this.requestHandler.request(Endpoints.GUILD_BAN(guildId, memberId), {}, "delete", "json", {}, Constants.reasonHeader(reason));
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Get a list of roles for a guild
|
|
430
|
+
* @since 0.1.0
|
|
431
|
+
* @param guildId Id of the guild
|
|
432
|
+
* @returns array of [roles](https://discord.com/developers/docs/topics/permissions#role-object)
|
|
433
|
+
*
|
|
434
|
+
* | Permissions needed | Condition |
|
|
435
|
+
* |--------------------|-----------|
|
|
436
|
+
* | MANAGE_ROLES | always |
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* const client = new SnowTransfer("TOKEN")
|
|
440
|
+
* const roles = await client.guild.getGuildRoles("guildId")
|
|
441
|
+
*/
|
|
442
|
+
async getGuildRoles(guildId) {
|
|
443
|
+
return this.requestHandler.request(Endpoints.GUILD_ROLES(guildId), {}, "get", "json");
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Create a new Role
|
|
447
|
+
* @since 0.1.0
|
|
448
|
+
* @param guildId Id of the guild
|
|
449
|
+
* @param data data with role properties
|
|
450
|
+
* @param reason Reason for creating the role
|
|
451
|
+
* @returns [role](https://discord.com/developers/docs/resources/channel#channel-object-channel-structure)
|
|
452
|
+
*
|
|
453
|
+
* | Permissions needed | Condition |
|
|
454
|
+
* |--------------------|-----------|
|
|
455
|
+
* | MANAGE_ROLES | always |
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* // Create a role with the name "Nice Role" and a color of a soft blue
|
|
459
|
+
* const client = new SnowTransfer("TOKEN")
|
|
460
|
+
* const roleData = {
|
|
461
|
+
* name: "Nice Role",
|
|
462
|
+
* color: 0x7c7cf8
|
|
463
|
+
* }
|
|
464
|
+
* client.guild.createGuildRole("guild Id", roleData)
|
|
465
|
+
*/
|
|
466
|
+
async createGuildRole(guildId, data, reason) {
|
|
467
|
+
return this.requestHandler.request(Endpoints.GUILD_ROLES(guildId), {}, "post", "json", data, Constants.reasonHeader(reason));
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Modify the positions of roles
|
|
471
|
+
* @since 0.18.0
|
|
472
|
+
* @param guildId Id of the guild
|
|
473
|
+
* @param data Role data to update
|
|
474
|
+
* @param reason Reason for moving the roles
|
|
475
|
+
* @returns array of [roles](https://discord.com/developers/docs/topics/permissions#role-object)
|
|
476
|
+
*
|
|
477
|
+
* | Permissions needed | Condition |
|
|
478
|
+
* |--------------------|-----------|
|
|
479
|
+
* | MANAGE_ROLES | always |
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* const client = new SnowTransfer("TOKEN")
|
|
483
|
+
* const roles = await client.guild.editGuildRolePositions("guildId", [{ id: "guild id", position: 1 }, { id: "role id 2", position: 2 }])
|
|
484
|
+
*/
|
|
485
|
+
async editGuildRolePositions(guildId, data, reason) {
|
|
486
|
+
return this.requestHandler.request(Endpoints.GUILD_ROLES(guildId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Update a guild role
|
|
490
|
+
* @since 0.18.0
|
|
491
|
+
* @param guildId Id of the guild
|
|
492
|
+
* @param roleId Id of the role
|
|
493
|
+
* @param data updated properties of the role
|
|
494
|
+
* @param reason Reason for updating the role
|
|
495
|
+
* @returns [Updated Role](https://discord.com/developers/docs/topics/permissions#role-object)
|
|
496
|
+
*
|
|
497
|
+
* | Permissions needed | Condition |
|
|
498
|
+
* |--------------------|-----------|
|
|
499
|
+
* | MANAGE_ROLES | always |
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* const client = new SnowTransfer("TOKEN")
|
|
503
|
+
* const roleData = {
|
|
504
|
+
* name: "Nicer Role",
|
|
505
|
+
* }
|
|
506
|
+
* client.guild.editGuildRole("guildId", "roleId", roleData)
|
|
507
|
+
*/
|
|
508
|
+
async editGuildRole(guildId, roleId, data, reason) {
|
|
509
|
+
return this.requestHandler.request(Endpoints.GUILD_ROLE(guildId, roleId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Delete a role from the guild
|
|
513
|
+
* @since 0.18.0
|
|
514
|
+
* @param guildId Id of the guild
|
|
515
|
+
* @param roleId Id of the role
|
|
516
|
+
* @param reason Reason for deleting the role
|
|
517
|
+
* @returns Resolves the Promise on successful execution
|
|
518
|
+
*
|
|
519
|
+
* | Permissions needed | Condition |
|
|
520
|
+
* |--------------------|-----------|
|
|
521
|
+
* | MANAGE_ROLES | always |
|
|
522
|
+
*
|
|
523
|
+
* @example
|
|
524
|
+
* // Deletes a role with a reason "This role is too cool"
|
|
525
|
+
* const client = new SnowTransfer("TOKEN")
|
|
526
|
+
* client.guild.deleteGuildRole("guildId", "roleId", "This role is too cool")
|
|
527
|
+
*/
|
|
528
|
+
async deleteGuildRole(guildId, roleId, reason) {
|
|
529
|
+
return this.requestHandler.request(Endpoints.GUILD_ROLE(guildId, roleId), {}, "delete", "json", {}, Constants.reasonHeader(reason));
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Get the amount of members that would be pruned when a prune with the passed amount of days would be started
|
|
533
|
+
* @since 0.1.0
|
|
534
|
+
* @param guildId Id of the guild
|
|
535
|
+
* @param options Object with prune data
|
|
536
|
+
* @returns Object with a "pruned" key indicating the amount of members that would be pruned
|
|
537
|
+
*
|
|
538
|
+
* | Permissions needed | Condition |
|
|
539
|
+
* |--------------------|-----------|
|
|
540
|
+
* | KICK_MEMBERS | always |
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* const client = new SnowTransfer("TOKEN")
|
|
544
|
+
* const data = await client.guild.getGuildPruneCount("guildId", { days: 7 })
|
|
545
|
+
*/
|
|
546
|
+
async getGuildPruneCount(guildId, options) {
|
|
547
|
+
return this.requestHandler.request(Endpoints.GUILD_PRUNE(guildId), options, "get", "json");
|
|
548
|
+
}
|
|
549
|
+
async startGuildPrune(guildId, data, reason) {
|
|
550
|
+
return this.requestHandler.request(Endpoints.GUILD_PRUNE(guildId), {}, "post", "json", data, Constants.reasonHeader(reason));
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Get a list of voice regions for the guild, includes vip-regions unlike voice.getVoiceRegions
|
|
554
|
+
* @since 0.1.0
|
|
555
|
+
* @param guildId Id of the guild
|
|
556
|
+
* @returns List of [voice regions](https://discord.com/developers/docs/resources/voice#voice-region-object)
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* const client = new SnowTransfer("TOKEN")
|
|
560
|
+
* const regions = await client.guild.getGuildVoiceRegions("guildId")
|
|
561
|
+
*/
|
|
562
|
+
async getGuildVoiceRegions(guildId) {
|
|
563
|
+
return this.requestHandler.request(Endpoints.GUILD_VOICE_REGIONS(guildId), {}, "get", "json");
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Get invites for a guild
|
|
567
|
+
* @since 0.1.0
|
|
568
|
+
* @param guildId Id of the guild
|
|
569
|
+
* @returns List of [invites](https://discord.com/developers/docs/resources/invite#invite-object) (with metadata)
|
|
570
|
+
*
|
|
571
|
+
* | Permissions needed | Condition |
|
|
572
|
+
* |--------------------|-----------|
|
|
573
|
+
* | MANAGE_GUILD | always |
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* const client = new SnowTransfer("TOKEN")
|
|
577
|
+
* const invites = await client.guild.getGuildInvites("guildId")
|
|
578
|
+
*/
|
|
579
|
+
async getGuildInvites(guildId) {
|
|
580
|
+
return this.requestHandler.request(Endpoints.GUILD_INVITES(guildId), {}, "get", "json");
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Get integrations for a guild
|
|
584
|
+
* @since 0.1.0
|
|
585
|
+
* @param guildId Id of the guild
|
|
586
|
+
* @returns List of [integration objects](https://discord.com/developers/docs/resources/guild#integration-object)
|
|
587
|
+
*
|
|
588
|
+
* | Permissions needed | Condition |
|
|
589
|
+
* |--------------------|-----------|
|
|
590
|
+
* | MANAGE_GUILD | always |
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* const client = new SnowTransfer("TOKEN")
|
|
594
|
+
* const integrations = await client.guild.getGuildIntegrations("guildId")
|
|
595
|
+
*/
|
|
596
|
+
async getGuildIntegrations(guildId) {
|
|
597
|
+
return this.requestHandler.request(Endpoints.GUILD_INTEGRATIONS(guildId), {}, "get", "json");
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Delete a guild integration
|
|
601
|
+
* @since 0.18.0
|
|
602
|
+
* @param guildId Id of the guild
|
|
603
|
+
* @param integrationId Id of the integration
|
|
604
|
+
* @param reason Reason for removing the integration
|
|
605
|
+
* @returns Resolves the Promise on successful execution
|
|
606
|
+
*
|
|
607
|
+
* | Permissions needed | Condition |
|
|
608
|
+
* |--------------------|-----------|
|
|
609
|
+
* | MANAGE_GUILD | always |
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* const client = new SnowTransfer("TOKEN")
|
|
613
|
+
* await client.guild.deleteGuildIntegration("guildId", "integrationId", "Didn't need anymore")
|
|
614
|
+
*/
|
|
615
|
+
async deleteGuildIntegration(guildId, integrationId, reason) {
|
|
616
|
+
return this.requestHandler.request(Endpoints.GUILD_INTEGRATION(guildId, integrationId), {}, "delete", "json", {}, Constants.reasonHeader(reason));
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Get a guild widget settings object
|
|
620
|
+
* @since 0.3.0
|
|
621
|
+
* @param guildId Id of the guild
|
|
622
|
+
* @returns [Guild Widget settings](https://discord.com/developers/docs/resources/guild#guild-widget-settings-object-guild-widget-settings-structure)
|
|
623
|
+
*
|
|
624
|
+
* | Permissions needed | Condition |
|
|
625
|
+
* |--------------------|-----------|
|
|
626
|
+
* | MANAGE_GUILD | always |
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* const client = new SnowTransfer("TOKEN")
|
|
630
|
+
* const widgetSettings = await client.guild.getGuildWidgetSettings("guildId")
|
|
631
|
+
*/
|
|
632
|
+
async getGuildWidgetSettings(guildId) {
|
|
633
|
+
return this.requestHandler.request(Endpoints.GUILD_WIDGET_SETTINGS(guildId), {}, "get", "json");
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Update a guild widget settings object
|
|
637
|
+
* @since 0.18.0
|
|
638
|
+
* @param guildId Id of the guild
|
|
639
|
+
* @param data widget settings
|
|
640
|
+
* @param reason Reason for updating the guild widget settings
|
|
641
|
+
* @returns Updated [Guild Widget settings](https://discord.com/developers/docs/resources/guild#guild-widget-settings-object-guild-widget-settings-structure)
|
|
642
|
+
*
|
|
643
|
+
* | Permissions needed | Condition |
|
|
644
|
+
* |--------------------|-----------|
|
|
645
|
+
* | MANAGE_GUILD | always |
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* // Sets a widget as disabled
|
|
649
|
+
* const client = new SnowTransfer("TOKEN")
|
|
650
|
+
* const widgetSettings = await client.guild.editGuildWidgetSettings("guildId", { enabled: false })
|
|
651
|
+
*/
|
|
652
|
+
async editGuildWidgetSettings(guildId, data, reason) {
|
|
653
|
+
return this.requestHandler.request(Endpoints.GUILD_WIDGET_SETTINGS(guildId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Gets a guild widget object
|
|
657
|
+
* @since 0.3.0
|
|
658
|
+
* @param guildId Id of the guild
|
|
659
|
+
* @returns [Guild Widget](https://discord.com/developers/docs/resources/guild#guild-widget-object)
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* const client = new SnowTransfer("TOKEN")
|
|
663
|
+
* const widget = await client.guild.getGuildWidget("guildId")
|
|
664
|
+
*/
|
|
665
|
+
async getGuildWidget(guildId) {
|
|
666
|
+
return this.requestHandler.request(Endpoints.GUILD_WIDGET(guildId), {}, "get", "json");
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Get a guild's vanity URL code
|
|
670
|
+
* @since 0.3.0
|
|
671
|
+
* @param guildId Id of the guild
|
|
672
|
+
* @returns partial [invite object](https://discord.com/developers/docs/resources/guild#get-guild-vanity-url-example-partial-invite-object)
|
|
673
|
+
*
|
|
674
|
+
* | Permissions needed | Condition |
|
|
675
|
+
* |--------------------|-----------|
|
|
676
|
+
* | MANAGE_GUILD | always |
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* const client = new SnowTransfer("TOKEN")
|
|
680
|
+
* const vanityUrl = await client.guild.getGuildVanityUrl("guildId")
|
|
681
|
+
*/
|
|
682
|
+
async getGuildVanityURL(guildId) {
|
|
683
|
+
return this.requestHandler.request(Endpoints.GUILD_VANITY(guildId), {}, "get", "json");
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Get a guild's welcome screen object
|
|
687
|
+
* @since 0.3.0
|
|
688
|
+
* @param guildId Id of the guild
|
|
689
|
+
* @returns [Guild Welcome Screen](https://discord.com/developers/docs/resources/guild#welcome-screen-object)
|
|
690
|
+
*
|
|
691
|
+
* | Permissions needed | Condition |
|
|
692
|
+
* |--------------------|--------------------------------------|
|
|
693
|
+
* | MANAGE_GUILD | if the welcome screen is not enabled |
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* const client = new SnowTransfer("TOKEN")
|
|
697
|
+
* const welcomeScreen = await client.guild.getGuildWelcomeScreen("guildId")
|
|
698
|
+
*/
|
|
699
|
+
async getGuildWelcomeScreen(guildId) {
|
|
700
|
+
return this.requestHandler.request(Endpoints.GUILD_WELCOME_SCREEN(guildId), {}, "get", "json");
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Update a guild welcome screen object
|
|
704
|
+
* @since 0.18.0
|
|
705
|
+
* @param guildId Id of guild
|
|
706
|
+
* @param data Welcome screen data
|
|
707
|
+
* @param reason Reason for editing the welcome screen
|
|
708
|
+
* @returns [Guild Welcome Screen](https://discord.com/developers/docs/resources/guild#welcome-screen-object)
|
|
709
|
+
*
|
|
710
|
+
* | Permissions needed | Condition |
|
|
711
|
+
* |--------------------|-----------|
|
|
712
|
+
* | MANAGE_GUILD | always |
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* // Disabled the welcome screen
|
|
716
|
+
* const client = new SnowTransfer("TOKEN")
|
|
717
|
+
* const welcomeScreen = await client.guild.editGuildWelcomeScreen("guildId", { enabled: false })
|
|
718
|
+
*/
|
|
719
|
+
async editGuildWelcomeScreen(guildId, data, reason) {
|
|
720
|
+
return this.requestHandler.request(Endpoints.GUILD_WELCOME_SCREEN(guildId), {}, "patch", "json", data, Constants.reasonHeader(reason));
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Updates the current user's voice state in a stage channel
|
|
724
|
+
* @since 0.18.0
|
|
725
|
+
* @param guildId Id of the guild
|
|
726
|
+
* @param data Data of the voice state
|
|
727
|
+
* @returns Resolves the Promise on successful execution
|
|
728
|
+
*
|
|
729
|
+
* | Permissions needed | Condition |
|
|
730
|
+
* |--------------------|-------------------------------------|
|
|
731
|
+
* | MUTE_MEMBERS | when trying to un-suppress yourself |
|
|
732
|
+
* | REQUEST_TO_SPEAK | when trying to request to speak |
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* // Unsuppresses the CurrentUser in the stage channel they're in
|
|
736
|
+
* const client = new SnowTransfer("TOKEN")
|
|
737
|
+
* client.guild.editCurrentUserVoiceState("guildId", { channel_id: "channel id", suppress: false })
|
|
738
|
+
*/
|
|
739
|
+
async editCurrentUserVoiceState(guildId, data) {
|
|
740
|
+
return this.requestHandler.request(Endpoints.GUILD_VOICE_STATE_USER(guildId, "@me"), {}, "patch", "json", data);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Updates a user's voice state in a stage channel
|
|
744
|
+
* @since 0.18.0
|
|
745
|
+
* @param guildId Id of the guild
|
|
746
|
+
* @param userId Id of the user
|
|
747
|
+
* @param data Data of the voice state
|
|
748
|
+
* @returns Resolves the Promise on successful execution
|
|
749
|
+
*
|
|
750
|
+
* | Permissions needed | Condition |
|
|
751
|
+
* |--------------------|-------------------------------------|
|
|
752
|
+
* | MUTE_MEMBERS | when trying to suppress/un-suppress |
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* // Suppresses the user in the stage channel they're in
|
|
756
|
+
* const client = new SnowTransfer("TOKEN")
|
|
757
|
+
* client.guild.editUserVoiceState("guildId", "userId", { channel_id: "channel id", suppress: true })
|
|
758
|
+
*/
|
|
759
|
+
async editUserVoiceState(guildId, userId, data) {
|
|
760
|
+
return this.requestHandler.request(Endpoints.GUILD_VOICE_STATE_USER(guildId, userId), {}, "patch", "json", data);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Searches a guild for messages that match a query
|
|
764
|
+
* @since 0.17.6
|
|
765
|
+
* @param guildId Id of the guild
|
|
766
|
+
* @param options Options for the search
|
|
767
|
+
* @returns A [search result](https://docs.discord.com/developers/resources/message#search-guild-messages-response-body) containing the matched messages, or an index-not-ready response if the guild hasn't finished indexing yet
|
|
768
|
+
*
|
|
769
|
+
* | Permissions needed | Condition |
|
|
770
|
+
* |----------------------|-----------|
|
|
771
|
+
* | READ_MESSAGE_HISTORY | Always |
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* // Finds messages that have the word "poggers" in their content
|
|
775
|
+
* const client = new SnowTransfer("TOKEN")
|
|
776
|
+
* const messages = await client.guild.searchGuildMessages("guildId", { content: "poggers" })
|
|
777
|
+
*/
|
|
778
|
+
async searchGuildMessages(guildId, options) {
|
|
779
|
+
return this.requestHandler.request(Endpoints.GUILD_MESSAGES_SEARCH(guildId), options, "get", "json");
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
module.exports = GuildMethods;
|
|
783
|
+
// Please end my suffering (ft. Papi)
|
|
784
|
+
// those moves https://youtu.be/oCrwzN6eb4Q?t=51s
|
|
785
|
+
// Papi: nice
|