@zygout/eris 0.0.0-stage → 0.19.1
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/LICENSE +20 -0
- package/README.md +108 -2
- package/esm.mjs +72 -0
- package/index.d.ts +4407 -0
- package/index.js +75 -0
- package/lib/Client.js +4708 -0
- package/lib/Constants.d.ts +990 -0
- package/lib/Constants.js +1163 -0
- package/lib/command/Command.js +552 -0
- package/lib/command/CommandClient.js +460 -0
- package/lib/errors/DiscordHTTPError.js +63 -0
- package/lib/errors/DiscordRESTError.js +77 -0
- package/lib/gateway/Shard.js +3029 -0
- package/lib/gateway/ShardManager.js +164 -0
- package/lib/rest/Endpoints.js +172 -0
- package/lib/rest/RequestHandler.js +459 -0
- package/lib/structures/ApplicationCommand.js +125 -0
- package/lib/structures/AutoModerationRule.js +143 -0
- package/lib/structures/AutocompleteInteraction.js +80 -0
- package/lib/structures/Base.js +81 -0
- package/lib/structures/CategoryChannel.js +77 -0
- package/lib/structures/Channel.js +98 -0
- package/lib/structures/CommandInteraction.js +473 -0
- package/lib/structures/ComponentInteraction.js +538 -0
- package/lib/structures/DMChannel.js +278 -0
- package/lib/structures/Entitlement.js +77 -0
- package/lib/structures/ExtendedUser.js +46 -0
- package/lib/structures/ForumChannel.js +24 -0
- package/lib/structures/GroupChannel.js +106 -0
- package/lib/structures/Guild.js +1677 -0
- package/lib/structures/GuildAuditLogEntry.js +190 -0
- package/lib/structures/GuildChannel.js +128 -0
- package/lib/structures/GuildIntegration.js +99 -0
- package/lib/structures/GuildPreview.js +97 -0
- package/lib/structures/GuildScheduledEvent.js +176 -0
- package/lib/structures/GuildTemplate.js +76 -0
- package/lib/structures/GuildTextableChannel.js +260 -0
- package/lib/structures/Interaction.js +133 -0
- package/lib/structures/Invite.js +143 -0
- package/lib/structures/Lobby.js +108 -0
- package/lib/structures/LobbyMember.js +59 -0
- package/lib/structures/MediaChannel.js +216 -0
- package/lib/structures/Member.js +371 -0
- package/lib/structures/Message.js +708 -0
- package/lib/structures/ModalSubmitInteraction.js +478 -0
- package/lib/structures/NewsChannel.js +34 -0
- package/lib/structures/NewsThreadChannel.js +12 -0
- package/lib/structures/Permission.js +80 -0
- package/lib/structures/PermissionOverwrite.js +32 -0
- package/lib/structures/PingInteraction.js +39 -0
- package/lib/structures/PrivateThreadChannel.js +25 -0
- package/lib/structures/PublicThreadChannel.js +26 -0
- package/lib/structures/Role.js +163 -0
- package/lib/structures/SKU.js +80 -0
- package/lib/structures/SoundboardSound.js +79 -0
- package/lib/structures/StageChannel.js +59 -0
- package/lib/structures/StageInstance.js +55 -0
- package/lib/structures/Subscription.js +69 -0
- package/lib/structures/TextChannel.js +202 -0
- package/lib/structures/ThreadChannel.js +143 -0
- package/lib/structures/ThreadMember.js +59 -0
- package/lib/structures/UnavailableGuild.js +26 -0
- package/lib/structures/UnknownInteraction.js +502 -0
- package/lib/structures/User.js +296 -0
- package/lib/structures/VoiceChannel.js +166 -0
- package/lib/structures/VoiceState.js +84 -0
- package/lib/util/BrowserWebSocket.js +76 -0
- package/lib/util/Bucket.js +89 -0
- package/lib/util/Collection.js +202 -0
- package/lib/util/MultipartData.js +70 -0
- package/lib/util/Opus.js +33 -0
- package/lib/util/SequentialBucket.js +83 -0
- package/lib/util/emitDeprecation.js +26 -0
- package/lib/voice/Piper.js +300 -0
- package/lib/voice/SharedStream.js +238 -0
- package/lib/voice/VoiceConnection.js +1440 -0
- package/lib/voice/VoiceConnectionManager.js +151 -0
- package/lib/voice/VoiceDataStream.js +22 -0
- package/lib/voice/streams/BaseTransformer.js +40 -0
- package/lib/voice/streams/DCAOpusTransformer.js +78 -0
- package/lib/voice/streams/FFmpegDuplex.js +192 -0
- package/lib/voice/streams/FFmpegOggTransformer.js +35 -0
- package/lib/voice/streams/FFmpegPCMTransformer.js +26 -0
- package/lib/voice/streams/OggOpusTransformer.js +108 -0
- package/lib/voice/streams/PCMOpusTransformer.js +61 -0
- package/lib/voice/streams/VolumeTransformer.js +50 -0
- package/lib/voice/streams/WebmOpusTransformer.js +258 -0
- package/package.json +81 -4
|
@@ -0,0 +1,1677 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Base = require("./Base");
|
|
4
|
+
const Channel = require("./Channel");
|
|
5
|
+
const Endpoints = require("../rest/Endpoints");
|
|
6
|
+
const Collection = require("../util/Collection");
|
|
7
|
+
const GuildChannel = require("./GuildChannel");
|
|
8
|
+
const Member = require("./Member");
|
|
9
|
+
const Role = require("./Role");
|
|
10
|
+
const VoiceState = require("./VoiceState");
|
|
11
|
+
const Permission = require("./Permission");
|
|
12
|
+
const GuildScheduledEvent = require("./GuildScheduledEvent");
|
|
13
|
+
const { EntitlementOwnerTypes, Permissions } = require("../Constants");
|
|
14
|
+
const StageInstance = require("./StageInstance");
|
|
15
|
+
const ThreadChannel = require("./ThreadChannel");
|
|
16
|
+
const AutoModerationRule = require("./AutoModerationRule");
|
|
17
|
+
const SoundboardSound = require("./SoundboardSound");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents a guild
|
|
21
|
+
* @prop {String?} afkChannelID The ID of the AFK voice channel
|
|
22
|
+
* @prop {Number} afkTimeout The AFK timeout in seconds
|
|
23
|
+
* @prop {String?} applicationID The application ID of the guild creator if it is bot-created
|
|
24
|
+
* @prop {Number?} approximateMemberCount The approximate number of members in the guild (REST only)
|
|
25
|
+
* @prop {Number?} approximatePresenceCount The approximate number of presences in the guild (REST only)
|
|
26
|
+
* @prop {Boolean?} autoRemoved Whether the guild was automatically removed from Discovery
|
|
27
|
+
* @prop {String?} banner The hash of the guild banner image, or null if no banner (VIP only)
|
|
28
|
+
* @prop {String?} bannerURL The URL of the guild's banner image
|
|
29
|
+
* @prop {Array<Object>?} categories The guild's discovery categories
|
|
30
|
+
* @prop {Collection<GuildChannel>} channels Collection of Channels in the guild
|
|
31
|
+
* @prop {Number} createdAt Timestamp of the guild's creation
|
|
32
|
+
* @prop {Number} defaultNotifications The default notification settings for the guild. 0 is "All Messages", 1 is "Only @mentions"
|
|
33
|
+
* @prop {String?} description The description for the guild (VIP only)
|
|
34
|
+
* @prop {String?} discoverySplash The has of the guild discovery splash image, or null if no discovery splash
|
|
35
|
+
* @prop {String?} discoverySplashURL The URL of the guild's discovery splash image
|
|
36
|
+
* @prop {Number?} emojiCount The number of emojis in the guild
|
|
37
|
+
* @prop {Array<Object>} emojis An array of guild emoji objects
|
|
38
|
+
* @prop {Number} explicitContentFilter The explicit content filter level for the guild. 0 is off, 1 is on for people without roles, 2 is on for all
|
|
39
|
+
* @prop {Array<String>} features An array of guild feature strings
|
|
40
|
+
* @prop {String?} icon The hash of the guild icon, or null if no icon
|
|
41
|
+
* @prop {String?} iconURL The URL of the guild's icon
|
|
42
|
+
* @prop {String} id The ID of the guild
|
|
43
|
+
* @prop {Object?} incidentsData The incidents data for the guild
|
|
44
|
+
* @prop {Number?} incidentsData.dmsDisabledUntil When DMs will get enabled again
|
|
45
|
+
* @prop {Number?} incidentsData.dmSpamDetectedAt When the DM spam was detected
|
|
46
|
+
* @prop {Number?} incidentsData.invitesDisabledUntil When invites will get enabled again
|
|
47
|
+
* @prop {Number?} incidentsData.raidDetectedAt When the raid was detected
|
|
48
|
+
* @prop {Number} joinedAt Timestamp of when the bot account joined the guild
|
|
49
|
+
* @prop {Array<String>?} keywords The guild's discovery keywords
|
|
50
|
+
* @prop {Boolean} large Whether the guild is "large" by "some Discord standard"
|
|
51
|
+
* @prop {Number} mfaLevel The admin 2FA level for the guild. 0 is not required, 1 is required
|
|
52
|
+
* @prop {Number?} maxMembers The maximum amount of members for the guild
|
|
53
|
+
* @prop {Number} maxPresences The maximum number of people that can be online in a guild at once (returned from REST API only)
|
|
54
|
+
* @prop {Number?} maxStageVideoChannelUsers The max number of users allowed in a stage video channel
|
|
55
|
+
* @prop {Number?} maxVideoChannelUsers The max number of users allowed in a video channel
|
|
56
|
+
* @prop {Number} memberCount Number of members in the guild
|
|
57
|
+
* @prop {Collection<Member>} members Collection of Members in the guild
|
|
58
|
+
* @prop {String} name The name of the guild
|
|
59
|
+
* @prop {Boolean} nsfw [DEPRECATED] Whether the guild is designated as NSFW by Discord
|
|
60
|
+
* @prop {Number} nsfwLevel The guild NSFW level designated by Discord
|
|
61
|
+
* @prop {String} ownerID The ID of the user that is the guild owner
|
|
62
|
+
* @prop {String} preferredLocale Preferred "COMMUNITY" guild language used in server discovery and notices from Discord
|
|
63
|
+
* @prop {Boolean} premiumProgressBarEnabled If the boost progress bar is enabled
|
|
64
|
+
* @prop {Number?} premiumSubscriptionCount The total number of users currently boosting this guild
|
|
65
|
+
* @prop {Number} premiumTier Nitro boost level of the guild
|
|
66
|
+
* @prop {Object?} primaryCategory The guild's primary discovery category
|
|
67
|
+
* @prop {Number?} primaryCategoryID The guild's primary discovery category ID
|
|
68
|
+
* @prop {String?} publicUpdatesChannelID ID of the guild's updates channel if the guild has "COMMUNITY" features
|
|
69
|
+
* @prop {Collection<Role>} roles Collection of Roles in the guild
|
|
70
|
+
* @prop {String?} rulesChannelID The channel where "COMMUNITY" guilds display rules and/or guidelines
|
|
71
|
+
* @prop {String?} safetyAlertsChannelID The channel ID where admins and moderators of Community guilds receive safety alerts from Discord
|
|
72
|
+
* @prop {Shard} shard The Shard that owns the guild
|
|
73
|
+
* @prop {Collection<SoundboardSound>} soundboardSounds Collection of Soundboard Sounds in the guild
|
|
74
|
+
* @prop {String?} splash The hash of the guild splash image, or null if no splash (VIP only)
|
|
75
|
+
* @prop {String?} splashURL The URL of the guild's splash image
|
|
76
|
+
* @prop {Collection<StageInstance>} stageInstances Collection of stage instances in the guild
|
|
77
|
+
* @prop {Array<Object>?} stickers An array of guild sticker objects
|
|
78
|
+
* @prop {Number} systemChannelFlags The flags for the system channel
|
|
79
|
+
* @prop {String?} systemChannelID The ID of the default channel for system messages (built-in join messages and boost messages)
|
|
80
|
+
* @prop {Collection<ThreadChannel>} threads Collection of threads that the current user has permission to view
|
|
81
|
+
* @prop {Boolean} unavailable Whether the guild is unavailable or not
|
|
82
|
+
* @prop {String?} vanityURL The vanity URL of the guild (VIP only)
|
|
83
|
+
* @prop {Number} verificationLevel The guild verification level
|
|
84
|
+
* @prop {Collection<VoiceState>} voiceStates Collection of voice states in the guild
|
|
85
|
+
* @prop {Object?} welcomeScreen The welcome screen of a Community guild, shown to new members
|
|
86
|
+
* @prop {Object} welcomeScreen.description The description in the welcome screen
|
|
87
|
+
* @prop {Array<Object>} welcomeScreen.welcomeChannels The list of channels in the welcome screens. Each channels have the following properties: `channelID`, `description`, `emojiID`, `emojiName`. `emojiID` and `emojiName` properties can be null.
|
|
88
|
+
* @prop {Number?} widgetChannelID The channel id that the widget will generate an invite to. REST only.
|
|
89
|
+
* @prop {Boolean?} widgetEnabled Whether the guild widget is enabled. REST only.
|
|
90
|
+
*/
|
|
91
|
+
class Guild extends Base {
|
|
92
|
+
constructor(data, client) {
|
|
93
|
+
super(data.id);
|
|
94
|
+
this._client = client;
|
|
95
|
+
this.shard = client.shards.get(client.guildShardMap[this.id] || (Base.getDiscordEpoch(data.id) % client.options.maxShards) || 0);
|
|
96
|
+
this.unavailable = !!data.unavailable;
|
|
97
|
+
this.joinedAt = Date.parse(data.joined_at);
|
|
98
|
+
this.voiceStates = new Collection(VoiceState);
|
|
99
|
+
this.channels = new Collection(GuildChannel);
|
|
100
|
+
this.threads = new Collection(ThreadChannel);
|
|
101
|
+
this.members = new Collection(Member);
|
|
102
|
+
this.events = new Collection(GuildScheduledEvent);
|
|
103
|
+
this.stageInstances = new Collection(StageInstance);
|
|
104
|
+
this.soundboardSounds = new Collection(SoundboardSound);
|
|
105
|
+
this.memberCount = data.member_count;
|
|
106
|
+
this.roles = new Collection(Role);
|
|
107
|
+
this.autoModerationRules = new Collection(AutoModerationRule);
|
|
108
|
+
this.applicationID = data.application_id;
|
|
109
|
+
|
|
110
|
+
if (data.widget_enabled !== undefined) {
|
|
111
|
+
this.widgetEnabled = data.widget_enabled;
|
|
112
|
+
}
|
|
113
|
+
if (data.widget_channel_id !== undefined) {
|
|
114
|
+
this.widgetChannelID = data.widget_channel_id;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (data.approximate_member_count !== undefined) {
|
|
118
|
+
this.approximateMemberCount = data.approximate_member_count;
|
|
119
|
+
}
|
|
120
|
+
if (data.approximate_presence_count !== undefined) {
|
|
121
|
+
this.approximatePresenceCount = data.approximate_presence_count;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (data.auto_removed !== undefined) {
|
|
125
|
+
this.autoRemoved = data.auto_removed;
|
|
126
|
+
}
|
|
127
|
+
if (data.emoji_count !== undefined) {
|
|
128
|
+
this.emojiCount = data.emoji_count;
|
|
129
|
+
}
|
|
130
|
+
if (data.primary_category_id !== undefined) {
|
|
131
|
+
this.primaryCategoryID = data.primary_category_id;
|
|
132
|
+
}
|
|
133
|
+
if (data.primary_category) {
|
|
134
|
+
this.primaryCategory = data.primary_category;
|
|
135
|
+
}
|
|
136
|
+
if (data.categories !== undefined) {
|
|
137
|
+
this.categories = data.categories;
|
|
138
|
+
}
|
|
139
|
+
if (data.keywords !== undefined) {
|
|
140
|
+
this.keywords = data.keywords;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (data.roles) {
|
|
144
|
+
for (const role of data.roles) {
|
|
145
|
+
this.roles.add(role, this);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (data.channels) {
|
|
150
|
+
for (const channelData of data.channels) {
|
|
151
|
+
channelData.guild_id = this.id;
|
|
152
|
+
const channel = Channel.from(channelData, client);
|
|
153
|
+
channel.guild = this;
|
|
154
|
+
this.channels.add(channel, client);
|
|
155
|
+
client.channelGuildMap[channel.id] = this.id;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (data.threads) {
|
|
160
|
+
for (const threadData of data.threads) {
|
|
161
|
+
threadData.guild_id = this.id;
|
|
162
|
+
const channel = Channel.from(threadData, client);
|
|
163
|
+
channel.guild = this;
|
|
164
|
+
this.threads.add(channel, client);
|
|
165
|
+
client.threadGuildMap[channel.id] = this.id;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (data.members) {
|
|
170
|
+
for (const member of data.members) {
|
|
171
|
+
member.id = member.user.id;
|
|
172
|
+
this.members.add(member, this);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (data.stage_instances) {
|
|
177
|
+
for (const stageInstance of data.stage_instances) {
|
|
178
|
+
stageInstance.guild_id = this.id;
|
|
179
|
+
this.stageInstances.add(stageInstance, client);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (data.soundboard_sounds) {
|
|
184
|
+
for (const sound of data.soundboard_sounds) {
|
|
185
|
+
sound.id = sound.sound_id;
|
|
186
|
+
this.soundboardSounds.add(sound, client);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (data.presences) {
|
|
191
|
+
for (const presence of data.presences) {
|
|
192
|
+
if (!this.members.get(presence.user.id)) {
|
|
193
|
+
let userData = client.users.get(presence.user.id);
|
|
194
|
+
if (userData) {
|
|
195
|
+
userData = `{username: ${userData.username}, id: ${userData.id}, discriminator: ${userData.discriminator}}`;
|
|
196
|
+
}
|
|
197
|
+
client.emit("debug", `Presence without member. ${presence.user.id}. In global user cache: ${userData}. ` + JSON.stringify(presence), this.shard.id);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
presence.id = presence.user.id;
|
|
201
|
+
this.members.update(presence);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (data.voice_states) {
|
|
206
|
+
for (const voiceState of data.voice_states) {
|
|
207
|
+
if (!this.members.get(voiceState.user_id)) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
voiceState.id = voiceState.user_id;
|
|
211
|
+
try {
|
|
212
|
+
const channel = this.channels.get(voiceState.channel_id);
|
|
213
|
+
const member = this.members.update(voiceState);
|
|
214
|
+
if (channel && channel.voiceMembers) {
|
|
215
|
+
channel.voiceMembers.add(member);
|
|
216
|
+
}
|
|
217
|
+
} catch (err) {
|
|
218
|
+
client.emit("error", err, this.shard.id);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (client.options.seedVoiceConnections && voiceState.id === client.user.id && !client.voiceConnections.get(this.id)) {
|
|
222
|
+
process.nextTick(() => this._client.joinVoiceChannel(voiceState.channel_id));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (data.guild_scheduled_events) {
|
|
228
|
+
for (const eventData of data.guild_scheduled_events) {
|
|
229
|
+
this.events.add(eventData, client);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this.update(data);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
update(data) {
|
|
237
|
+
if (data.name !== undefined) {
|
|
238
|
+
this.name = data.name;
|
|
239
|
+
}
|
|
240
|
+
if (data.verification_level !== undefined) {
|
|
241
|
+
this.verificationLevel = data.verification_level;
|
|
242
|
+
}
|
|
243
|
+
if (data.splash !== undefined) {
|
|
244
|
+
this.splash = data.splash;
|
|
245
|
+
}
|
|
246
|
+
if (data.discovery_splash !== undefined) {
|
|
247
|
+
this.discoverySplash = data.discovery_splash;
|
|
248
|
+
}
|
|
249
|
+
if (data.banner !== undefined) {
|
|
250
|
+
this.banner = data.banner;
|
|
251
|
+
}
|
|
252
|
+
if (data.owner_id !== undefined) {
|
|
253
|
+
this.ownerID = data.owner_id;
|
|
254
|
+
}
|
|
255
|
+
if (data.icon !== undefined) {
|
|
256
|
+
this.icon = data.icon;
|
|
257
|
+
}
|
|
258
|
+
if (data.icon_hash !== undefined) {
|
|
259
|
+
this.icon = data.icon_hash;
|
|
260
|
+
}
|
|
261
|
+
if (data.features !== undefined) {
|
|
262
|
+
this.features = data.features;
|
|
263
|
+
}
|
|
264
|
+
if (data.emojis !== undefined) {
|
|
265
|
+
this.emojis = data.emojis;
|
|
266
|
+
}
|
|
267
|
+
if (data.stickers !== undefined) {
|
|
268
|
+
this.stickers = data.stickers;
|
|
269
|
+
}
|
|
270
|
+
if (data.afk_channel_id !== undefined) {
|
|
271
|
+
this.afkChannelID = data.afk_channel_id;
|
|
272
|
+
}
|
|
273
|
+
if (data.afk_timeout !== undefined) {
|
|
274
|
+
this.afkTimeout = data.afk_timeout;
|
|
275
|
+
}
|
|
276
|
+
if (data.default_message_notifications !== undefined) {
|
|
277
|
+
this.defaultNotifications = data.default_message_notifications;
|
|
278
|
+
}
|
|
279
|
+
if (data.mfa_level !== undefined) {
|
|
280
|
+
this.mfaLevel = data.mfa_level;
|
|
281
|
+
}
|
|
282
|
+
if (data.large !== undefined) {
|
|
283
|
+
this.large = data.large;
|
|
284
|
+
}
|
|
285
|
+
if (data.max_presences !== undefined) {
|
|
286
|
+
this.maxPresences = data.max_presences;
|
|
287
|
+
}
|
|
288
|
+
if (data.explicit_content_filter !== undefined) {
|
|
289
|
+
this.explicitContentFilter = data.explicit_content_filter;
|
|
290
|
+
}
|
|
291
|
+
if (data.system_channel_id !== undefined) {
|
|
292
|
+
this.systemChannelID = data.system_channel_id;
|
|
293
|
+
}
|
|
294
|
+
if (data.system_channel_flags !== undefined) {
|
|
295
|
+
this.systemChannelFlags = data.system_channel_flags;
|
|
296
|
+
}
|
|
297
|
+
if (data.premium_progress_bar_enabled !== undefined) {
|
|
298
|
+
this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
|
|
299
|
+
}
|
|
300
|
+
if (data.premium_tier !== undefined) {
|
|
301
|
+
this.premiumTier = data.premium_tier;
|
|
302
|
+
}
|
|
303
|
+
if (data.premium_subscription_count !== undefined) {
|
|
304
|
+
this.premiumSubscriptionCount = data.premium_subscription_count;
|
|
305
|
+
}
|
|
306
|
+
if (data.vanity_url_code !== undefined) {
|
|
307
|
+
this.vanityURL = data.vanity_url_code;
|
|
308
|
+
}
|
|
309
|
+
if (data.preferred_locale !== undefined) {
|
|
310
|
+
this.preferredLocale = data.preferred_locale;
|
|
311
|
+
}
|
|
312
|
+
if (data.description !== undefined) {
|
|
313
|
+
this.description = data.description;
|
|
314
|
+
}
|
|
315
|
+
if (data.max_members !== undefined) {
|
|
316
|
+
this.maxMembers = data.max_members;
|
|
317
|
+
}
|
|
318
|
+
if (data.public_updates_channel_id !== undefined) {
|
|
319
|
+
this.publicUpdatesChannelID = data.public_updates_channel_id;
|
|
320
|
+
}
|
|
321
|
+
if (data.rules_channel_id !== undefined) {
|
|
322
|
+
this.rulesChannelID = data.rules_channel_id;
|
|
323
|
+
}
|
|
324
|
+
if (data.max_video_channel_users !== undefined) {
|
|
325
|
+
this.maxVideoChannelUsers = data.max_video_channel_users;
|
|
326
|
+
}
|
|
327
|
+
if (data.max_stage_video_channel_users !== undefined) {
|
|
328
|
+
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users;
|
|
329
|
+
}
|
|
330
|
+
if (data.welcome_screen !== undefined) {
|
|
331
|
+
this.welcomeScreen = {
|
|
332
|
+
description: data.welcome_screen.description,
|
|
333
|
+
welcomeChannels: data.welcome_screen.welcome_channels && data.welcome_screen.welcome_channels.map((c) => {
|
|
334
|
+
return {
|
|
335
|
+
channelID: c.channel,
|
|
336
|
+
description: c.description,
|
|
337
|
+
emojiID: c.emoji_id,
|
|
338
|
+
emojiName: c.emoji_name,
|
|
339
|
+
};
|
|
340
|
+
}),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
if (data.nsfw !== undefined) {
|
|
344
|
+
this.nsfw = data.nsfw;
|
|
345
|
+
}
|
|
346
|
+
if (data.nsfw_level !== undefined) {
|
|
347
|
+
this.nsfwLevel = data.nsfw_level;
|
|
348
|
+
}
|
|
349
|
+
if (data.safety_alerts_channel_id !== undefined) {
|
|
350
|
+
this.safetyAlertsChannelID = data.safety_alerts_channel_id;
|
|
351
|
+
}
|
|
352
|
+
if (data.incidents_data !== undefined) {
|
|
353
|
+
this.incidentsData = data.incidents_data === null
|
|
354
|
+
? null
|
|
355
|
+
: {
|
|
356
|
+
dmsDisabledUntil: data.incidents_data.dms_disabled_until && Date.parse(data.incidents_data.dms_disabled_until),
|
|
357
|
+
dmSpamDetectedAt: data.incidents_data.dm_spam_detected_at && Date.parse(data.incidents_data.dm_spam_detected_at),
|
|
358
|
+
invitesDisabledUntil: data.incidents_data.invites_disabled_until && Date.parse(data.incidents_data.invites_disabled_until),
|
|
359
|
+
raidDetectedAt: data.incidents_data.raid_detected_at && Date.parse(data.incidents_data.raid_detected_at),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
get bannerURL() {
|
|
365
|
+
return this.banner ? this._client._formatImage(Endpoints.BANNER(this.id, this.banner)) : null;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
get iconURL() {
|
|
369
|
+
return this.icon ? this._client._formatImage(Endpoints.GUILD_ICON(this.id, this.icon)) : null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
get splashURL() {
|
|
373
|
+
return this.splash ? this._client._formatImage(Endpoints.GUILD_SPLASH(this.id, this.splash)) : null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
get discoverySplashURL() {
|
|
377
|
+
return this.discoverySplash ? this._client._formatImage(Endpoints.GUILD_DISCOVERY_SPLASH(this.id, this.discoverySplash)) : null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Add a discovery subcategory
|
|
382
|
+
* @arg {String} categoryID The ID of the discovery category
|
|
383
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
384
|
+
* @returns {Promise<Object>}
|
|
385
|
+
*/
|
|
386
|
+
addDiscoverySubcategory(categoryID, reason) {
|
|
387
|
+
return this._client.addGuildDiscoverySubcategory.call(this._client, this.id, categoryID, reason);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Add a user to the guild
|
|
392
|
+
* @arg {String} userID The ID of the user
|
|
393
|
+
* @arg {String} accessToken The access token of the user
|
|
394
|
+
* @arg {Object} [options] Options for adding the user
|
|
395
|
+
* @arg {Boolean} [options.deaf] Whether the user should be deafened
|
|
396
|
+
* @arg {Boolean} [options.mute] Whether the user should be muted
|
|
397
|
+
* @arg {String} [options.nick] The user's nickname
|
|
398
|
+
* @arg {Array<String>} [options.roles] Array of role IDs to add to the user
|
|
399
|
+
*/
|
|
400
|
+
addMember(userID, accessToken, options = {}) {
|
|
401
|
+
return this._client.addGuildMember.call(this._client, this.id, userID, accessToken, options);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Add a role to a guild member
|
|
406
|
+
* @arg {String} memberID The ID of the member
|
|
407
|
+
* @arg {String} roleID The ID of the role
|
|
408
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
409
|
+
* @returns {Promise}
|
|
410
|
+
*/
|
|
411
|
+
addMemberRole(memberID, roleID, reason) {
|
|
412
|
+
return this._client.addGuildMemberRole.call(this._client, this.id, memberID, roleID, reason);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Ban a user from the guild
|
|
417
|
+
* @arg {String} userID The ID of the member
|
|
418
|
+
* @arg {Number} [options.deleteMessageDays=0] [DEPRECATED] Number of days to delete messages for, between 0-7 inclusive
|
|
419
|
+
* @arg {Number} [options.deleteMessageSeconds=0] Number of seconds to delete messages for, between 0 and 604,800 inclusive
|
|
420
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
421
|
+
* @arg {String} [reason] [DEPRECATED] The reason to be displayed in audit logs
|
|
422
|
+
* @returns {Promise}
|
|
423
|
+
*/
|
|
424
|
+
banMember(userID, options, reason) {
|
|
425
|
+
return this._client.banGuildMember.call(this._client, this.id, userID, options, reason);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Bulk ban users from the guild - Note: Requires both BAN_MEMBERS and MANAGE_GUILD permissions
|
|
430
|
+
* @arg {Object} options Options for banning the users
|
|
431
|
+
* @arg {Array<String>} options.userIDs Array of user IDs to ban
|
|
432
|
+
* @arg {Number} [options.deleteMessageSeconds=0] Number of seconds to delete messages for each user, between 0 and 604800 inclusive
|
|
433
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
434
|
+
* @returns {Promise<Object>} An object with 2 arrays - `banned_users` with the IDs of the successfully banned users, and `failed_users` with the IDs of any users who could not be banned or were already banned
|
|
435
|
+
*/
|
|
436
|
+
bulkBanMembers(options) {
|
|
437
|
+
return this._client.bulkBanGuildMembers.call(this._client, this.id, options);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Bulk create/edit the guild application commands
|
|
442
|
+
* @arg {Array<Object>} commands An array of command objects
|
|
443
|
+
* @arg {BigInt | Number | String | Permission?} commands[].defaultMemberPermissions The default permissions the user must have to use the command
|
|
444
|
+
* @arg {Boolean} [commands[].defaultPermission=true] [DEPRECATED] Whether the command is enabled by default when the application is added to a guild. Replaced by `defaultMemberPermissions`
|
|
445
|
+
* @arg {String} [commands[].description] The command description, required for `CHAT_INPUT` commands
|
|
446
|
+
* @arg {Object?} [commands[].descriptionLocalizations] Localization directory with keys in [available locales](https://discord.dev/reference#locales) for the command description
|
|
447
|
+
* @arg {String} [commands[].id] The command ID, if known
|
|
448
|
+
* @arg {String} commands[].name The command name
|
|
449
|
+
* @arg {Object?} [commands[].nameLocalizations] Localization directory with keys in [available locales](https://discord.dev/reference#locales) for the command name
|
|
450
|
+
* @arg {Boolean} [commands[].nsfw=false] Whether the command is age-restricted
|
|
451
|
+
* @arg {Array<Object>} [commands[].options] The application command [options](https://discord.dev/interactions/application-commands#application-command-object-application-command-option-structure)
|
|
452
|
+
* @arg {Number} [commands[].type=1] The command type, either `1` for `CHAT_INPUT`, `2` for `USER` or `3` for `MESSAGE`
|
|
453
|
+
* @returns {Promise<Array<ApplicationCommand>>} Resolves with the overwritten application commands
|
|
454
|
+
*/
|
|
455
|
+
bulkEditCommands(commands) {
|
|
456
|
+
return this._client.bulkEditGuildCommands.call(this._client, this.id, commands);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Create an auto moderation rule
|
|
461
|
+
* @arg {Object} options The rule to create
|
|
462
|
+
* @arg {Array<Object>} options.actions The [actions](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object) done when the rule is violated. Their `metadata` takes camelCase keys, such as `durationSeconds`
|
|
463
|
+
* @arg {Boolean} [options.enabled=false] If the rule is enabled, false by default
|
|
464
|
+
* @arg {Number} options.eventType The [event type](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) for the rule
|
|
465
|
+
* @arg {Array<String>} [options.exemptChannels] Any channels where this rule does not apply
|
|
466
|
+
* @arg {Array<String>} [options.exemptRoles] Any roles to which this rule does not apply
|
|
467
|
+
* @arg {String} options.name The name of the rule
|
|
468
|
+
* @arg {Object} [options.triggerMetadata] The [trigger metadata](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) for the rule, with camelCase keys such as `keywordFilter`
|
|
469
|
+
* @arg {Number} options.triggerType The [trigger type](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) of the rule
|
|
470
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
471
|
+
* @returns {Promise<AutoModerationRule>}
|
|
472
|
+
*/
|
|
473
|
+
createAutoModerationRule(options) {
|
|
474
|
+
return this._client.createAutoModerationRule.call(this._client, this.id, options);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Create a channel in the guild
|
|
479
|
+
* @arg {String} name The name of the channel
|
|
480
|
+
* @arg {Number} [type=0] The type of the channel, either 0 (text), 2 (voice), 4 (category), 5 (news), 13 (stage), or 15 (forum)
|
|
481
|
+
* @arg {Object | String} [options] The properties the channel should have. If `options` is a string, it will be treated as `options.parentID` (see below). Passing a string is deprecated and will not be supported in future versions.
|
|
482
|
+
* @arg {Array<Object>} [options.availableTags] The available tags that can be applied to threads in a forum/media channel. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#forum-tag-object) for object structure (forum/media channels only, max 20)
|
|
483
|
+
* @arg {Number} [options.bitrate] The bitrate of the channel (voice channels only)
|
|
484
|
+
* @arg {Number} [options.defaultAutoArchiveDuration] The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080) (text/news/forum/media channels only)
|
|
485
|
+
* @arg {Number} [options.defaultForumLayout] The default forum layout type used to display posts in forum channels (forum channels only)
|
|
486
|
+
* @arg {Object} [options.defaultReactionEmoji] The emoji to show in the add reaction button on a thread in a forum/media channel (forum/media channels only)
|
|
487
|
+
* @arg {Number} [options.defaultSortOrder] The default sort order type used to order posts in forum/media channels (forum/media channels only)
|
|
488
|
+
* @arg {Number} [options.defaultThreadRateLimitPerUser] The initial rateLimitPerUser to set on newly created threads in a channel (text/forum/media channels only)
|
|
489
|
+
* @arg {Boolean} [options.nsfw] The nsfw status of the channel
|
|
490
|
+
* @arg {String?} [options.parentID] The ID of the parent category channel for this channel
|
|
491
|
+
* @arg {Array<Object>} [options.permissionOverwrites] An array containing permission overwrite objects
|
|
492
|
+
* @arg {Number} [options.position] The sorting position of the channel
|
|
493
|
+
* @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions) (text/voice/stage/forum/media channels only)
|
|
494
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
495
|
+
* @arg {String} [options.topic] The topic of the channel (text channels only)
|
|
496
|
+
* @arg {Number} [options.userLimit] The channel user limit (voice channels only)
|
|
497
|
+
* @returns {Promise<CategoryChannel | ForumChannel | TextChannel | VoiceChannel>}
|
|
498
|
+
*/
|
|
499
|
+
createChannel(name, type, reason, options) {
|
|
500
|
+
return this._client.createChannel.call(this._client, this.id, name, type, reason, options);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Create a guild application command
|
|
505
|
+
* @arg {Object} command A command object
|
|
506
|
+
* @arg {BigInt | Number | String | Permission?} command.defaultMemberPermissions The default permissions the user must have to use the command
|
|
507
|
+
* @arg {Boolean} [command.defaultPermission=true] [DEPRECATED] Whether the command is enabled by default when the application is added to a guild. Replaced by `defaultMemberPermissions`
|
|
508
|
+
* @arg {String} [command.description] The command description, required for `CHAT_INPUT` commands
|
|
509
|
+
* @arg {Object?} [command.descriptionLocalizations] Localization directory with keys in [available locales](https://discord.dev/reference#locales) for the command description
|
|
510
|
+
* @arg {String} command.name The command name
|
|
511
|
+
* @arg {Object?} [command.nameLocalizations] Localization directory with keys in [available locales](https://discord.dev/reference#locales) for the command name
|
|
512
|
+
* @arg {Boolean} [command.nsfw=false] Whether the command is age-restricted
|
|
513
|
+
* @arg {Array<Object>} [command.options] The application command [options](https://discord.dev/interactions/application-commands#application-command-object-application-command-option-structure)
|
|
514
|
+
* @arg {Number} [command.type=1] The command type, either `1` for `CHAT_INPUT`, `2` for `USER` or `3` for `MESSAGE`
|
|
515
|
+
* @returns {Promise<ApplicationCommand>} Resolves with the created application command
|
|
516
|
+
*/
|
|
517
|
+
createCommand(command) {
|
|
518
|
+
return this._client.createGuildCommand.call(this._client, this.id, command);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Create a emoji in the guild
|
|
523
|
+
* @arg {Object} options Emoji options
|
|
524
|
+
* @arg {String} options.image The base 64 encoded string
|
|
525
|
+
* @arg {String} options.name The name of emoji
|
|
526
|
+
* @arg {Array} [options.roles] An array containing authorized role IDs
|
|
527
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
528
|
+
* @returns {Promise<Object>} A guild emoji object
|
|
529
|
+
*/
|
|
530
|
+
createEmoji(options, reason) {
|
|
531
|
+
return this._client.createGuildEmoji.call(this._client, this.id, options, reason);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Create a guild role
|
|
536
|
+
* @arg {Object | Role} [options] An object or Role containing the properties to set
|
|
537
|
+
* @arg {Number} [options.color] The hex color of the role, in number form (ex: 0x3d15b3 or 4040115)
|
|
538
|
+
* @arg {Object} [options.colors] The role's colors
|
|
539
|
+
* @arg {Number} [options.colors.primaryColor] The primary color of the role
|
|
540
|
+
* @arg {Number?} [options.colors.secondaryColor] The secondary color of the role (for gradient roles)
|
|
541
|
+
* @arg {Number?} [options.colors.tertiaryColor] The tertiary color of the role (for holographic roles)
|
|
542
|
+
* @arg {Boolean} [options.hoist] Whether to hoist the role in the user list or not
|
|
543
|
+
* @arg {String} [options.icon] The role icon as a base64 data URI
|
|
544
|
+
* @arg {Boolean} [options.mentionable] Whether the role is mentionable or not
|
|
545
|
+
* @arg {String} [options.name] The name of the role
|
|
546
|
+
* @arg {BigInt | Number | String | Permission} [options.permissions] The role permissions
|
|
547
|
+
* @arg {String} [options.unicodeEmoji] The role's unicode emoji
|
|
548
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
549
|
+
* @returns {Promise<Role>}
|
|
550
|
+
*/
|
|
551
|
+
createRole(options, reason) {
|
|
552
|
+
return this._client.createRole.call(this._client, this.id, options, reason);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Create a guild scheduled event
|
|
557
|
+
* @arg {Object} event The event to be created
|
|
558
|
+
* @arg {String} [event.channelID] The channel ID of the event. This is optional if `entityType` is `3` (external)
|
|
559
|
+
* @arg {String} [event.description] The description of the event
|
|
560
|
+
* @arg {Object} [event.entityMetadata] The entity metadata for the scheduled event. This is required if `entityType` is `3` (external)
|
|
561
|
+
* @arg {String} [event.entityMetadata.location] Location of the event
|
|
562
|
+
* @arg {Number} event.entityType The [entity type](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) of the scheduled event
|
|
563
|
+
* @arg {String} [event.image] Base 64 encoded image for the scheduled event
|
|
564
|
+
* @arg {String} event.name The name of the event
|
|
565
|
+
* @arg {String} event.privacyLevel The privacy level of the event
|
|
566
|
+
* @arg {Object} [event.recurrenceRule] The [definitions](https://discord.dev/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) for how often this event should recur. Properties can be camelCase (preferred) or snake_case
|
|
567
|
+
* @arg {Date} [event.scheduledEndTime] The time when the event is scheduled to end. This is required if `entityType` is `3` (external)
|
|
568
|
+
* @arg {Date} event.scheduledStartTime The time the event will start
|
|
569
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
570
|
+
* @returns {Promise<GuildScheduledEvent>}
|
|
571
|
+
*/
|
|
572
|
+
createScheduledEvent(event, reason) {
|
|
573
|
+
return this._client.createGuildScheduledEvent.call(this._client, this.id, event, reason);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Create a guild soundboard sound
|
|
578
|
+
* @arg {Object} sound The sound to be created
|
|
579
|
+
* @arg {String?} [sound.emojiID] The ID of the relating custom emoji (mutually exclusive with sound.emojiName)
|
|
580
|
+
* @arg {String?} [sound.emojiName] The name of the relating default emoji (mutually exclusive with sound.emojiID)
|
|
581
|
+
* @arg {String} sound.name The name of the soundboard sound (2-32 characters)
|
|
582
|
+
* @arg {String} sound.sound The base 64 encoded mp3/ogg sound data
|
|
583
|
+
* @arg {Number?} [sound.volume=1] The volume of the soundboard sound, between 0 and 1
|
|
584
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
585
|
+
* @returns {Promise<SoundboardSound>}
|
|
586
|
+
*/
|
|
587
|
+
createSoundboardSound(sound, reason) {
|
|
588
|
+
return this._client.createGuildSoundboardSound.call(this._client, this.id, sound, reason);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Create a guild sticker
|
|
593
|
+
* @arg {Object} options Sticker options
|
|
594
|
+
* @arg {String} [options.description] The description of the sticker
|
|
595
|
+
* @arg {Object} options.file A file object
|
|
596
|
+
* @arg {Buffer} options.file.file A buffer containing file data
|
|
597
|
+
* @arg {String} options.file.name What to name the file
|
|
598
|
+
* @arg {String} options.name The name of the sticker
|
|
599
|
+
* @arg {String} options.tags The Discord name of a unicode emoji representing the sticker's expression
|
|
600
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
601
|
+
* @returns {Promise<Object>} A sticker object
|
|
602
|
+
*/
|
|
603
|
+
createSticker(options, reason) {
|
|
604
|
+
return this._client.createGuildSticker.call(this._client, this.id, options, reason);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Create a template for this guild
|
|
609
|
+
* @arg {String} name The name of the template
|
|
610
|
+
* @arg {String} [description] The description for the template
|
|
611
|
+
* @returns {Promise<GuildTemplate>}
|
|
612
|
+
*/
|
|
613
|
+
createTemplate(name, description) {
|
|
614
|
+
return this._client.createGuildTemplate.call(this._client, this.id, name, description);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Create a test entitlement for this guild
|
|
619
|
+
* @arg {String} skuID The ID of the SKU to grant to the guild
|
|
620
|
+
* @returns {Promise<Entitlement>}
|
|
621
|
+
*/
|
|
622
|
+
createTestEntitlement(skuID) {
|
|
623
|
+
return this._client.createTestEntitlement.call(this._client, {
|
|
624
|
+
ownerID: this.id,
|
|
625
|
+
ownerType: EntitlementOwnerTypes.GUILD,
|
|
626
|
+
skuID: skuID,
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Delete an auto moderation rule
|
|
632
|
+
* @arg {String} ruleID The ID of the rule to delete
|
|
633
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
634
|
+
* @returns {Promise}
|
|
635
|
+
*/
|
|
636
|
+
deleteAutoModerationRule(ruleID, reason) {
|
|
637
|
+
return this._client.deleteAutoModerationRule.call(this._client, this.id, ruleID, reason);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Delete a guild application command
|
|
642
|
+
* @arg {String} commandID The command id
|
|
643
|
+
* @returns {Promise} Resolves with a promise object
|
|
644
|
+
*/
|
|
645
|
+
deleteCommand(commandID) {
|
|
646
|
+
return this._client.deleteGuildCommand.call(this._client, this.id, commandID);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Delete a discovery subcategory
|
|
651
|
+
* @arg {String} categoryID The ID of the discovery category
|
|
652
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
653
|
+
* @returns {Promise}
|
|
654
|
+
*/
|
|
655
|
+
deleteDiscoverySubcategory(categoryID, reason) {
|
|
656
|
+
return this._client.addGuildDiscoverySubcategory.call(this._client, this.id, categoryID, reason);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Delete a emoji in the guild
|
|
661
|
+
* @arg {String} emojiID The ID of the emoji
|
|
662
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
663
|
+
* @returns {Promise}
|
|
664
|
+
*/
|
|
665
|
+
deleteEmoji(emojiID, reason) {
|
|
666
|
+
return this._client.deleteGuildEmoji.call(this._client, this.id, emojiID, reason);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Delete a guild integration
|
|
671
|
+
* @arg {String} integrationID The ID of the integration
|
|
672
|
+
* @returns {Promise}
|
|
673
|
+
*/
|
|
674
|
+
deleteIntegration(integrationID) {
|
|
675
|
+
return this._client.deleteGuildIntegration.call(this._client, this.id, integrationID);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Delete a role
|
|
680
|
+
* @arg {String} roleID The ID of the role
|
|
681
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
682
|
+
* @returns {Promise}
|
|
683
|
+
*/
|
|
684
|
+
deleteRole(roleID, reason) {
|
|
685
|
+
return this._client.deleteRole.call(this._client, this.id, roleID, reason);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Delete a guild scheduled event
|
|
690
|
+
* @arg {String} eventID The ID of the event
|
|
691
|
+
* @returns {Promise}
|
|
692
|
+
*/
|
|
693
|
+
deleteScheduledEvent(eventID) {
|
|
694
|
+
return this._client.deleteGuildScheduledEvent.call(this._client, this.id, eventID);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Delete a guild soundboard sound
|
|
699
|
+
* @arg {String} soundID The ID of the soundboard sound
|
|
700
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
701
|
+
* @returns {Promise}
|
|
702
|
+
*/
|
|
703
|
+
deleteSoundboardSound(soundID, reason) {
|
|
704
|
+
return this._client.deleteGuildSoundboardSound.call(this._client, this.id, soundID, reason);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Delete a guild sticker
|
|
709
|
+
* @arg {String} stickerID The ID of the sticker
|
|
710
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
711
|
+
* @returns {Promise}
|
|
712
|
+
*/
|
|
713
|
+
deleteSticker(stickerID, reason) {
|
|
714
|
+
return this._client.deleteGuildSticker.call(this._client, this.id, stickerID, reason);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Delete a guild template
|
|
719
|
+
* @arg {String} code The template code
|
|
720
|
+
* @returns {Promise<GuildTemplate>}
|
|
721
|
+
*/
|
|
722
|
+
deleteTemplate(code) {
|
|
723
|
+
return this._client.deleteGuildTemplate.call(this._client, this.id, code);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Get the guild's banner with the given format and size
|
|
728
|
+
* @arg {String} [format] The filetype of the icon ("jpg", "jpeg", "png", "gif", or "webp")
|
|
729
|
+
* @arg {Number} [size] The size of the icon (any power of two between 16 and 4096)
|
|
730
|
+
* @returns {String?}
|
|
731
|
+
*/
|
|
732
|
+
dynamicBannerURL(format, size) {
|
|
733
|
+
return this.banner ? this._client._formatImage(Endpoints.BANNER(this.id, this.banner), format, size) : null;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Get the guild's discovery splash with the given format and size
|
|
738
|
+
* @arg {String} [format] The filetype of the icon ("jpg", "jpeg", "png", "gif", or "webp")
|
|
739
|
+
* @arg {Number} [size] The size of the icon (any power of two between 16 and 4096)
|
|
740
|
+
* @returns {String?}
|
|
741
|
+
*/
|
|
742
|
+
dynamicDiscoverySplashURL(format, size) {
|
|
743
|
+
return this.discoverySplash ? this._client._formatImage(Endpoints.GUILD_DISCOVERY_SPLASH(this.id, this.discoverySplash), format, size) : null;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Get the guild's icon with the given format and size
|
|
748
|
+
* @arg {String} [format] The filetype of the icon ("jpg", "jpeg", "png", "gif", or "webp")
|
|
749
|
+
* @arg {Number} [size] The size of the icon (any power of two between 16 and 4096)
|
|
750
|
+
* @returns {String?}
|
|
751
|
+
*/
|
|
752
|
+
dynamicIconURL(format, size) {
|
|
753
|
+
return this.icon ? this._client._formatImage(Endpoints.GUILD_ICON(this.id, this.icon), format, size) : null;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Get the guild's splash with the given format and size
|
|
758
|
+
* @arg {String} [format] The filetype of the icon ("jpg", "jpeg", "png", "gif", or "webp")
|
|
759
|
+
* @arg {Number} [size] The size of the icon (any power of two between 16 and 4096)
|
|
760
|
+
* @returns {String?}
|
|
761
|
+
*/
|
|
762
|
+
dynamicSplashURL(format, size) {
|
|
763
|
+
return this.splash ? this._client._formatImage(Endpoints.GUILD_SPLASH(this.id, this.splash), format, size) : null;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Edit the guild
|
|
768
|
+
* @arg {Object} options The properties to edit
|
|
769
|
+
* @arg {String?} [options.afkChannelID] The ID of the AFK voice channel
|
|
770
|
+
* @arg {Number} [options.afkTimeout] The AFK timeout in seconds
|
|
771
|
+
* @arg {String?} [options.banner] The guild banner image as a base64 data URI (VIP only). Note: base64 strings alone are not base64 data URI strings
|
|
772
|
+
* @arg {Number?} [options.defaultNotifications] The default notification settings for the guild. 0 is "All Messages", 1 is "Only @mentions".
|
|
773
|
+
* @arg {String?} [options.description] The description for the guild (VIP only)
|
|
774
|
+
* @arg {String?} [options.discoverySplash] The guild discovery splash image as a base64 data URI (VIP only). Note: base64 strings alone are not base64 data URI strings
|
|
775
|
+
* @arg {Number?} [options.explicitContentFilter] The level of the explicit content filter for messages/images in the guild. 0 disables message scanning, 1 enables scanning the messages of members without roles, 2 enables scanning for all messages.
|
|
776
|
+
* @arg {Array<String>} [options.features] The enabled features for the guild. Note that only certain features can be toggled with the API
|
|
777
|
+
* @arg {String?} [options.icon] The guild icon as a base64 data URI. Note: base64 strings alone are not base64 data URI strings
|
|
778
|
+
* @arg {String} [options.name] The name of the guild
|
|
779
|
+
* @arg {String?} [options.preferredLocale] Preferred "COMMUNITY" guild language used in server discovery and notices from Discord
|
|
780
|
+
* @arg {String?} [options.publicUpdatesChannelID] The ID of the channel where admins and moderators of "COMMUNITY" guilds receive notices from Discord
|
|
781
|
+
* @arg {String?} [options.rulesChannelID] The ID of the channel where "COMMUNITY" guilds display rules and/or guidelines
|
|
782
|
+
* @arg {String?} [options.safetyAlertsChannelID] The ID of the channel where admins and moderators of Community guilds receive safety alerts from Discord
|
|
783
|
+
* @arg {String?} [options.splash] The guild splash image as a base64 data URI (VIP only). Note: base64 strings alone are not base64 data URI strings
|
|
784
|
+
* @arg {Number} [options.systemChannelFlags] The flags for the system channel
|
|
785
|
+
* @arg {String?} [options.systemChannelID] The ID of the system channel
|
|
786
|
+
* @arg {Number?} [options.verificationLevel] The guild verification level
|
|
787
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
788
|
+
* @returns {Promise<Guild>}
|
|
789
|
+
*/
|
|
790
|
+
edit(options, reason) {
|
|
791
|
+
return this._client.editGuild.call(this._client, this.id, options, reason);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Edit an existing auto moderation rule
|
|
796
|
+
* @arg {String} ruleID The ID of the rule to edit
|
|
797
|
+
* @arg {Object} options The properties to edit
|
|
798
|
+
* @arg {Array<Object>} [options.actions] The [actions](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object) done when the rule is violated. Their `metadata` takes camelCase keys, such as `durationSeconds`
|
|
799
|
+
* @arg {Boolean} [options.enabled=false] If the rule is enabled, false by default
|
|
800
|
+
* @arg {Number} [options.eventType] The [event type](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) for the rule
|
|
801
|
+
* @arg {Array<String>} [options.exemptChannels] Any channels where this rule does not apply
|
|
802
|
+
* @arg {Array<String>} [options.exemptRoles] Any roles to which this rule does not apply
|
|
803
|
+
* @arg {String} [options.name] The name of the rule
|
|
804
|
+
* @arg {Object} [options.triggerMetadata] The [trigger metadata](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) for the rule, with camelCase keys such as `keywordFilter`
|
|
805
|
+
* @arg {Number} [options.triggerType] The [trigger type](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) of the rule
|
|
806
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
807
|
+
* @returns {Promise<AutoModerationRule>}
|
|
808
|
+
*/
|
|
809
|
+
editAutoModerationRule(ruleID, options) {
|
|
810
|
+
return this._client.editAutoModerationRule.call(this._client, this.id, ruleID, options);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Edit multiple channels' positions. Note that channel position numbers are grouped by type (category, text, voice), then sorted in ascending order (lowest number is on top).
|
|
815
|
+
* @arg {Array<Object>} channelPositions An array of [ChannelPosition](https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions)
|
|
816
|
+
* @arg {String} channelPositions[].id The ID of the channel
|
|
817
|
+
* @arg {Boolean} [channelPositions[].lockPermissions] Whether to sync the channel's permissions with the new parent, if changing parents
|
|
818
|
+
* @arg {String} [channelPositions[].parentID] The new parent ID (category channel) for the channel that is moved. For each request, only one channel can change parents
|
|
819
|
+
* @arg {Number} channelPositions[].position The new position of the channel
|
|
820
|
+
* @returns {Promise}
|
|
821
|
+
*/
|
|
822
|
+
editChannelPositions(channelPositions) {
|
|
823
|
+
return this._client.editChannelPositions.call(this._client, this.id, channelPositions);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Edit a guild application command
|
|
828
|
+
* @arg {String} commandID The command ID
|
|
829
|
+
* @arg {Object} command A command object
|
|
830
|
+
* @arg {BigInt | Number | String | Permission?} [command.defaultMemberPermissions] The default permissions the user must have to use the command
|
|
831
|
+
* @arg {Boolean} [command.defaultPermission] [DEPRECATED] Whether the command is enabled by default when the application is added to a guild. Replaced by `defaultMemberPermissions`
|
|
832
|
+
* @arg {String} [command.description] The command description, required for `CHAT_INPUT` commands
|
|
833
|
+
* @arg {Object?} [command.descriptionLocalizations] Localization directory with keys in [available locales](https://discord.dev/reference#locales) for the command description
|
|
834
|
+
* @arg {String} [command.name] The command name
|
|
835
|
+
* @arg {Object?} [command.nameLocalizations] Localization directory with keys in [available locales](https://discord.dev/reference#locales) for the command name
|
|
836
|
+
* @arg {Boolean} [command.nsfw] Whether the command is age-restricted
|
|
837
|
+
* @arg {Array<Object>} [command.options] The application command [options](https://discord.dev/interactions/application-commands#application-command-object-application-command-option-structure)
|
|
838
|
+
* @returns {Promise<ApplicationCommand>} Resolves with the edited application command
|
|
839
|
+
*/
|
|
840
|
+
editCommand(commandID, command) {
|
|
841
|
+
return this._client.editGuildCommand.call(this._client, this.id, commandID, command);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Edits command permissions for a specific command in a guild.
|
|
846
|
+
* Note: You can only add up to 10 permission overwrites for a command.
|
|
847
|
+
* @arg {String} commandID The command id
|
|
848
|
+
* @arg {Array<Object>} permissions An array of [permissions objects](https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure)
|
|
849
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
850
|
+
* @returns {Promise<Object>} Resolves with a [GuildApplicationCommandPermissions](https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object.
|
|
851
|
+
*/
|
|
852
|
+
editCommandPermissions(commandID, permissions, reason) {
|
|
853
|
+
return this._client.editCommandPermissions.call(this._client, this.id, commandID, permissions, reason);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Edit the guild's discovery data
|
|
858
|
+
* @arg {Object} [options] The guild discovery data
|
|
859
|
+
* @arg {Boolean} [options.emojiDiscoverabilityEnabled] Whether guild info should be shown when emoji info is loaded
|
|
860
|
+
* @arg {Array<String>} [options.keywords] The discovery keywords (max 10)
|
|
861
|
+
* @arg {String} [options.primaryCategoryID] The primary discovery category ID
|
|
862
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
863
|
+
* @returns {Promise<Object>} The updated discovery object
|
|
864
|
+
*/
|
|
865
|
+
editDiscovery(options) {
|
|
866
|
+
return this._client.editGuildDiscovery.call(this._client, this.id, options);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Edit a emoji in the guild
|
|
871
|
+
* @arg {String} emojiID The ID of the emoji you want to modify
|
|
872
|
+
* @arg {Object} options Emoji options
|
|
873
|
+
* @arg {String} [options.name] The name of emoji
|
|
874
|
+
* @arg {Array} [options.roles] An array containing authorized role IDs
|
|
875
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
876
|
+
* @returns {Promise<Object>} A guild emoji object
|
|
877
|
+
*/
|
|
878
|
+
editEmoji(emojiID, options, reason) {
|
|
879
|
+
return this._client.editGuildEmoji.call(this._client, this.id, emojiID, options, reason);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Edit the guild's incident actions
|
|
884
|
+
* @arg {Object} options The incident action properties to edit
|
|
885
|
+
* @arg {Date?} [options.dmsDisabledUntil] When DMs will be enabled again (set as `null` to enable now)
|
|
886
|
+
* @arg {Date?} [options.invitesDisabledUntil] When invites will be enabled again (set as `null` to enable now)
|
|
887
|
+
* @returns {Promise<{dmsDisabledUntil: Date?, dmSpamDetectedAt: Date?, invitesDisabledUntil: Date?, raidDetectedAt: Date?}>} An object containing guild incident data
|
|
888
|
+
*/
|
|
889
|
+
editIncidentActions(options) {
|
|
890
|
+
return this._client.editGuildIncidentActions.call(this._client, this.id, options);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Edit a guild member
|
|
895
|
+
* @arg {String} memberID The ID of the member (you can use "@me" if you are editing the bot user)
|
|
896
|
+
* @arg {Object} options The properties to edit
|
|
897
|
+
* @arg {String?} [options.avatar] The new avatar for the bot user for this guild, as a base64 data URI. Only available when editing the current bot user. Note: base64 strings alone are not base64 data URI strings
|
|
898
|
+
* @arg {String?} [options.banner] The new banner for the bot user for this guild, as a base64 data URI. Only available when editing the current bot user. Note: base64 strings alone are not base64 data URI strings
|
|
899
|
+
* @arg {String?} [options.bio] The new bio for the bot user for this guild. Only available when editing the current bot user
|
|
900
|
+
* @arg {String?} [options.channelID] The ID of the voice channel to move the member to (must be in voice). Set to `null` to disconnect the member
|
|
901
|
+
* @arg {Date?} [options.communicationDisabledUntil] When the user's timeout should expire. Set to `null` to instantly remove timeout
|
|
902
|
+
* @arg {Boolean} [options.deaf] Server deafen the member
|
|
903
|
+
* @arg {Number} [options.flags] The user's flags - `OR` the `BYPASSES_VERIFICATION` flag (4) to make the member exempt from verification requirements, `NAND` the flag to make the member not exempt
|
|
904
|
+
* @arg {Boolean} [options.mute] Server mute the member
|
|
905
|
+
* @arg {String} [options.nick] Set the member's guild nickname, "" to remove
|
|
906
|
+
* @arg {Array<String>} [options.roles] The array of role IDs the member should have
|
|
907
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
908
|
+
* @returns {Promise<Member>}
|
|
909
|
+
*/
|
|
910
|
+
editMember(memberID, options, reason) {
|
|
911
|
+
return this._client.editGuildMember.call(this._client, this.id, memberID, options, reason);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* [DEPRECATED] Edit the bot's nickname in the guild. Use `editMember` instead
|
|
916
|
+
* @arg {String} nick The nickname
|
|
917
|
+
* @returns {Promise}
|
|
918
|
+
*/
|
|
919
|
+
editNickname(nick) {
|
|
920
|
+
return this._client.editNickname.call(this._client, this.id, nick);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Edit the guild's onboarding settings
|
|
925
|
+
* @arg {Object} options The properties to edit
|
|
926
|
+
* @arg {Array<String>} options.defaultChannelIDs The ID of channels that members are opted into automatically
|
|
927
|
+
* @arg {Boolean} options.enabled Whether onboarding should be enabled or not for the guild
|
|
928
|
+
* @arg {Number} options.mode The onboarding mode, `0` for default, `1` for advanced
|
|
929
|
+
* @arg {Array<Object>} options.prompts The [prompts](https://discord.dev/resources/guild#guild-onboarding-object-onboarding-prompt-structure) shown during the onboarding process
|
|
930
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
931
|
+
* @returns {Promise<Object>} The guild's [onboarding settings](https://discord.dev/resources/guild#guild-onboarding-object)
|
|
932
|
+
*/
|
|
933
|
+
editOnboarding(options, reason) {
|
|
934
|
+
return this._client.editGuildOnboarding.call(this._client, this.id, options, reason);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Edit the guild role
|
|
939
|
+
* @arg {String} roleID The ID of the role
|
|
940
|
+
* @arg {Object} options The properties to edit
|
|
941
|
+
* @arg {Number} [options.color] The hex color of the role, in number form (ex: 0x3da5b3 or 4040115)
|
|
942
|
+
* @arg {Object} [options.colors] The role's colors
|
|
943
|
+
* @arg {Number} [options.colors.primaryColor] The primary color of the role
|
|
944
|
+
* @arg {Number?} [options.colors.secondaryColor] The secondary color of the role (for gradient roles)
|
|
945
|
+
* @arg {Number?} [options.colors.tertiaryColor] The tertiary color of the role (for holographic roles)
|
|
946
|
+
* @arg {Boolean} [options.hoist] Whether to hoist the role in the user list or not
|
|
947
|
+
* @arg {String} [options.icon] The role icon as a base64 data URI
|
|
948
|
+
* @arg {Boolean} [options.mentionable] Whether the role is mentionable or not
|
|
949
|
+
* @arg {String} [options.name] The name of the role
|
|
950
|
+
* @arg {BigInt | Number | String | Permission} [options.permissions] The role permissions
|
|
951
|
+
* @arg {String} [options.unicodeEmoji] The role's unicode emoji
|
|
952
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
953
|
+
* @returns {Promise<Role>}
|
|
954
|
+
*/
|
|
955
|
+
editRole(roleID, options, reason) {
|
|
956
|
+
return this._client.editRole.call(this._client, this.id, roleID, options, reason);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Edit this scheduled event
|
|
961
|
+
* @arg {String} eventID The guild scheduled event ID
|
|
962
|
+
* @arg {Object} event The new guild scheduled event object
|
|
963
|
+
* @arg {String} [event.channelID] The channel ID of the event. If updating `entityType` to `3` (external), this **must** be set to `null`
|
|
964
|
+
* @arg {String} [event.description] The description of the event
|
|
965
|
+
* @arg {Object} [event.entityMetadata] The entity metadata for the scheduled event. This is required if updating `entityType` to `3` (external)
|
|
966
|
+
* @arg {String} [event.entityMetadata.location] Location of the event. This is required if updating `entityType` to `3` (external)
|
|
967
|
+
* @arg {Number} [event.entityType] The [entity type](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) of the scheduled event
|
|
968
|
+
* @arg {String} [event.image] Base 64 encoded image for the event
|
|
969
|
+
* @arg {String} [event.name] The name of the event
|
|
970
|
+
* @arg {String} [event.privacyLevel] The privacy level of the event
|
|
971
|
+
* @arg {Object?} [event.recurrenceRule] The [definitions](https://discord.dev/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) for how often this event should recur. Properties can be camelCase (preferred) or snake_case
|
|
972
|
+
* @arg {Date} [event.scheduledEndTime] The time when the scheduled event is scheduled to end. This is required if updating `entityType` to `3` (external)
|
|
973
|
+
* @arg {Date} [event.scheduledStartTime] The time the event will start
|
|
974
|
+
* @arg {Number} [event.status] The [status](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) of the scheduled event
|
|
975
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
976
|
+
* @returns {Promise<GuildScheduledEvent>}
|
|
977
|
+
*/
|
|
978
|
+
editScheduledEvent(eventID, event, reason) {
|
|
979
|
+
return this._client.editGuildScheduledEvent.call(this._client, this.id, eventID, event, reason);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* Edit a guild sticker
|
|
984
|
+
* @arg {String} stickerID The ID of the sticker
|
|
985
|
+
* @arg {Object} options The properties to edit
|
|
986
|
+
* @arg {String} [options.description] The description of the sticker
|
|
987
|
+
* @arg {String} [options.name] The name of the sticker
|
|
988
|
+
* @arg {String} [options.tags] The Discord name of a unicode emoji representing the sticker's expression
|
|
989
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
990
|
+
* @returns {Promise<Object>} A sticker object
|
|
991
|
+
*/
|
|
992
|
+
editSticker(stickerID, options, reason) {
|
|
993
|
+
return this._client.editGuildSticker.call(this._client, this.id, stickerID, options, reason);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Edit a guild template
|
|
998
|
+
* @arg {String} code The template code
|
|
999
|
+
* @arg {Object} options The properties to edit
|
|
1000
|
+
* @arg {String?} [options.description] The desription for the template. Set to `null` to remove the description
|
|
1001
|
+
* @arg {String} [options.name] The name of the template
|
|
1002
|
+
* @returns {Promise<GuildTemplate>}
|
|
1003
|
+
*/
|
|
1004
|
+
editTemplate(code, options) {
|
|
1005
|
+
return this._client.editGuildTemplate.call(this._client, this.id, code, options);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Modify the guild's vanity code
|
|
1010
|
+
* @arg {String?} code The new vanity code
|
|
1011
|
+
* @returns {Promise<Object>}
|
|
1012
|
+
*/
|
|
1013
|
+
editVanity(code) {
|
|
1014
|
+
return this._client.editGuildVanity.call(this._client, this.id, code);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Update a user's voice state - See [caveats](https://discord.com/developers/docs/resources/guild#modify-user-voice-state-caveats)
|
|
1019
|
+
* @arg {Object} options The properties to edit
|
|
1020
|
+
* @arg {String} options.channelID The ID of the channel the user is currently in
|
|
1021
|
+
* @arg {Date?} [options.requestToSpeakTimestamp] Sets the user's request to speak - this can only be used when the `userID` param is "@me"
|
|
1022
|
+
* @arg {Boolean} [options.suppress] Toggles the user's suppress state
|
|
1023
|
+
* @arg {String} [userID="@me"] The user ID of the user to update
|
|
1024
|
+
* @returns {Promise}
|
|
1025
|
+
*/
|
|
1026
|
+
editVoiceState(options, userID) {
|
|
1027
|
+
return this._client.editGuildVoiceState.call(this._client, this.id, options, userID);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Edit the guild welcome screen
|
|
1032
|
+
* @arg {Object} [options] The properties to edit
|
|
1033
|
+
* @arg {String?} [options.description] The description in the welcome screen
|
|
1034
|
+
* @arg {Boolean} [options.enabled] Whether the welcome screen is enabled
|
|
1035
|
+
* @arg {Array<Object>} [options.welcomeChannels] The list of channels in the welcome screen as an array
|
|
1036
|
+
* @arg {String} options.welcomeChannels[].channelID The channel ID of the welcome channel
|
|
1037
|
+
* @arg {String} options.welcomeChannels[].description The description of the welcome channel
|
|
1038
|
+
* @arg {String?} options.welcomeChannels[].emojiID The emoji ID of the welcome channel
|
|
1039
|
+
* @arg {String?} options.welcomeChannels[].emojiName The emoji name of the welcome channel
|
|
1040
|
+
* @returns {Promise<Object>}
|
|
1041
|
+
*/
|
|
1042
|
+
editWelcomeScreen(options) {
|
|
1043
|
+
return this._client.editGuildWelcomeScreen.call(this._client, this.id, options);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Modify a guild's widget
|
|
1048
|
+
* @arg {Object} options The widget object to modify (https://discord.com/developers/docs/resources/guild#modify-guild-widget)
|
|
1049
|
+
* @arg {Boolean} [options.enabled] Whether the guild widget is enabled
|
|
1050
|
+
* @arg {String?} [options.channelID] The channel ID for the guild widget
|
|
1051
|
+
* @arg {String?} [options.reason] The reason to be displayed in audit logs
|
|
1052
|
+
* @returns {Promise<Object>} A guild widget object
|
|
1053
|
+
*/
|
|
1054
|
+
editWidget(options) {
|
|
1055
|
+
return this._client.editGuildWidget.call(this._client, this.id, options);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* Request all guild members from Discord
|
|
1060
|
+
* @arg {Number} [timeout] The number of milliseconds to wait before resolving early. Defaults to the `requestTimeout` client option
|
|
1061
|
+
* @returns {Promise<Number>} Resolves with the total number of fetched members.
|
|
1062
|
+
*/
|
|
1063
|
+
fetchAllMembers(timeout) {
|
|
1064
|
+
return this.fetchMembers({
|
|
1065
|
+
timeout,
|
|
1066
|
+
}).then((m) => m.length);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Request the ephemeral data of the channels of the guild (voice channel status and voice session start time) through the gateway connection
|
|
1071
|
+
* @arg {Object} [options] Options for the request
|
|
1072
|
+
* @arg {Array<String>} [options.fields=["status", "voice_start_time"]] The fields to request. Either `status` and/or `voice_start_time`
|
|
1073
|
+
* @arg {Number} [options.timeout] The number of milliseconds to wait before resolving with an empty array. Defaults to the `requestTimeout` client option
|
|
1074
|
+
* @returns {Promise<Array<Object>>} Resolves with the ephemeral data of the channels, each containing the channel `id` and the requested fields (`status`, `voiceStartTime`)
|
|
1075
|
+
*/
|
|
1076
|
+
fetchChannelInfo(options) {
|
|
1077
|
+
return this.shard.requestChannelInfo(this.id, options);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Request specific guild members through the gateway connection
|
|
1082
|
+
* @arg {Object} [options] Options for fetching the members
|
|
1083
|
+
* @arg {Number} [options.limit] The maximum number of members to fetch
|
|
1084
|
+
* @arg {Boolean} [options.presences] Whether to request member presences or not. When using intents, the `GUILD_PRESENCES` intent is required.
|
|
1085
|
+
* @arg {String} [options.query] The query used for looking up the members. When using intents, `GUILD_MEMBERS` is required to fetch all members.
|
|
1086
|
+
* @arg {Number} [options.timeout] The number of milliseconds to wait before resolving early. Defaults to the `requestTimeout` client option
|
|
1087
|
+
* @arg {Array<String>} [options.userIDs] The IDs of members to fetch
|
|
1088
|
+
* @returns {Promise<Array<Member>>} Resolves with the fetched members.
|
|
1089
|
+
*/
|
|
1090
|
+
fetchMembers(options) {
|
|
1091
|
+
return this.shard.requestGuildMembers(this.id, options);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Request the guild's soundboard sounds through the gateway connection
|
|
1096
|
+
* @arg {Object} options Options for fetching the soundboard sounds
|
|
1097
|
+
* @arg {Number} [options.timeout] The number of milliseconds to wait before resolving early. Defaults to the `requestTimeout` client option
|
|
1098
|
+
* @returns {Promise<Array<SoundboardSound>>} Resolves with the fetched soundboard sounds
|
|
1099
|
+
*/
|
|
1100
|
+
fetchSoundboardSounds(options) {
|
|
1101
|
+
return this.shard.requestGuildSoundboardSounds({
|
|
1102
|
+
guildIDs: [this.id],
|
|
1103
|
+
...options,
|
|
1104
|
+
}).then((s) => s[this.id]);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Get all active threads in this guild
|
|
1109
|
+
* @returns {Promise<Object>} An object containing an array of `threads` and an array of `members`
|
|
1110
|
+
*/
|
|
1111
|
+
getActiveThreads() {
|
|
1112
|
+
return this._client.getActiveGuildThreads.call(this._client, this.id);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Get the audit log for the guild
|
|
1117
|
+
* @arg {Object} [options] Options for the request. If this is a number ([DEPRECATED] behavior), it is treated as `options.limit`
|
|
1118
|
+
* @arg {Number} [options.actionType] Filter entries by action type
|
|
1119
|
+
* @arg {String} [options.before] Get entries before this entry ID
|
|
1120
|
+
* @arg {Number} [options.limit=50] The maximum number of entries to return
|
|
1121
|
+
* @arg {String} [options.userID] Filter entries by the user that performed the action
|
|
1122
|
+
* @returns {Promise<{entries: Array<GuildAuditLogEntry>, integrations: Array<PartialIntegration>, threads: Array<NewsThreadChannel | PrivateThreadChannel | PublicThreadChannel>, users: Array<User>, webhooks: Array<Webhook>}>}
|
|
1123
|
+
*/
|
|
1124
|
+
getAuditLog(options) {
|
|
1125
|
+
return this._client.getGuildAuditLog.call(this._client, this.id, options);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* [DEPRECATED] Get the audit log for a guild. Use `getAuditLog` instead
|
|
1130
|
+
* @arg {Number} [limit=50] The maximum number of entries to return
|
|
1131
|
+
* @arg {String} [before] Get entries before this entry ID
|
|
1132
|
+
* @arg {Number} [actionType] Filter entries by action type
|
|
1133
|
+
* @arg {String} [userID] Filter entries by the user that performed the action
|
|
1134
|
+
* @returns {Promise<{entries: Array<GuildAuditLogEntry>, integrations: Array<PartialIntegration>, threads: Array<NewsThreadChannel | PrivateThreadChannel | PublicThreadChannel>, users: Array<User>, webhooks: Array<Webhook>}>}
|
|
1135
|
+
*/
|
|
1136
|
+
getAuditLogs(limit, before, actionType, userID) {
|
|
1137
|
+
return this._client.getGuildAuditLogs.call(this._client, this.id, limit, before, actionType, userID);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Get an existing auto moderation rule
|
|
1142
|
+
* @arg {String} guildID The ID of the guild to get the rule from
|
|
1143
|
+
* @arg {String} ruleID The ID of the rule to get
|
|
1144
|
+
* @returns {Promise<AutoModerationRule>}
|
|
1145
|
+
*/
|
|
1146
|
+
getAutoModerationRule(ruleID) {
|
|
1147
|
+
return this._client.getAutoModerationRule.call(this._client, this.id, ruleID);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Get a guild's auto moderation rules
|
|
1152
|
+
* @arg {String} guildID The ID of the guild to get the rules of
|
|
1153
|
+
* @returns {Promise<Array<AutoModerationRule>>}
|
|
1154
|
+
*/
|
|
1155
|
+
getAutoModerationRules() {
|
|
1156
|
+
return this._client.getAutoModerationRules.call(this._client, this.id);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Get a ban from the ban list of a guild
|
|
1161
|
+
* @arg {String} userID The ID of the banned user
|
|
1162
|
+
* @returns {Promise<Object>} Resolves with {reason: String, user: User}
|
|
1163
|
+
*/
|
|
1164
|
+
getBan(userID) {
|
|
1165
|
+
return this._client.getGuildBan.call(this._client, this.id, userID);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Get the ban list of the guild
|
|
1170
|
+
* @arg {Object} [options] Options for the request
|
|
1171
|
+
* @arg {String} [options.after] Only get users after given user ID
|
|
1172
|
+
* @arg {String} [options.before] Only get users before given user ID
|
|
1173
|
+
* @arg {Number} [options.limit=1000] The maximum number of users to return
|
|
1174
|
+
* @returns {Promise<Array<Object>>} Resolves with an array of { reason: String, user: User }
|
|
1175
|
+
*/
|
|
1176
|
+
getBans(options) {
|
|
1177
|
+
return this._client.getGuildBans.call(this._client, this.id, options);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* Get a guild application command
|
|
1182
|
+
* @arg {String} commandID The command id
|
|
1183
|
+
* @returns {Promise<ApplicationCommand>}
|
|
1184
|
+
*/
|
|
1185
|
+
getCommand(commandID) {
|
|
1186
|
+
return this._client.getGuildCommand.call(this._client, this.id, commandID);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Get the a guild's application command permissions
|
|
1191
|
+
* @arg {String} commandID The command id
|
|
1192
|
+
* @returns {Promise<Object>} Resolves with a guild application command permissions object.
|
|
1193
|
+
*/
|
|
1194
|
+
getCommandPermissions(commandID) {
|
|
1195
|
+
return this._client.getCommandPermissions.call(this._client, this.id, commandID);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Get the guild's application commands
|
|
1200
|
+
* @arg {Boolean} [withLocalizations] Whether to include the `nameLocalizations` and `descriptionLocalizations` of the commands
|
|
1201
|
+
* @returns {Promise<Array<ApplicationCommand>>}
|
|
1202
|
+
*/
|
|
1203
|
+
getCommands(withLocalizations) {
|
|
1204
|
+
return this._client.getGuildCommands.call(this._client, this.id, withLocalizations);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Get the guild's discovery object
|
|
1209
|
+
* @returns {Promise<Object>}
|
|
1210
|
+
*/
|
|
1211
|
+
getDiscovery() {
|
|
1212
|
+
return this._client.getGuildDiscovery.call(this._client, this.id);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Get the entitlements of this guild
|
|
1217
|
+
* @arg {Object} [options] Options for the request. See `Client#getEntitlements` for the full list of options (`guildID` is ignored)
|
|
1218
|
+
* @returns {Promise<Array<Entitlement>>}
|
|
1219
|
+
*/
|
|
1220
|
+
getEntitlements(options = {}) {
|
|
1221
|
+
return this._client.getEntitlements.call(this._client, Object.assign({}, options, {
|
|
1222
|
+
guildID: this.id,
|
|
1223
|
+
}));
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Get the all of a guild's application command permissions
|
|
1228
|
+
* @returns {Promise<Array<Object>>} Resolves with an array of guild application command permissions objects.
|
|
1229
|
+
*/
|
|
1230
|
+
getGuildCommandPermissions() {
|
|
1231
|
+
return this._client.getGuildCommandPermissions.call(this._client, this.id);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Get a list of integrations for the guild
|
|
1236
|
+
* @returns {Promise<Array<GuildIntegration>>}
|
|
1237
|
+
*/
|
|
1238
|
+
getIntegrations() {
|
|
1239
|
+
return this._client.getGuildIntegrations.call(this._client, this.id);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Get all invites in the guild
|
|
1244
|
+
* @returns {Promise<Array<Invite>>}
|
|
1245
|
+
*/
|
|
1246
|
+
getInvites() {
|
|
1247
|
+
return this._client.getGuildInvites.call(this._client, this.id);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Get the computed guild-wide permissions of a member, combining their roles with `@everyone`
|
|
1252
|
+
* @arg {String} memberID The ID of the member
|
|
1253
|
+
* @returns {Promise<Permission>}
|
|
1254
|
+
*/
|
|
1255
|
+
getMemberPermissions(memberID) {
|
|
1256
|
+
return this._client.getGuildMemberPermissions.call(this._client, this.id, memberID);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Get the guild's onboarding settings
|
|
1261
|
+
* @returns {Promise<Object>} The guild's [onboarding settings](https://discord.dev/resources/guild#guild-onboarding-object)
|
|
1262
|
+
*/
|
|
1263
|
+
getOnboarding() {
|
|
1264
|
+
return this._client.getGuildOnboarding.call(this._client, this.id);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Get the prune count for the guild
|
|
1269
|
+
* @arg {Number} [options] The options to use to get number of prune members
|
|
1270
|
+
* @arg {Number} [options.days=7] The number of days of inactivity to prune for
|
|
1271
|
+
* @arg {Array<String>} [options.includeRoles] An array of role IDs that members must have to be considered for pruning
|
|
1272
|
+
* @returns {Promise<Number>} Resolves with the number of members that would be pruned
|
|
1273
|
+
*/
|
|
1274
|
+
getPruneCount(options) {
|
|
1275
|
+
return this._client.getPruneCount.call(this._client, this.id, options);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Get a guild's channels via the REST API. REST mode is required to use this endpoint.
|
|
1280
|
+
* @returns {Promise<Array<CategoryChannel | ForumChannel | NewsChannel | StageChannel | TextChannel> | VoiceChannel>}
|
|
1281
|
+
*/
|
|
1282
|
+
getRESTChannels() {
|
|
1283
|
+
return this._client.getRESTGuildChannels.call(this._client, this.id);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Get a guild emoji via the REST API. REST mode is required to use this endpoint.
|
|
1288
|
+
* @arg {String} emojiID The ID of the emoji
|
|
1289
|
+
* @returns {Promise<Object>} An emoji object
|
|
1290
|
+
*/
|
|
1291
|
+
getRESTEmoji(emojiID) {
|
|
1292
|
+
return this._client.getRESTGuildEmoji.call(this._client, this.id, emojiID);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Get a guild's emojis via the REST API. REST mode is required to use this endpoint.
|
|
1297
|
+
* @returns {Promise<Array<Object>>} An array of guild emoji objects
|
|
1298
|
+
*/
|
|
1299
|
+
getRESTEmojis() {
|
|
1300
|
+
return this._client.getRESTGuildEmojis.call(this._client, this.id);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Get a guild's members via the REST API. REST mode is required to use this endpoint.
|
|
1305
|
+
* @arg {String} memberID The ID of the member
|
|
1306
|
+
* @returns {Promise<Member>}
|
|
1307
|
+
*/
|
|
1308
|
+
getRESTMember(memberID) {
|
|
1309
|
+
return this._client.getRESTGuildMember.call(this._client, this.id, memberID);
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Get a guild's members via the REST API. REST mode is required to use this endpoint.
|
|
1314
|
+
* @arg {Object} [options] Options for the request. If this is a number ([DEPRECATED] behavior), it is treated as `options.limit`
|
|
1315
|
+
* @arg {String} [options.after] The highest user ID of the previous page
|
|
1316
|
+
* @arg {Number} [options.limit=1] The max number of members to get (1 to 1000)
|
|
1317
|
+
* @arg {String} [after] [DEPRECATED] The highest user ID of the previous page
|
|
1318
|
+
* @returns {Promise<Array<Member>>}
|
|
1319
|
+
*/
|
|
1320
|
+
getRESTMembers(options, after) {
|
|
1321
|
+
return this._client.getRESTGuildMembers.call(this._client, this.id, options, after);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* Get a guild's roles via the REST API. REST mode is required to use this endpoint.
|
|
1326
|
+
* @arg {String} roleID The ID of the role
|
|
1327
|
+
* @returns {Promise<Role>}
|
|
1328
|
+
*/
|
|
1329
|
+
getRESTRole(roleID) {
|
|
1330
|
+
return this._client.getRESTGuildRole.call(this._client, this.id, roleID);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Get a guild's roles via the REST API. REST mode is required to use this endpoint.
|
|
1335
|
+
* @returns {Promise<Array<Role>>}
|
|
1336
|
+
*/
|
|
1337
|
+
getRESTRoles() {
|
|
1338
|
+
return this._client.getRESTGuildRoles.call(this._client, this.id);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Get a guild scheduled event via the REST API. REST mode is required to use this endpoint.
|
|
1343
|
+
* @arg {String} eventID The ID of the guild scheduled event
|
|
1344
|
+
* @arg {Object} [options] Options for the request
|
|
1345
|
+
* @arg {Boolean} [options.withUserCount] Whether to include the number of users subscribed to the event
|
|
1346
|
+
* @returns {Promise<GuildScheduledEvent>}
|
|
1347
|
+
*/
|
|
1348
|
+
getRESTScheduledEvent(eventID, options) {
|
|
1349
|
+
return this._client.getRESTGuildScheduledEvent.call(this._client, this.id, eventID, options);
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Get a guild sticker via the REST API. REST mode is required to use this endpoint.
|
|
1354
|
+
* @arg {String} stickerID The ID of the sticker
|
|
1355
|
+
* @returns {Promise<Object>} A sticker object
|
|
1356
|
+
*/
|
|
1357
|
+
getRESTSticker(stickerID) {
|
|
1358
|
+
return this._client.getRESTGuildSticker.call(this._client, this.id, stickerID);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Get a guild's stickers via the REST API. REST mode is required to use this endpoint.
|
|
1363
|
+
* @returns {Promise<Array<Object>>} An array of guild sticker objects
|
|
1364
|
+
*/
|
|
1365
|
+
getRESTStickers() {
|
|
1366
|
+
return this._client.getRESTGuildStickers.call(this._client, this.id);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Get the guild's role member counts
|
|
1371
|
+
* @returns {Promise<Object<String, Number>>} A map of role IDs to the number of members with the role. Does not include the @everyone role.
|
|
1372
|
+
*/
|
|
1373
|
+
getRoleMemberCounts() {
|
|
1374
|
+
return this._client.getGuildRoleMemberCounts.call(this._client, this.id);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* Get the combined guild-wide permissions of a role and `@everyone`
|
|
1379
|
+
* @arg {String} roleID The ID of the role
|
|
1380
|
+
* @returns {Promise<Permission>}
|
|
1381
|
+
*/
|
|
1382
|
+
getRolePermissions(roleID) {
|
|
1383
|
+
return this._client.getGuildRolePermissions.call(this._client, this.id, roleID);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Get the guild's scheduled events
|
|
1388
|
+
* @arg {Object} [options] Options for the request
|
|
1389
|
+
* @arg {Boolean} [options.withUserCount] Whether to include the number of users subscribed to each event
|
|
1390
|
+
* @returns {Promise<Array<GuildScheduledEvent>>}
|
|
1391
|
+
*/
|
|
1392
|
+
getScheduledEvents(options) {
|
|
1393
|
+
return this._client.getGuildScheduledEvents.call(this._client, this.id, options);
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Get a list of users subscribed to a guild scheduled event
|
|
1398
|
+
* @arg {String} eventID The ID of the event
|
|
1399
|
+
* @arg {Object} [options] Options for the request
|
|
1400
|
+
* @arg {String} [options.after] Get users after this user ID. If `options.before` is provided, this will be ignored. Fetching users in between `before` and `after` is not supported
|
|
1401
|
+
* @arg {String} [options.before] Get users before this user ID
|
|
1402
|
+
* @arg {Number} [options.limit=100] The number of users to get (max 100). Pagination will only work if one of `options.after` or `options.after` is also provided
|
|
1403
|
+
* @arg {Boolean} [options.withMember] Include guild member data
|
|
1404
|
+
* @returns {Promise<Array<{guildScheduledEventID: String, member?: Member, user: User}>}
|
|
1405
|
+
*/
|
|
1406
|
+
getScheduledEventUsers(eventID, options) {
|
|
1407
|
+
return this._client.getGuildScheduledEventUsers.call(this._client, this.id, eventID, options);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Get a guild soundboard sound. Not to be confused with getSoundboardSounds, which gets all soundboard sounds in this guild
|
|
1412
|
+
* @arg {String} soundID The ID of the soundboard sound
|
|
1413
|
+
* @returns {Promise<SoundboardSound>}
|
|
1414
|
+
*/
|
|
1415
|
+
getSoundboardSound(soundID) {
|
|
1416
|
+
return this._client.getGuildSoundboardSound.call(this._client, this.id, soundID);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
/**
|
|
1420
|
+
* Get the guild's soundboard sounds. Not to be confused with getSoundboardSound, which gets a specified soundboard sound
|
|
1421
|
+
* @returns {Promise<Array<SoundboardSound>>}
|
|
1422
|
+
*/
|
|
1423
|
+
getSoundboardSounds() {
|
|
1424
|
+
return this._client.getGuildSoundboardSounds.call(this._client, this.id);
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Get the guild's templates
|
|
1429
|
+
* @returns {Promise<Array<GuildTemplate>>}
|
|
1430
|
+
*/
|
|
1431
|
+
getTemplates() {
|
|
1432
|
+
return this._client.getGuildTemplates.call(this._client, this.id);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* Returns the vanity url of the guild
|
|
1437
|
+
* @returns {Promise}
|
|
1438
|
+
*/
|
|
1439
|
+
getVanity() {
|
|
1440
|
+
return this._client.getGuildVanity.call(this._client, this.id);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* Get possible voice regions for a guild
|
|
1445
|
+
* @returns {Promise<Array<Object>>} Resolves with an array of voice region objects
|
|
1446
|
+
*/
|
|
1447
|
+
getVoiceRegions() {
|
|
1448
|
+
return this._client.getVoiceRegions.call(this._client, this.id);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Get a guild user's voice state
|
|
1453
|
+
* @arg {String} [userID="@me"] The ID of the user
|
|
1454
|
+
* @returns {Promise<VoiceState>}
|
|
1455
|
+
*/
|
|
1456
|
+
getVoiceState(userID) {
|
|
1457
|
+
return this._client.getGuildVoiceState.call(this._client, this.id, userID);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Get all the webhooks in the guild
|
|
1462
|
+
* @returns {Promise<Array<Object>>} Resolves with an array of webhook objects
|
|
1463
|
+
*/
|
|
1464
|
+
getWebhooks() {
|
|
1465
|
+
return this._client.getGuildWebhooks.call(this._client, this.id);
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
/**
|
|
1469
|
+
* Get the welcome screen of the Community guild, shown to new members
|
|
1470
|
+
* @returns {Promise<Object>}
|
|
1471
|
+
*/
|
|
1472
|
+
getWelcomeScreen() {
|
|
1473
|
+
return this._client.getGuildWelcomeScreen.call(this._client, this.id);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Get a guild's widget object
|
|
1478
|
+
* @returns {Promise<Object>} A guild widget object
|
|
1479
|
+
*/
|
|
1480
|
+
getWidget() {
|
|
1481
|
+
return this._client.getGuildWidget.call(this._client, this.id);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* Get a guild's widget image
|
|
1486
|
+
* @arg {String} [style="shield"] The style of widget image
|
|
1487
|
+
* @returns {String} The image URL of widget image
|
|
1488
|
+
*/
|
|
1489
|
+
getWidgetImageURL(style) {
|
|
1490
|
+
return this._client.getGuildWidgetImageURL.call(this._client, this.id, style);
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* Get a guild's widget settings object
|
|
1495
|
+
* @returns {Promise<Object>} A guild widget settings object
|
|
1496
|
+
*/
|
|
1497
|
+
getWidgetSettings() {
|
|
1498
|
+
return this._client.getGuildWidgetSettings.call(this._client, this.id);
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Kick a member from the guild
|
|
1503
|
+
* @arg {String} userID The ID of the member
|
|
1504
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
1505
|
+
* @returns {Promise}
|
|
1506
|
+
*/
|
|
1507
|
+
kickMember(userID, reason) {
|
|
1508
|
+
return this._client.kickGuildMember.call(this._client, this.id, userID, reason);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Leave the guild
|
|
1513
|
+
* @returns {Promise}
|
|
1514
|
+
*/
|
|
1515
|
+
leave() {
|
|
1516
|
+
return this._client.leaveGuild.call(this._client, this.id);
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Leaves the voice channel in this guild
|
|
1521
|
+
*/
|
|
1522
|
+
leaveVoiceChannel() {
|
|
1523
|
+
this._client.closeVoiceConnection.call(this._client, this.id);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Get the guild permissions of a member
|
|
1528
|
+
* @arg {String | Member | Object} memberID The ID of the member or a Member object
|
|
1529
|
+
* @returns {Permission}
|
|
1530
|
+
*/
|
|
1531
|
+
permissionsOf(memberID) {
|
|
1532
|
+
const member = typeof memberID === "string" ? this.members.get(memberID) : memberID;
|
|
1533
|
+
if (member.id === this.ownerID) {
|
|
1534
|
+
return new Permission(Permissions.all);
|
|
1535
|
+
} else {
|
|
1536
|
+
let permissions = this.roles.get(this.id).permissions.allow;
|
|
1537
|
+
if (permissions & Permissions.administrator) {
|
|
1538
|
+
return new Permission(Permissions.all);
|
|
1539
|
+
}
|
|
1540
|
+
for (let role of member.roles) {
|
|
1541
|
+
role = this.roles.get(role);
|
|
1542
|
+
if (!role) {
|
|
1543
|
+
continue;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
const { allow: perm } = role.permissions;
|
|
1547
|
+
if (perm & Permissions.administrator) {
|
|
1548
|
+
permissions = Permissions.all;
|
|
1549
|
+
break;
|
|
1550
|
+
} else {
|
|
1551
|
+
permissions |= perm;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
return new Permission(permissions);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Begin pruning the guild
|
|
1560
|
+
* @arg {Number} [options] The options to pass to prune members
|
|
1561
|
+
* @arg {Boolean} [options.computePruneCount=true] Whether or not the number of pruned members should be returned. Discord discourages setting this to true for larger guilds
|
|
1562
|
+
* @arg {Number} [options.days=7] The number of days of inactivity to prune for
|
|
1563
|
+
* @arg {Array<String>} [options.includeRoles] An array of role IDs that members must have to be considered for pruning
|
|
1564
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
1565
|
+
* @returns {Promise<Number>} Resolves with the number of pruned members
|
|
1566
|
+
*/
|
|
1567
|
+
pruneMembers(options) {
|
|
1568
|
+
return this._client.pruneMembers.call(this._client, this.id, options);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
/**
|
|
1572
|
+
* Remove a role from a guild member
|
|
1573
|
+
* @arg {String} memberID The ID of the member
|
|
1574
|
+
* @arg {String} roleID The ID of the role
|
|
1575
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
1576
|
+
* @returns {Promise}
|
|
1577
|
+
*/
|
|
1578
|
+
removeMemberRole(memberID, roleID, reason) {
|
|
1579
|
+
return this._client.removeGuildMemberRole.call(this._client, this.id, memberID, roleID, reason);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Search for guild members by partial nickname/username
|
|
1584
|
+
* @arg {String} query The query string to match username(s) and nickname(s) against
|
|
1585
|
+
* @arg {Number} [limit=1] The maximum number of members you want returned, capped at 100
|
|
1586
|
+
* @returns {Promise<Array<Member>>}
|
|
1587
|
+
*/
|
|
1588
|
+
searchMembers(query, limit) {
|
|
1589
|
+
return this._client.searchGuildMembers.call(this._client, this.id, query, limit);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Search the messages of the guild. See `Client#searchGuildMessages` for the full list of options
|
|
1594
|
+
* @arg {Object} [options] The search options
|
|
1595
|
+
* @returns {Promise<Object>}
|
|
1596
|
+
*/
|
|
1597
|
+
searchMessages(options) {
|
|
1598
|
+
return this._client.searchGuildMessages.call(this._client, this.id, options);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Force a guild template to sync
|
|
1603
|
+
* @arg {String} code The template code
|
|
1604
|
+
* @returns {Promise<GuildTemplate>}
|
|
1605
|
+
*/
|
|
1606
|
+
syncTemplate(code) {
|
|
1607
|
+
return this._client.syncGuildTemplate.call(this._client, this.id, code);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Unban a user from the guild
|
|
1612
|
+
* @arg {String} userID The ID of the member
|
|
1613
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
1614
|
+
* @returns {Promise}
|
|
1615
|
+
*/
|
|
1616
|
+
unbanMember(userID, reason) {
|
|
1617
|
+
return this._client.unbanGuildMember.call(this._client, this.id, userID, reason);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
toJSON(props = []) {
|
|
1621
|
+
return super.toJSON([
|
|
1622
|
+
"afkChannelID",
|
|
1623
|
+
"afkTimeout",
|
|
1624
|
+
"applicationID",
|
|
1625
|
+
"approximateMemberCount",
|
|
1626
|
+
"approximatePresenceCount",
|
|
1627
|
+
"autoModerationRules",
|
|
1628
|
+
"autoRemoved",
|
|
1629
|
+
"banner",
|
|
1630
|
+
"categories",
|
|
1631
|
+
"channels",
|
|
1632
|
+
"defaultNotifications",
|
|
1633
|
+
"description",
|
|
1634
|
+
"discoverySplash",
|
|
1635
|
+
"emojiCount",
|
|
1636
|
+
"emojis",
|
|
1637
|
+
"explicitContentFilter",
|
|
1638
|
+
"features",
|
|
1639
|
+
"icon",
|
|
1640
|
+
"incidentsData",
|
|
1641
|
+
"joinedAt",
|
|
1642
|
+
"keywords",
|
|
1643
|
+
"large",
|
|
1644
|
+
"maxMembers",
|
|
1645
|
+
"maxPresences",
|
|
1646
|
+
"maxVideoChannelUsers",
|
|
1647
|
+
"memberCount",
|
|
1648
|
+
"members",
|
|
1649
|
+
"mfaLevel",
|
|
1650
|
+
"name",
|
|
1651
|
+
"ownerID",
|
|
1652
|
+
"preferredLocale",
|
|
1653
|
+
"premiumProgressBarEnabled",
|
|
1654
|
+
"premiumSubscriptionCount",
|
|
1655
|
+
"premiumTier",
|
|
1656
|
+
"primaryCategory",
|
|
1657
|
+
"primaryCategoryID",
|
|
1658
|
+
"publicUpdatesChannelID",
|
|
1659
|
+
"roles",
|
|
1660
|
+
"rulesChannelID",
|
|
1661
|
+
"splash",
|
|
1662
|
+
"stickers",
|
|
1663
|
+
"systemChannelFlags",
|
|
1664
|
+
"systemChannelID",
|
|
1665
|
+
"unavailable",
|
|
1666
|
+
"vanityURL",
|
|
1667
|
+
"verificationLevel",
|
|
1668
|
+
"voiceStates",
|
|
1669
|
+
"welcomeScreen",
|
|
1670
|
+
"widgetChannelID",
|
|
1671
|
+
"widgetEnabled",
|
|
1672
|
+
...props,
|
|
1673
|
+
]);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
module.exports = Guild;
|