@velliajs/discord 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -11
- package/package.json +3 -3
- package/src/client/BaseClient.js +7 -28
- package/src/client/Client.js +116 -283
- package/src/client/WebhookClient.js +17 -59
- package/src/client/actions/Action.js +0 -10
- package/src/client/actions/ActionsManager.js +3 -3
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +2 -15
- package/src/client/actions/AutoModerationActionExecution.js +1 -6
- package/src/client/actions/AutoModerationRuleCreate.js +1 -6
- package/src/client/actions/AutoModerationRuleDelete.js +1 -6
- package/src/client/actions/AutoModerationRuleUpdate.js +1 -7
- package/src/client/actions/ChannelCreate.js +1 -5
- package/src/client/actions/ChannelDelete.js +1 -5
- package/src/client/actions/GuildAuditLogEntryCreate.js +1 -6
- package/src/client/actions/GuildBanAdd.js +1 -5
- package/src/client/actions/GuildBanRemove.js +1 -5
- package/src/client/actions/GuildDelete.js +6 -14
- package/src/client/actions/GuildEmojiCreate.js +1 -5
- package/src/client/actions/GuildEmojiDelete.js +1 -5
- package/src/client/actions/GuildEmojiUpdate.js +1 -6
- package/src/client/actions/GuildEmojisUpdate.js +4 -4
- package/src/client/actions/GuildIntegrationsUpdate.js +1 -5
- package/src/client/actions/GuildMemberRemove.js +1 -5
- package/src/client/actions/GuildMemberUpdate.js +2 -11
- package/src/client/actions/GuildRoleCreate.js +1 -5
- package/src/client/actions/GuildRoleDelete.js +1 -5
- package/src/client/actions/GuildRoleUpdate.js +1 -6
- package/src/client/actions/GuildScheduledEventCreate.js +1 -5
- package/src/client/actions/GuildScheduledEventDelete.js +1 -5
- package/src/client/actions/GuildScheduledEventUpdate.js +1 -6
- package/src/client/actions/GuildScheduledEventUserAdd.js +1 -6
- package/src/client/actions/GuildScheduledEventUserRemove.js +1 -6
- package/src/client/actions/GuildStickerCreate.js +1 -5
- package/src/client/actions/GuildStickerDelete.js +1 -5
- package/src/client/actions/GuildStickerUpdate.js +1 -6
- package/src/client/actions/GuildStickersUpdate.js +4 -4
- package/src/client/actions/GuildUpdate.js +1 -6
- package/src/client/actions/InteractionCreate.js +3 -7
- package/src/client/actions/InviteCreate.js +1 -7
- package/src/client/actions/InviteDelete.js +1 -7
- package/src/client/actions/MessageCreate.js +1 -5
- package/src/client/actions/MessageDelete.js +1 -5
- package/src/client/actions/MessageDeleteBulk.js +1 -6
- package/src/client/actions/MessageReactionAdd.js +5 -18
- package/src/client/actions/MessageReactionRemove.js +5 -16
- package/src/client/actions/MessageReactionRemoveAll.js +4 -9
- package/src/client/actions/MessageReactionRemoveEmoji.js +1 -5
- package/src/client/actions/PresenceUpdate.js +1 -6
- package/src/client/actions/StageInstanceCreate.js +1 -5
- package/src/client/actions/StageInstanceDelete.js +1 -5
- package/src/client/actions/StageInstanceUpdate.js +1 -6
- package/src/client/actions/ThreadCreate.js +1 -6
- package/src/client/actions/ThreadDelete.js +1 -5
- package/src/client/actions/ThreadListSync.js +2 -7
- package/src/client/actions/ThreadMemberUpdate.js +2 -7
- package/src/client/actions/ThreadMembersUpdate.js +2 -9
- package/src/client/actions/TypingStart.js +1 -5
- package/src/client/actions/UserUpdate.js +1 -8
- package/src/client/actions/VoiceStateUpdate.js +4 -9
- package/src/client/actions/WebhooksUpdate.js +1 -6
- package/src/client/voice/ClientVoiceManager.js +3 -13
- package/src/client/websocket/WebSocketManager.js +25 -117
- package/src/client/websocket/WebSocketShard.js +29 -116
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +2 -8
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -6
- package/src/client/websocket/handlers/GUILD_CREATE.js +3 -7
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +2 -16
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +1 -5
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -6
- package/src/client/websocket/handlers/RESUMED.js +1 -6
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -6
- package/src/errors/DJSError.js +3 -14
- package/src/errors/ErrorCodes.js +2 -164
- package/src/index.js +6 -6
- package/src/managers/ApplicationCommandManager.js +14 -130
- package/src/managers/ApplicationCommandPermissionsManager.js +31 -202
- package/src/managers/AutoModerationRuleManager.js +17 -145
- package/src/managers/BaseGuildEmojiManager.js +7 -38
- package/src/managers/BaseManager.js +2 -10
- package/src/managers/CachedManager.js +3 -17
- package/src/managers/CategoryChannelChildManager.js +6 -48
- package/src/managers/ChannelManager.js +11 -52
- package/src/managers/DataManager.js +5 -27
- package/src/managers/GuildApplicationCommandManager.js +3 -12
- package/src/managers/GuildBanManager.js +16 -105
- package/src/managers/GuildChannelManager.js +31 -226
- package/src/managers/GuildEmojiManager.js +9 -65
- package/src/managers/GuildEmojiRoleManager.js +8 -47
- package/src/managers/GuildForumThreadManager.js +5 -39
- package/src/managers/GuildInviteManager.js +18 -117
- package/src/managers/GuildManager.js +14 -115
- package/src/managers/GuildMemberManager.js +38 -256
- package/src/managers/GuildMemberRoleManager.js +13 -76
- package/src/managers/GuildScheduledEventManager.js +25 -128
- package/src/managers/GuildStickerManager.js +16 -96
- package/src/managers/GuildTextThreadManager.js +4 -47
- package/src/managers/MessageManager.js +23 -137
- package/src/managers/PermissionOverwriteManager.js +10 -78
- package/src/managers/PresenceManager.js +6 -27
- package/src/managers/ReactionManager.js +7 -40
- package/src/managers/ReactionUserManager.js +6 -29
- package/src/managers/RoleManager.js +29 -177
- package/src/managers/StageInstanceManager.js +14 -77
- package/src/managers/ThreadManager.js +23 -113
- package/src/managers/ThreadMemberManager.js +20 -89
- package/src/managers/UserManager.js +13 -65
- package/src/managers/VoiceStateManager.js +3 -13
- package/src/sharding/Shard.js +42 -158
- package/src/sharding/ShardClientUtil.js +17 -101
- package/src/sharding/ShardingManager.js +34 -151
- package/src/structures/ActionRow.js +4 -21
- package/src/structures/ActionRowBuilder.js +3 -13
- package/src/structures/AnonymousGuild.js +10 -43
- package/src/structures/ApplicationCommand.js +54 -308
- package/src/structures/ApplicationRoleConnectionMetadata.js +7 -27
- package/src/structures/Attachment.js +16 -65
- package/src/structures/AttachmentBuilder.js +13 -58
- package/src/structures/AutoModerationActionExecution.js +16 -69
- package/src/structures/AutoModerationRule.js +32 -164
- package/src/structures/AutocompleteInteraction.js +10 -52
- package/src/structures/Base.js +2 -10
- package/src/structures/BaseChannel.js +16 -80
- package/src/structures/BaseGuild.js +13 -59
- package/src/structures/BaseGuildEmoji.js +5 -21
- package/src/structures/BaseGuildTextChannel.js +19 -100
- package/src/structures/BaseGuildVoiceChannel.js +21 -110
- package/src/structures/BaseInteraction.js +40 -196
- package/src/structures/BaseSelectMenuComponent.js +6 -29
- package/src/structures/ButtonBuilder.js +4 -18
- package/src/structures/ButtonComponent.js +7 -34
- package/src/structures/ButtonInteraction.js +1 -4
- package/src/structures/CategoryChannel.js +5 -30
- package/src/structures/ChannelSelectMenuBuilder.js +3 -13
- package/src/structures/ChannelSelectMenuComponent.js +2 -9
- package/src/structures/ChannelSelectMenuInteraction.js +3 -12
- package/src/structures/ChatInputCommandInteraction.js +3 -13
- package/src/structures/ClientApplication.js +20 -83
- package/src/structures/ClientPresence.js +5 -20
- package/src/structures/ClientUser.js +21 -118
- package/src/structures/CommandInteraction.js +21 -96
- package/src/structures/CommandInteractionOptionResolver.js +26 -147
- package/src/structures/Component.js +5 -21
- package/src/structures/ContextMenuCommandInteraction.js +4 -18
- package/src/structures/DMChannel.js +17 -52
- package/src/structures/DirectoryChannel.js +4 -16
- package/src/structures/Embed.js +21 -107
- package/src/structures/EmbedBuilder.js +4 -18
- package/src/structures/Emoji.js +12 -60
- package/src/structures/ForumChannel.js +30 -140
- package/src/structures/Guild.js +117 -697
- package/src/structures/GuildAuditLogs.js +7 -32
- package/src/structures/GuildAuditLogsEntry.js +27 -135
- package/src/structures/GuildBan.js +6 -26
- package/src/structures/GuildChannel.js +36 -188
- package/src/structures/GuildEmoji.js +13 -67
- package/src/structures/GuildMember.js +47 -270
- package/src/structures/GuildPreview.js +19 -84
- package/src/structures/GuildPreviewEmoji.js +3 -13
- package/src/structures/GuildScheduledEvent.js +46 -250
- package/src/structures/GuildTemplate.js +24 -108
- package/src/structures/Integration.js +25 -103
- package/src/structures/IntegrationApplication.js +8 -32
- package/src/structures/InteractionCollector.js +22 -113
- package/src/structures/InteractionResponse.js +11 -46
- package/src/structures/InteractionWebhook.js +8 -33
- package/src/structures/Invite.js +27 -131
- package/src/structures/InviteGuild.js +2 -8
- package/src/structures/InviteStageInstance.js +9 -39
- package/src/structures/MentionableSelectMenuBuilder.js +3 -14
- package/src/structures/MentionableSelectMenuComponent.js +1 -4
- package/src/structures/MentionableSelectMenuInteraction.js +5 -20
- package/src/structures/Message.js +85 -460
- package/src/structures/MessageCollector.js +14 -70
- package/src/structures/MessageComponentInteraction.js +14 -57
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -9
- package/src/structures/MessageMentions.js +25 -136
- package/src/structures/MessagePayload.js +24 -94
- package/src/structures/MessageReaction.js +13 -51
- package/src/structures/ModalBuilder.js +3 -13
- package/src/structures/ModalSubmitFields.js +5 -22
- package/src/structures/ModalSubmitInteraction.js +17 -61
- package/src/structures/NewsChannel.js +2 -16
- package/src/structures/OAuth2Guild.js +3 -12
- package/src/structures/PartialGroupDMChannel.js +7 -27
- package/src/structures/PermissionOverwrites.js +20 -99
- package/src/structures/Presence.js +45 -190
- package/src/structures/ReactionCollector.js +20 -108
- package/src/structures/ReactionEmoji.js +2 -10
- package/src/structures/Role.js +39 -261
- package/src/structures/RoleSelectMenuBuilder.js +3 -13
- package/src/structures/RoleSelectMenuComponent.js +1 -4
- package/src/structures/RoleSelectMenuInteraction.js +3 -12
- package/src/structures/SelectMenuBuilder.js +1 -4
- package/src/structures/SelectMenuComponent.js +1 -4
- package/src/structures/SelectMenuInteraction.js +1 -4
- package/src/structures/SelectMenuOptionBuilder.js +1 -4
- package/src/structures/StageChannel.js +12 -84
- package/src/structures/StageInstance.js +16 -87
- package/src/structures/Sticker.js +25 -124
- package/src/structures/StickerPack.js +12 -52
- package/src/structures/StringSelectMenuBuilder.js +6 -29
- package/src/structures/StringSelectMenuComponent.js +2 -9
- package/src/structures/StringSelectMenuInteraction.js +2 -8
- package/src/structures/StringSelectMenuOptionBuilder.js +4 -18
- package/src/structures/Team.js +11 -52
- package/src/structures/TeamMember.js +7 -33
- package/src/structures/TextChannel.js +3 -14
- package/src/structures/TextInputBuilder.js +3 -13
- package/src/structures/TextInputComponent.js +3 -14
- package/src/structures/ThreadChannel.js +59 -305
- package/src/structures/ThreadMember.js +12 -55
- package/src/structures/Typing.js +8 -35
- package/src/structures/User.js +29 -151
- package/src/structures/UserContextMenuCommandInteraction.js +3 -14
- package/src/structures/UserSelectMenuBuilder.js +3 -13
- package/src/structures/UserSelectMenuComponent.js +1 -4
- package/src/structures/UserSelectMenuInteraction.js +4 -16
- package/src/structures/VoiceChannel.js +8 -67
- package/src/structures/VoiceRegion.js +6 -23
- package/src/structures/VoiceState.js +28 -140
- package/src/structures/Webhook.js +37 -227
- package/src/structures/WelcomeChannel.js +7 -29
- package/src/structures/WelcomeScreen.js +5 -20
- package/src/structures/Widget.js +9 -40
- package/src/structures/WidgetMember.js +15 -61
- package/src/structures/interfaces/Application.js +10 -49
- package/src/structures/interfaces/Collector.js +34 -155
- package/src/structures/interfaces/InteractionResponses.js +25 -164
- package/src/structures/interfaces/TextBasedChannel.js +37 -232
- package/src/util/APITypes.js +183 -456
- package/src/util/ActivityFlagsBitField.js +3 -15
- package/src/util/ApplicationFlagsBitField.js +3 -15
- package/src/util/BitField.js +17 -82
- package/src/util/ChannelFlagsBitField.js +7 -30
- package/src/util/Channels.js +5 -35
- package/src/util/Colors.js +3 -38
- package/src/util/Components.js +21 -75
- package/src/util/Constants.js +17 -144
- package/src/util/DataResolver.js +20 -77
- package/src/util/Events.js +3 -81
- package/src/util/Formatters.js +58 -305
- package/src/util/GuildMemberFlagsBitField.js +7 -30
- package/src/util/IntentsBitField.js +4 -23
- package/src/util/LimitedCollection.js +4 -21
- package/src/util/MessageFlagsBitField.js +5 -21
- package/src/util/Options.js +24 -137
- package/src/util/Partials.js +3 -30
- package/src/util/PermissionsBitField.js +12 -67
- package/src/util/ShardEvents.js +3 -15
- package/src/util/Status.js +3 -17
- package/src/util/Sweepers.js +35 -184
- package/src/util/SystemChannelFlagsBitField.js +7 -32
- package/src/util/ThreadMemberFlagsBitField.js +5 -21
- package/src/util/Transformers.js +2 -11
- package/src/util/UserFlagsBitField.js +5 -21
- package/src/util/Util.js +30 -169
- package/src/util/WebSocketShardEvents.js +3 -14
|
@@ -7,118 +7,34 @@ const { DiscordjsError, ErrorCodes } = require('../errors');
|
|
|
7
7
|
const Invite = require('../structures/Invite');
|
|
8
8
|
const DataResolver = require('../util/DataResolver');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* Manages API methods for GuildInvites and stores their cache.
|
|
12
|
-
* @extends {CachedManager}
|
|
13
|
-
*/
|
|
10
|
+
|
|
14
11
|
class GuildInviteManager extends CachedManager {
|
|
15
12
|
constructor(guild, iterable) {
|
|
16
13
|
super(guild.client, Invite, iterable);
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
* The guild this Manager belongs to
|
|
20
|
-
* @type {Guild}
|
|
21
|
-
*/
|
|
15
|
+
|
|
22
16
|
this.guild = guild;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
* The cache of this Manager
|
|
27
|
-
* @type {Collection<string, Invite>}
|
|
28
|
-
* @name GuildInviteManager#cache
|
|
29
|
-
*/
|
|
19
|
+
|
|
30
20
|
|
|
31
21
|
_add(data, cache) {
|
|
32
22
|
return super._add(data, cache, { id: data.code, extras: [this.guild] });
|
|
33
23
|
}
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* * Snowflake
|
|
49
|
-
* @typedef {TextChannel|VoiceChannel|NewsChannel|StageChannel|Snowflake}
|
|
50
|
-
* GuildInvitableChannelResolvable
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Resolves an InviteResolvable to an Invite object.
|
|
55
|
-
* @method resolve
|
|
56
|
-
* @memberof GuildInviteManager
|
|
57
|
-
* @instance
|
|
58
|
-
* @param {InviteResolvable} invite The invite resolvable to resolve
|
|
59
|
-
* @returns {?Invite}
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Resolves an InviteResolvable to an invite code string.
|
|
64
|
-
* @method resolveId
|
|
65
|
-
* @memberof GuildInviteManager
|
|
66
|
-
* @instance
|
|
67
|
-
* @param {InviteResolvable} invite The invite resolvable to resolve
|
|
68
|
-
* @returns {?string}
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Options used to fetch a single invite from a guild.
|
|
73
|
-
* @typedef {Object} FetchInviteOptions
|
|
74
|
-
* @property {InviteResolvable} code The invite to fetch
|
|
75
|
-
* @property {boolean} [cache=true] Whether or not to cache the fetched invite
|
|
76
|
-
* @property {boolean} [force=false] Whether to skip the cache check and request the API
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Options used to fetch all invites from a guild.
|
|
81
|
-
* @typedef {Object} FetchInvitesOptions
|
|
82
|
-
* @property {GuildInvitableChannelResolvable} [channelId]
|
|
83
|
-
* The channel to fetch all invites from
|
|
84
|
-
* @property {boolean} [cache=true] Whether or not to cache the fetched invites
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Fetches invite(s) from Discord.
|
|
89
|
-
* @param {InviteResolvable|FetchInviteOptions|FetchInvitesOptions} [options] Options for fetching guild invite(s)
|
|
90
|
-
* @returns {Promise<Invite|Collection<string, Invite>>}
|
|
91
|
-
* @example
|
|
92
|
-
* // Fetch all invites from a guild
|
|
93
|
-
* guild.invites.fetch()
|
|
94
|
-
* .then(console.log)
|
|
95
|
-
* .catch(console.error);
|
|
96
|
-
* @example
|
|
97
|
-
* // Fetch all invites from a guild without caching
|
|
98
|
-
* guild.invites.fetch({ cache: false })
|
|
99
|
-
* .then(console.log)
|
|
100
|
-
* .catch(console.error);
|
|
101
|
-
* @example
|
|
102
|
-
* // Fetch all invites from a channel
|
|
103
|
-
* guild.invites.fetch({ channelId: '222197033908436994' })
|
|
104
|
-
* .then(console.log)
|
|
105
|
-
* .catch(console.error);
|
|
106
|
-
* @example
|
|
107
|
-
* // Fetch a single invite
|
|
108
|
-
* guild.invites.fetch('bRCvFy9')
|
|
109
|
-
* .then(console.log)
|
|
110
|
-
* .catch(console.error);
|
|
111
|
-
* @example
|
|
112
|
-
* // Fetch a single invite without checking cache
|
|
113
|
-
* guild.invites.fetch({ code: 'bRCvFy9', force: true })
|
|
114
|
-
* .then(console.log)
|
|
115
|
-
* .catch(console.error)
|
|
116
|
-
* @example
|
|
117
|
-
* // Fetch a single invite without caching
|
|
118
|
-
* guild.invites.fetch({ code: 'bRCvFy9', cache: false })
|
|
119
|
-
* .then(console.log)
|
|
120
|
-
* .catch(console.error);
|
|
121
|
-
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
122
38
|
fetch(options) {
|
|
123
39
|
if (!options) return this._fetchMany();
|
|
124
40
|
if (typeof options === 'string') {
|
|
@@ -164,17 +80,7 @@ class GuildInviteManager extends CachedManager {
|
|
|
164
80
|
return data.reduce((col, invite) => col.set(invite.code, this._add(invite, cache)), new Collection());
|
|
165
81
|
}
|
|
166
82
|
|
|
167
|
-
|
|
168
|
-
* Create an invite to the guild from the provided channel.
|
|
169
|
-
* @param {GuildInvitableChannelResolvable} channel The options for creating the invite from a channel.
|
|
170
|
-
* @param {InviteCreateOptions} [options={}] The options for creating the invite from a channel.
|
|
171
|
-
* @returns {Promise<Invite>}
|
|
172
|
-
* @example
|
|
173
|
-
* // Create an invite to a selected channel
|
|
174
|
-
* guild.invites.create('599942732013764608')
|
|
175
|
-
* .then(console.log)
|
|
176
|
-
* .catch(console.error);
|
|
177
|
-
*/
|
|
83
|
+
|
|
178
84
|
async create(
|
|
179
85
|
channel,
|
|
180
86
|
{ temporary, maxAge, maxUses, unique, targetUser, targetApplication, targetType, reason } = {},
|
|
@@ -197,12 +103,7 @@ class GuildInviteManager extends CachedManager {
|
|
|
197
103
|
return new Invite(this.client, invite);
|
|
198
104
|
}
|
|
199
105
|
|
|
200
|
-
|
|
201
|
-
* Deletes an invite.
|
|
202
|
-
* @param {InviteResolvable} invite The invite to delete
|
|
203
|
-
* @param {string} [reason] Reason for deleting the invite
|
|
204
|
-
* @returns {Promise<void>}
|
|
205
|
-
*/
|
|
106
|
+
|
|
206
107
|
async delete(invite, reason) {
|
|
207
108
|
const code = DataResolver.resolveInviteCode(invite);
|
|
208
109
|
|
|
@@ -21,10 +21,7 @@ const { resolveColor } = require('../util/Util');
|
|
|
21
21
|
|
|
22
22
|
let cacheWarningEmitted = false;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
* Manages API methods for Guilds and stores their cache.
|
|
26
|
-
* @extends {CachedManager}
|
|
27
|
-
*/
|
|
24
|
+
|
|
28
25
|
class GuildManager extends CachedManager {
|
|
29
26
|
constructor(client, iterable) {
|
|
30
27
|
super(client, Guild, iterable);
|
|
@@ -37,72 +34,17 @@ class GuildManager extends CachedManager {
|
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
* The cache of this Manager
|
|
42
|
-
* @type {Collection<Snowflake, Guild>}
|
|
43
|
-
* @name GuildManager#cache
|
|
44
|
-
*/
|
|
37
|
+
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
* Data that resolves to give a Guild object. This can be:
|
|
48
|
-
* * A Guild object
|
|
49
|
-
* * A GuildChannel object
|
|
50
|
-
* * A GuildEmoji object
|
|
51
|
-
* * A Role object
|
|
52
|
-
* * A Snowflake
|
|
53
|
-
* * An Invite object
|
|
54
|
-
* @typedef {Guild|GuildChannel|GuildMember|GuildEmoji|Role|Snowflake|Invite} GuildResolvable
|
|
55
|
-
*/
|
|
39
|
+
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
* Partial data for a Role.
|
|
59
|
-
* @typedef {Object} PartialRoleData
|
|
60
|
-
* @property {Snowflake|number} [id] The role's id, used to set channel overrides.
|
|
61
|
-
* This is a placeholder and will be replaced by the API after consumption
|
|
62
|
-
* @property {string} [name] The name of the role
|
|
63
|
-
* @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number
|
|
64
|
-
* @property {boolean} [hoist] Whether the role should be hoisted
|
|
65
|
-
* @property {number} [position] The position of the role
|
|
66
|
-
* @property {PermissionResolvable} [permissions] The permissions of the role
|
|
67
|
-
* @property {boolean} [mentionable] Whether the role should be mentionable
|
|
68
|
-
*/
|
|
41
|
+
|
|
69
42
|
|
|
70
|
-
|
|
71
|
-
* Partial overwrite data.
|
|
72
|
-
* @typedef {Object} PartialOverwriteData
|
|
73
|
-
* @property {Snowflake|number} id The id of the {@link Role} or {@link User} this overwrite belongs to
|
|
74
|
-
* @property {OverwriteType} [type] The type of this overwrite
|
|
75
|
-
* @property {PermissionResolvable} [allow] The permissions to allow
|
|
76
|
-
* @property {PermissionResolvable} [deny] The permissions to deny
|
|
77
|
-
*/
|
|
43
|
+
|
|
78
44
|
|
|
79
|
-
|
|
80
|
-
* Partial data for a Channel.
|
|
81
|
-
* @typedef {Object} PartialChannelData
|
|
82
|
-
* @property {Snowflake|number} [id] The channel's id, used to set its parent.
|
|
83
|
-
* This is a placeholder and will be replaced by the API after consumption
|
|
84
|
-
* @property {Snowflake|number} [parentId] The parent id for this channel
|
|
85
|
-
* @property {ChannelType.GuildText|ChannelType.GuildVoice|ChannelType.GuildCategory} [type] The type of the channel
|
|
86
|
-
* @property {string} name The name of the channel
|
|
87
|
-
* @property {?string} [topic] The topic of the text channel
|
|
88
|
-
* @property {boolean} [nsfw] Whether the channel is NSFW
|
|
89
|
-
* @property {number} [bitrate] The bitrate of the voice channel
|
|
90
|
-
* @property {number} [userLimit] The user limit of the channel
|
|
91
|
-
* @property {?string} [rtcRegion] The RTC region of the channel
|
|
92
|
-
* @property {VideoQualityMode} [videoQualityMode] The camera video quality mode of the channel
|
|
93
|
-
* @property {PartialOverwriteData[]} [permissionOverwrites]
|
|
94
|
-
* Overwrites of the channel
|
|
95
|
-
* @property {number} [rateLimitPerUser] The rate limit per user (slowmode) of the channel in seconds
|
|
96
|
-
*/
|
|
45
|
+
|
|
97
46
|
|
|
98
|
-
|
|
99
|
-
* Resolves a GuildResolvable to a Guild object.
|
|
100
|
-
* @method resolve
|
|
101
|
-
* @memberof GuildManager
|
|
102
|
-
* @instance
|
|
103
|
-
* @param {GuildResolvable} guild The guild resolvable to identify
|
|
104
|
-
* @returns {?Guild}
|
|
105
|
-
*/
|
|
47
|
+
|
|
106
48
|
resolve(guild) {
|
|
107
49
|
if (
|
|
108
50
|
guild instanceof GuildChannel ||
|
|
@@ -116,14 +58,7 @@ class GuildManager extends CachedManager {
|
|
|
116
58
|
return super.resolve(guild);
|
|
117
59
|
}
|
|
118
60
|
|
|
119
|
-
|
|
120
|
-
* Resolves a {@link GuildResolvable} to a {@link Guild} id string.
|
|
121
|
-
* @method resolveId
|
|
122
|
-
* @memberof GuildManager
|
|
123
|
-
* @instance
|
|
124
|
-
* @param {GuildResolvable} guild The guild resolvable to identify
|
|
125
|
-
* @returns {?Snowflake}
|
|
126
|
-
*/
|
|
61
|
+
|
|
127
62
|
resolveId(guild) {
|
|
128
63
|
if (
|
|
129
64
|
guild instanceof GuildChannel ||
|
|
@@ -137,31 +72,10 @@ class GuildManager extends CachedManager {
|
|
|
137
72
|
return super.resolveId(guild);
|
|
138
73
|
}
|
|
139
74
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* @typedef {Object} GuildCreateOptions
|
|
143
|
-
* @property {string} name The name of the guild
|
|
144
|
-
* @property {?(BufferResolvable|Base64Resolvable)} [icon=null] The icon for the guild
|
|
145
|
-
* @property {GuildVerificationLevel} [verificationLevel] The verification level for the guild
|
|
146
|
-
* @property {GuildDefaultMessageNotifications} [defaultMessageNotifications] The default message notifications
|
|
147
|
-
* for the guild
|
|
148
|
-
* @property {GuildExplicitContentFilter} [explicitContentFilter] The explicit content filter level for the guild
|
|
149
|
-
* @property {PartialRoleData[]} [roles=[]] The roles for this guild,
|
|
150
|
-
* @property {PartialChannelData[]} [channels=[]] The channels for this guild
|
|
151
|
-
* @property {Snowflake|number} [afkChannelId] The AFK channel's id
|
|
152
|
-
* @property {number} [afkTimeout] The AFK timeout in seconds
|
|
153
|
-
* the first element of this array is used to change properties of the guild's everyone role.
|
|
154
|
-
* @property {Snowflake|number} [systemChannelId] The system channel's id
|
|
155
|
-
* @property {SystemChannelFlagsResolvable} [systemChannelFlags] The flags of the system channel
|
|
156
|
-
*/
|
|
157
|
-
/* eslint-enable max-len */
|
|
75
|
+
|
|
76
|
+
|
|
158
77
|
|
|
159
|
-
|
|
160
|
-
* Creates a guild.
|
|
161
|
-
* <warn>This is only available to bots in fewer than 10 guilds.</warn>
|
|
162
|
-
* @param {GuildCreateOptions} options Options for creating the guild
|
|
163
|
-
* @returns {Promise<Guild>} The guild that was created
|
|
164
|
-
*/
|
|
78
|
+
|
|
165
79
|
async create({
|
|
166
80
|
name,
|
|
167
81
|
icon = null,
|
|
@@ -240,26 +154,11 @@ class GuildManager extends CachedManager {
|
|
|
240
154
|
);
|
|
241
155
|
}
|
|
242
156
|
|
|
243
|
-
|
|
244
|
-
* Options used to fetch a single guild.
|
|
245
|
-
* @typedef {BaseFetchOptions} FetchGuildOptions
|
|
246
|
-
* @property {GuildResolvable} guild The guild to fetch
|
|
247
|
-
* @property {boolean} [withCounts=true] Whether the approximate member and presence counts should be returned
|
|
248
|
-
*/
|
|
157
|
+
|
|
249
158
|
|
|
250
|
-
|
|
251
|
-
* Options used to fetch multiple guilds.
|
|
252
|
-
* @typedef {Object} FetchGuildsOptions
|
|
253
|
-
* @property {Snowflake} [before] Get guilds before this guild id
|
|
254
|
-
* @property {Snowflake} [after] Get guilds after this guild id
|
|
255
|
-
* @property {number} [limit] Maximum number of guilds to request (1-200)
|
|
256
|
-
*/
|
|
159
|
+
|
|
257
160
|
|
|
258
|
-
|
|
259
|
-
* Obtains one or multiple guilds from Discord, or the guild cache if it's already available.
|
|
260
|
-
* @param {GuildResolvable|FetchGuildOptions|FetchGuildsOptions} [options] The guild's id or options
|
|
261
|
-
* @returns {Promise<Guild|Collection<Snowflake, OAuth2Guild>>}
|
|
262
|
-
*/
|
|
161
|
+
|
|
263
162
|
async fetch(options = {}) {
|
|
264
163
|
const id = this.resolveId(options) ?? this.resolveId(options.guild);
|
|
265
164
|
|