@velliajs/discord 1.0.3 → 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.
Files changed (257) hide show
  1. package/package.json +1 -1
  2. package/src/client/BaseClient.js +7 -28
  3. package/src/client/Client.js +116 -283
  4. package/src/client/WebhookClient.js +17 -59
  5. package/src/client/actions/Action.js +0 -10
  6. package/src/client/actions/ActionsManager.js +3 -3
  7. package/src/client/actions/ApplicationCommandPermissionsUpdate.js +2 -15
  8. package/src/client/actions/AutoModerationActionExecution.js +1 -6
  9. package/src/client/actions/AutoModerationRuleCreate.js +1 -6
  10. package/src/client/actions/AutoModerationRuleDelete.js +1 -6
  11. package/src/client/actions/AutoModerationRuleUpdate.js +1 -7
  12. package/src/client/actions/ChannelCreate.js +1 -5
  13. package/src/client/actions/ChannelDelete.js +1 -5
  14. package/src/client/actions/GuildAuditLogEntryCreate.js +1 -6
  15. package/src/client/actions/GuildBanAdd.js +1 -5
  16. package/src/client/actions/GuildBanRemove.js +1 -5
  17. package/src/client/actions/GuildDelete.js +6 -14
  18. package/src/client/actions/GuildEmojiCreate.js +1 -5
  19. package/src/client/actions/GuildEmojiDelete.js +1 -5
  20. package/src/client/actions/GuildEmojiUpdate.js +1 -6
  21. package/src/client/actions/GuildEmojisUpdate.js +4 -4
  22. package/src/client/actions/GuildIntegrationsUpdate.js +1 -5
  23. package/src/client/actions/GuildMemberRemove.js +1 -5
  24. package/src/client/actions/GuildMemberUpdate.js +2 -11
  25. package/src/client/actions/GuildRoleCreate.js +1 -5
  26. package/src/client/actions/GuildRoleDelete.js +1 -5
  27. package/src/client/actions/GuildRoleUpdate.js +1 -6
  28. package/src/client/actions/GuildScheduledEventCreate.js +1 -5
  29. package/src/client/actions/GuildScheduledEventDelete.js +1 -5
  30. package/src/client/actions/GuildScheduledEventUpdate.js +1 -6
  31. package/src/client/actions/GuildScheduledEventUserAdd.js +1 -6
  32. package/src/client/actions/GuildScheduledEventUserRemove.js +1 -6
  33. package/src/client/actions/GuildStickerCreate.js +1 -5
  34. package/src/client/actions/GuildStickerDelete.js +1 -5
  35. package/src/client/actions/GuildStickerUpdate.js +1 -6
  36. package/src/client/actions/GuildStickersUpdate.js +4 -4
  37. package/src/client/actions/GuildUpdate.js +1 -6
  38. package/src/client/actions/InteractionCreate.js +3 -7
  39. package/src/client/actions/InviteCreate.js +1 -7
  40. package/src/client/actions/InviteDelete.js +1 -7
  41. package/src/client/actions/MessageCreate.js +1 -5
  42. package/src/client/actions/MessageDelete.js +1 -5
  43. package/src/client/actions/MessageDeleteBulk.js +1 -6
  44. package/src/client/actions/MessageReactionAdd.js +5 -18
  45. package/src/client/actions/MessageReactionRemove.js +5 -16
  46. package/src/client/actions/MessageReactionRemoveAll.js +4 -9
  47. package/src/client/actions/MessageReactionRemoveEmoji.js +1 -5
  48. package/src/client/actions/PresenceUpdate.js +1 -6
  49. package/src/client/actions/StageInstanceCreate.js +1 -5
  50. package/src/client/actions/StageInstanceDelete.js +1 -5
  51. package/src/client/actions/StageInstanceUpdate.js +1 -6
  52. package/src/client/actions/ThreadCreate.js +1 -6
  53. package/src/client/actions/ThreadDelete.js +1 -5
  54. package/src/client/actions/ThreadListSync.js +2 -7
  55. package/src/client/actions/ThreadMemberUpdate.js +2 -7
  56. package/src/client/actions/ThreadMembersUpdate.js +2 -9
  57. package/src/client/actions/TypingStart.js +1 -5
  58. package/src/client/actions/UserUpdate.js +1 -8
  59. package/src/client/actions/VoiceStateUpdate.js +4 -9
  60. package/src/client/actions/WebhooksUpdate.js +1 -6
  61. package/src/client/voice/ClientVoiceManager.js +3 -13
  62. package/src/client/websocket/WebSocketManager.js +25 -117
  63. package/src/client/websocket/WebSocketShard.js +29 -116
  64. package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +2 -8
  65. package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -6
  66. package/src/client/websocket/handlers/GUILD_CREATE.js +3 -7
  67. package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +2 -16
  68. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +1 -5
  69. package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -6
  70. package/src/client/websocket/handlers/RESUMED.js +1 -6
  71. package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -6
  72. package/src/errors/DJSError.js +3 -14
  73. package/src/errors/ErrorCodes.js +2 -164
  74. package/src/index.js +6 -6
  75. package/src/managers/ApplicationCommandManager.js +14 -130
  76. package/src/managers/ApplicationCommandPermissionsManager.js +31 -202
  77. package/src/managers/AutoModerationRuleManager.js +17 -145
  78. package/src/managers/BaseGuildEmojiManager.js +7 -38
  79. package/src/managers/BaseManager.js +2 -10
  80. package/src/managers/CachedManager.js +3 -17
  81. package/src/managers/CategoryChannelChildManager.js +6 -48
  82. package/src/managers/ChannelManager.js +11 -52
  83. package/src/managers/DataManager.js +5 -27
  84. package/src/managers/GuildApplicationCommandManager.js +3 -12
  85. package/src/managers/GuildBanManager.js +16 -105
  86. package/src/managers/GuildChannelManager.js +31 -226
  87. package/src/managers/GuildEmojiManager.js +9 -65
  88. package/src/managers/GuildEmojiRoleManager.js +8 -47
  89. package/src/managers/GuildForumThreadManager.js +5 -39
  90. package/src/managers/GuildInviteManager.js +18 -117
  91. package/src/managers/GuildManager.js +14 -115
  92. package/src/managers/GuildMemberManager.js +38 -256
  93. package/src/managers/GuildMemberRoleManager.js +13 -76
  94. package/src/managers/GuildScheduledEventManager.js +25 -128
  95. package/src/managers/GuildStickerManager.js +16 -96
  96. package/src/managers/GuildTextThreadManager.js +4 -47
  97. package/src/managers/MessageManager.js +23 -137
  98. package/src/managers/PermissionOverwriteManager.js +10 -78
  99. package/src/managers/PresenceManager.js +6 -27
  100. package/src/managers/ReactionManager.js +7 -40
  101. package/src/managers/ReactionUserManager.js +6 -29
  102. package/src/managers/RoleManager.js +29 -177
  103. package/src/managers/StageInstanceManager.js +14 -77
  104. package/src/managers/ThreadManager.js +23 -113
  105. package/src/managers/ThreadMemberManager.js +20 -89
  106. package/src/managers/UserManager.js +13 -65
  107. package/src/managers/VoiceStateManager.js +3 -13
  108. package/src/sharding/Shard.js +42 -158
  109. package/src/sharding/ShardClientUtil.js +17 -101
  110. package/src/sharding/ShardingManager.js +34 -151
  111. package/src/structures/ActionRow.js +4 -21
  112. package/src/structures/ActionRowBuilder.js +3 -13
  113. package/src/structures/AnonymousGuild.js +10 -43
  114. package/src/structures/ApplicationCommand.js +54 -308
  115. package/src/structures/ApplicationRoleConnectionMetadata.js +7 -27
  116. package/src/structures/Attachment.js +16 -65
  117. package/src/structures/AttachmentBuilder.js +13 -58
  118. package/src/structures/AutoModerationActionExecution.js +16 -69
  119. package/src/structures/AutoModerationRule.js +32 -164
  120. package/src/structures/AutocompleteInteraction.js +10 -52
  121. package/src/structures/Base.js +2 -10
  122. package/src/structures/BaseChannel.js +16 -80
  123. package/src/structures/BaseGuild.js +13 -59
  124. package/src/structures/BaseGuildEmoji.js +5 -21
  125. package/src/structures/BaseGuildTextChannel.js +19 -100
  126. package/src/structures/BaseGuildVoiceChannel.js +21 -110
  127. package/src/structures/BaseInteraction.js +40 -196
  128. package/src/structures/BaseSelectMenuComponent.js +6 -29
  129. package/src/structures/ButtonBuilder.js +4 -18
  130. package/src/structures/ButtonComponent.js +7 -34
  131. package/src/structures/ButtonInteraction.js +1 -4
  132. package/src/structures/CategoryChannel.js +5 -30
  133. package/src/structures/ChannelSelectMenuBuilder.js +3 -13
  134. package/src/structures/ChannelSelectMenuComponent.js +2 -9
  135. package/src/structures/ChannelSelectMenuInteraction.js +3 -12
  136. package/src/structures/ChatInputCommandInteraction.js +3 -13
  137. package/src/structures/ClientApplication.js +20 -83
  138. package/src/structures/ClientPresence.js +5 -20
  139. package/src/structures/ClientUser.js +21 -118
  140. package/src/structures/CommandInteraction.js +21 -96
  141. package/src/structures/CommandInteractionOptionResolver.js +26 -147
  142. package/src/structures/Component.js +5 -21
  143. package/src/structures/ContextMenuCommandInteraction.js +4 -18
  144. package/src/structures/DMChannel.js +17 -52
  145. package/src/structures/DirectoryChannel.js +4 -16
  146. package/src/structures/Embed.js +21 -107
  147. package/src/structures/EmbedBuilder.js +4 -18
  148. package/src/structures/Emoji.js +12 -60
  149. package/src/structures/ForumChannel.js +30 -140
  150. package/src/structures/Guild.js +117 -697
  151. package/src/structures/GuildAuditLogs.js +7 -32
  152. package/src/structures/GuildAuditLogsEntry.js +27 -135
  153. package/src/structures/GuildBan.js +6 -26
  154. package/src/structures/GuildChannel.js +36 -188
  155. package/src/structures/GuildEmoji.js +13 -67
  156. package/src/structures/GuildMember.js +47 -270
  157. package/src/structures/GuildPreview.js +19 -84
  158. package/src/structures/GuildPreviewEmoji.js +3 -13
  159. package/src/structures/GuildScheduledEvent.js +46 -250
  160. package/src/structures/GuildTemplate.js +24 -108
  161. package/src/structures/Integration.js +25 -103
  162. package/src/structures/IntegrationApplication.js +8 -32
  163. package/src/structures/InteractionCollector.js +22 -113
  164. package/src/structures/InteractionResponse.js +11 -46
  165. package/src/structures/InteractionWebhook.js +8 -33
  166. package/src/structures/Invite.js +27 -131
  167. package/src/structures/InviteGuild.js +2 -8
  168. package/src/structures/InviteStageInstance.js +9 -39
  169. package/src/structures/MentionableSelectMenuBuilder.js +3 -14
  170. package/src/structures/MentionableSelectMenuComponent.js +1 -4
  171. package/src/structures/MentionableSelectMenuInteraction.js +5 -20
  172. package/src/structures/Message.js +85 -460
  173. package/src/structures/MessageCollector.js +14 -70
  174. package/src/structures/MessageComponentInteraction.js +14 -57
  175. package/src/structures/MessageContextMenuCommandInteraction.js +2 -9
  176. package/src/structures/MessageMentions.js +25 -136
  177. package/src/structures/MessagePayload.js +24 -94
  178. package/src/structures/MessageReaction.js +13 -51
  179. package/src/structures/ModalBuilder.js +3 -13
  180. package/src/structures/ModalSubmitFields.js +5 -22
  181. package/src/structures/ModalSubmitInteraction.js +17 -61
  182. package/src/structures/NewsChannel.js +2 -16
  183. package/src/structures/OAuth2Guild.js +3 -12
  184. package/src/structures/PartialGroupDMChannel.js +7 -27
  185. package/src/structures/PermissionOverwrites.js +20 -99
  186. package/src/structures/Presence.js +45 -190
  187. package/src/structures/ReactionCollector.js +20 -108
  188. package/src/structures/ReactionEmoji.js +2 -10
  189. package/src/structures/Role.js +39 -261
  190. package/src/structures/RoleSelectMenuBuilder.js +3 -13
  191. package/src/structures/RoleSelectMenuComponent.js +1 -4
  192. package/src/structures/RoleSelectMenuInteraction.js +3 -12
  193. package/src/structures/SelectMenuBuilder.js +1 -4
  194. package/src/structures/SelectMenuComponent.js +1 -4
  195. package/src/structures/SelectMenuInteraction.js +1 -4
  196. package/src/structures/SelectMenuOptionBuilder.js +1 -4
  197. package/src/structures/StageChannel.js +12 -84
  198. package/src/structures/StageInstance.js +16 -87
  199. package/src/structures/Sticker.js +25 -124
  200. package/src/structures/StickerPack.js +12 -52
  201. package/src/structures/StringSelectMenuBuilder.js +6 -29
  202. package/src/structures/StringSelectMenuComponent.js +2 -9
  203. package/src/structures/StringSelectMenuInteraction.js +2 -8
  204. package/src/structures/StringSelectMenuOptionBuilder.js +4 -18
  205. package/src/structures/Team.js +11 -52
  206. package/src/structures/TeamMember.js +7 -33
  207. package/src/structures/TextChannel.js +3 -14
  208. package/src/structures/TextInputBuilder.js +3 -13
  209. package/src/structures/TextInputComponent.js +3 -14
  210. package/src/structures/ThreadChannel.js +59 -305
  211. package/src/structures/ThreadMember.js +12 -55
  212. package/src/structures/Typing.js +8 -35
  213. package/src/structures/User.js +29 -151
  214. package/src/structures/UserContextMenuCommandInteraction.js +3 -14
  215. package/src/structures/UserSelectMenuBuilder.js +3 -13
  216. package/src/structures/UserSelectMenuComponent.js +1 -4
  217. package/src/structures/UserSelectMenuInteraction.js +4 -16
  218. package/src/structures/VoiceChannel.js +8 -67
  219. package/src/structures/VoiceRegion.js +6 -23
  220. package/src/structures/VoiceState.js +28 -140
  221. package/src/structures/Webhook.js +37 -227
  222. package/src/structures/WelcomeChannel.js +7 -29
  223. package/src/structures/WelcomeScreen.js +5 -20
  224. package/src/structures/Widget.js +9 -40
  225. package/src/structures/WidgetMember.js +15 -61
  226. package/src/structures/interfaces/Application.js +10 -49
  227. package/src/structures/interfaces/Collector.js +34 -155
  228. package/src/structures/interfaces/InteractionResponses.js +25 -164
  229. package/src/structures/interfaces/TextBasedChannel.js +37 -232
  230. package/src/util/APITypes.js +183 -456
  231. package/src/util/ActivityFlagsBitField.js +3 -15
  232. package/src/util/ApplicationFlagsBitField.js +3 -15
  233. package/src/util/BitField.js +17 -82
  234. package/src/util/ChannelFlagsBitField.js +7 -30
  235. package/src/util/Channels.js +5 -35
  236. package/src/util/Colors.js +3 -38
  237. package/src/util/Components.js +21 -75
  238. package/src/util/Constants.js +17 -144
  239. package/src/util/DataResolver.js +20 -77
  240. package/src/util/Events.js +3 -81
  241. package/src/util/Formatters.js +58 -305
  242. package/src/util/GuildMemberFlagsBitField.js +7 -30
  243. package/src/util/IntentsBitField.js +4 -23
  244. package/src/util/LimitedCollection.js +4 -21
  245. package/src/util/MessageFlagsBitField.js +5 -21
  246. package/src/util/Options.js +24 -137
  247. package/src/util/Partials.js +3 -30
  248. package/src/util/PermissionsBitField.js +12 -67
  249. package/src/util/ShardEvents.js +3 -15
  250. package/src/util/Status.js +3 -17
  251. package/src/util/Sweepers.js +35 -184
  252. package/src/util/SystemChannelFlagsBitField.js +7 -32
  253. package/src/util/ThreadMemberFlagsBitField.js +5 -21
  254. package/src/util/Transformers.js +2 -11
  255. package/src/util/UserFlagsBitField.js +5 -21
  256. package/src/util/Util.js +30 -169
  257. package/src/util/WebSocketShardEvents.js +3 -14
@@ -29,106 +29,58 @@ const Status = require('../util/Status');
29
29
  const SystemChannelFlagsBitField = require('../util/SystemChannelFlagsBitField');
30
30
  const { discordSort } = require('../util/Util');
31
31
 
32
- /**
33
- * Represents a guild (or a server) on Discord.
34
- * <info>It's recommended to see if a guild is available before performing operations or reading data from it. You can
35
- * check this with {@link Guild#available}.</info>
36
- * @extends {AnonymousGuild}
37
- */
32
+
38
33
  class Guild extends AnonymousGuild {
39
34
  constructor(client, data) {
40
35
  super(client, data, false);
41
36
 
42
- /**
43
- * A manager of the application commands belonging to this guild
44
- * @type {GuildApplicationCommandManager}
45
- */
37
+
46
38
  this.commands = new GuildApplicationCommandManager(this);
47
39
 
48
- /**
49
- * A manager of the members belonging to this guild
50
- * @type {GuildMemberManager}
51
- */
40
+
52
41
  this.members = new GuildMemberManager(this);
53
42
 
54
- /**
55
- * A manager of the channels belonging to this guild
56
- * @type {GuildChannelManager}
57
- */
43
+
58
44
  this.channels = new GuildChannelManager(this);
59
45
 
60
- /**
61
- * A manager of the bans belonging to this guild
62
- * @type {GuildBanManager}
63
- */
46
+
64
47
  this.bans = new GuildBanManager(this);
65
48
 
66
- /**
67
- * A manager of the roles belonging to this guild
68
- * @type {RoleManager}
69
- */
49
+
70
50
  this.roles = new RoleManager(this);
71
51
 
72
- /**
73
- * A manager of the presences belonging to this guild
74
- * @type {PresenceManager}
75
- */
52
+
76
53
  this.presences = new PresenceManager(this.client);
77
54
 
78
- /**
79
- * A manager of the voice states of this guild
80
- * @type {VoiceStateManager}
81
- */
55
+
82
56
  this.voiceStates = new VoiceStateManager(this);
83
57
 
84
- /**
85
- * A manager of the stage instances of this guild
86
- * @type {StageInstanceManager}
87
- */
58
+
88
59
  this.stageInstances = new StageInstanceManager(this);
89
60
 
90
- /**
91
- * A manager of the invites of this guild
92
- * @type {GuildInviteManager}
93
- */
61
+
94
62
  this.invites = new GuildInviteManager(this);
95
63
 
96
- /**
97
- * A manager of the scheduled events of this guild
98
- * @type {GuildScheduledEventManager}
99
- */
64
+
100
65
  this.scheduledEvents = new GuildScheduledEventManager(this);
101
66
 
102
- /**
103
- * A manager of the auto moderation rules of this guild.
104
- * @type {AutoModerationRuleManager}
105
- */
67
+
106
68
  this.autoModerationRules = new AutoModerationRuleManager(this);
107
69
 
108
70
  if (!data) return;
109
71
  if (data.unavailable) {
110
- /**
111
- * Whether the guild is available to access. If it is not available, it indicates a server outage
112
- * @type {boolean}
113
- */
72
+
114
73
  this.available = false;
115
74
  } else {
116
75
  this._patch(data);
117
76
  if (!data.channels) this.available = false;
118
77
  }
119
78
 
120
- /**
121
- * The id of the shard this Guild belongs to.
122
- * @type {number}
123
- */
79
+
124
80
  this.shardId = data.shardId;
125
81
  }
126
82
 
127
- /**
128
- * The Shard this Guild belongs to.
129
- * @type {WebSocketShard}
130
- * @readonly
131
- */
83
+
132
84
  get shard() {
133
85
  return this.client.ws.shards.get(this.shardId);
134
86
  }
@@ -145,236 +97,151 @@ class Guild extends AnonymousGuild {
145
97
  }
146
98
 
147
99
  if ('discovery_splash' in data) {
148
- /**
149
- * The hash of the guild discovery splash image
150
- * @type {?string}
151
- */
100
+
152
101
  this.discoverySplash = data.discovery_splash;
153
102
  }
154
103
 
155
104
  if ('member_count' in data) {
156
- /**
157
- * The full amount of members in this guild
158
- * @type {number}
159
- */
105
+
160
106
  this.memberCount = data.member_count;
161
107
  }
162
108
 
163
109
  if ('large' in data) {
164
- /**
165
- * Whether the guild is "large" (has more than {@link WebsocketOptions large_threshold} members, 50 by default)
166
- * @type {boolean}
167
- */
110
+
168
111
  this.large = Boolean(data.large);
169
112
  }
170
113
 
171
114
  if ('premium_progress_bar_enabled' in data) {
172
- /**
173
- * Whether this guild has its premium (boost) progress bar enabled
174
- * @type {boolean}
175
- */
115
+
176
116
  this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
177
117
  }
178
118
 
179
119
  if ('application_id' in data) {
180
- /**
181
- * The id of the application that created this guild (if applicable)
182
- * @type {?Snowflake}
183
- */
120
+
184
121
  this.applicationId = data.application_id;
185
122
  }
186
123
 
187
124
  if ('afk_timeout' in data) {
188
- /**
189
- * The time in seconds before a user is counted as "away from keyboard"
190
- * @type {?number}
191
- */
125
+
192
126
  this.afkTimeout = data.afk_timeout;
193
127
  }
194
128
 
195
129
  if ('afk_channel_id' in data) {
196
- /**
197
- * The id of the voice channel where AFK members are moved
198
- * @type {?Snowflake}
199
- */
130
+
200
131
  this.afkChannelId = data.afk_channel_id;
201
132
  }
202
133
 
203
134
  if ('system_channel_id' in data) {
204
- /**
205
- * The system channel's id
206
- * @type {?Snowflake}
207
- */
135
+
208
136
  this.systemChannelId = data.system_channel_id;
209
137
  }
210
138
 
211
139
  if ('premium_tier' in data) {
212
- /**
213
- * The premium tier of this guild
214
- * @type {GuildPremiumTier}
215
- */
140
+
216
141
  this.premiumTier = data.premium_tier;
217
142
  }
218
143
 
219
144
  if ('widget_enabled' in data) {
220
- /**
221
- * Whether widget images are enabled on this guild
222
- * @type {?boolean}
223
- */
145
+
224
146
  this.widgetEnabled = data.widget_enabled;
225
147
  } else {
226
148
  this.widgetEnabled ??= null;
227
149
  }
228
150
 
229
151
  if ('widget_channel_id' in data) {
230
- /**
231
- * The widget channel's id, if enabled
232
- * @type {?string}
233
- */
152
+
234
153
  this.widgetChannelId = data.widget_channel_id;
235
154
  } else {
236
155
  this.widgetChannelId ??= null;
237
156
  }
238
157
 
239
158
  if ('explicit_content_filter' in data) {
240
- /**
241
- * The explicit content filter level of the guild
242
- * @type {GuildExplicitContentFilter}
243
- */
159
+
244
160
  this.explicitContentFilter = data.explicit_content_filter;
245
161
  }
246
162
 
247
163
  if ('mfa_level' in data) {
248
- /**
249
- * The required MFA level for this guild
250
- * @type {GuildMFALevel}
251
- */
164
+
252
165
  this.mfaLevel = data.mfa_level;
253
166
  }
254
167
 
255
168
  if ('joined_at' in data) {
256
- /**
257
- * The timestamp the client user joined the guild at
258
- * @type {number}
259
- */
169
+
260
170
  this.joinedTimestamp = Date.parse(data.joined_at);
261
171
  }
262
172
 
263
173
  if ('default_message_notifications' in data) {
264
- /**
265
- * The default message notification level of the guild
266
- * @type {GuildDefaultMessageNotifications}
267
- */
174
+
268
175
  this.defaultMessageNotifications = data.default_message_notifications;
269
176
  }
270
177
 
271
178
  if ('system_channel_flags' in data) {
272
- /**
273
- * The value set for the guild's system channel flags
274
- * @type {Readonly<SystemChannelFlagsBitField>}
275
- */
179
+
276
180
  this.systemChannelFlags = new SystemChannelFlagsBitField(data.system_channel_flags).freeze();
277
181
  }
278
182
 
279
183
  if ('max_members' in data) {
280
- /**
281
- * The maximum amount of members the guild can have
282
- * @type {?number}
283
- */
184
+
284
185
  this.maximumMembers = data.max_members;
285
186
  } else {
286
187
  this.maximumMembers ??= null;
287
188
  }
288
189
 
289
190
  if ('max_presences' in data) {
290
- /**
291
- * The maximum amount of presences the guild can have (this is `null` for all but the largest of guilds)
292
- * <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
293
- * @type {?number}
294
- */
191
+
295
192
  this.maximumPresences = data.max_presences;
296
193
  } else {
297
194
  this.maximumPresences ??= null;
298
195
  }
299
196
 
300
197
  if ('max_video_channel_users' in data) {
301
- /**
302
- * The maximum amount of users allowed in a video channel.
303
- * @type {?number}
304
- */
198
+
305
199
  this.maxVideoChannelUsers = data.max_video_channel_users;
306
200
  } else {
307
201
  this.maxVideoChannelUsers ??= null;
308
202
  }
309
203
 
310
204
  if ('max_stage_video_channel_users' in data) {
311
- /**
312
- * The maximum amount of users allowed in a stage video channel.
313
- * @type {?number}
314
- */
205
+
315
206
  this.maxStageVideoChannelUsers = data.max_stage_video_channel_users;
316
207
  } else {
317
208
  this.maxStageVideoChannelUsers ??= null;
318
209
  }
319
210
 
320
211
  if ('approximate_member_count' in data) {
321
- /**
322
- * The approximate amount of members the guild has
323
- * <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
324
- * @type {?number}
325
- */
212
+
326
213
  this.approximateMemberCount = data.approximate_member_count;
327
214
  } else {
328
215
  this.approximateMemberCount ??= null;
329
216
  }
330
217
 
331
218
  if ('approximate_presence_count' in data) {
332
- /**
333
- * The approximate amount of presences the guild has
334
- * <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
335
- * @type {?number}
336
- */
219
+
337
220
  this.approximatePresenceCount = data.approximate_presence_count;
338
221
  } else {
339
222
  this.approximatePresenceCount ??= null;
340
223
  }
341
224
 
342
- /**
343
- * The use count of the vanity URL code of the guild, if any
344
- * <info>You will need to fetch this parameter using {@link Guild#fetchVanityData} if you want to receive it</info>
345
- * @type {?number}
346
- */
225
+
347
226
  this.vanityURLUses ??= null;
348
227
 
349
228
  if ('rules_channel_id' in data) {
350
- /**
351
- * The rules channel's id for the guild
352
- * @type {?Snowflake}
353
- */
229
+
354
230
  this.rulesChannelId = data.rules_channel_id;
355
231
  }
356
232
 
357
233
  if ('public_updates_channel_id' in data) {
358
- /**
359
- * The community updates channel's id for the guild
360
- * @type {?Snowflake}
361
- */
234
+
362
235
  this.publicUpdatesChannelId = data.public_updates_channel_id;
363
236
  }
364
237
 
365
238
  if ('preferred_locale' in data) {
366
- /**
367
- * The preferred locale of the guild, defaults to `en-US`
368
- * @type {Locale}
369
- */
239
+
370
240
  this.preferredLocale = data.preferred_locale;
371
241
  }
372
242
 
373
243
  if ('safety_alerts_channel_id' in data) {
374
- /**
375
- * The safety alerts channel's id for the guild
376
- * @type {?Snowflake}
377
- */
244
+
378
245
  this.safetyAlertsChannelId = data.safety_alerts_channel_id;
379
246
  } else {
380
247
  this.safetyAlertsChannelId ??= null;
@@ -404,10 +271,7 @@ class Guild extends AnonymousGuild {
404
271
  }
405
272
 
406
273
  if ('owner_id' in data) {
407
- /**
408
- * The user id of this guild's owner
409
- * @type {Snowflake}
410
- */
274
+
411
275
  this.ownerId = data.owner_id;
412
276
  }
413
277
 
@@ -439,10 +303,7 @@ class Guild extends AnonymousGuild {
439
303
  }
440
304
 
441
305
  if (!this.emojis) {
442
- /**
443
- * A manager of the emojis belonging to this guild
444
- * @type {GuildEmojiManager}
445
- */
306
+
446
307
  this.emojis = new GuildEmojiManager(this);
447
308
  if (data.emojis) for (const emoji of data.emojis) this.emojis._add(emoji);
448
309
  } else if (data.emojis) {
@@ -453,10 +314,7 @@ class Guild extends AnonymousGuild {
453
314
  }
454
315
 
455
316
  if (!this.stickers) {
456
- /**
457
- * A manager of the stickers belonging to this guild
458
- * @type {GuildStickerManager}
459
- */
317
+
460
318
  this.stickers = new GuildStickerManager(this);
461
319
  if (data.stickers) for (const sticker of data.stickers) this.stickers._add(sticker);
462
320
  } else if (data.stickers) {
@@ -467,30 +325,17 @@ class Guild extends AnonymousGuild {
467
325
  }
468
326
  }
469
327
 
470
- /**
471
- * The time the client user joined the guild
472
- * @type {Date}
473
- * @readonly
474
- */
328
+
475
329
  get joinedAt() {
476
330
  return new Date(this.joinedTimestamp);
477
331
  }
478
332
 
479
- /**
480
- * The URL to this guild's discovery splash image.
481
- * @param {ImageURLOptions} [options={}] Options for the image URL
482
- * @returns {?string}
483
- */
333
+
484
334
  discoverySplashURL(options = {}) {
485
335
  return this.discoverySplash && this.client.rest.cdn.discoverySplash(this.id, this.discoverySplash, options);
486
336
  }
487
337
 
488
- /**
489
- * Fetches the owner of the guild.
490
- * If the member object isn't needed, use {@link Guild#ownerId} instead.
491
- * @param {BaseFetchOptions} [options] The options for fetching the member
492
- * @returns {Promise<GuildMember>}
493
- */
338
+
494
339
  async fetchOwner(options) {
495
340
  if (!this.ownerId) {
496
341
  throw new DiscordjsError(ErrorCodes.FetchOwnerId);
@@ -499,65 +344,37 @@ class Guild extends AnonymousGuild {
499
344
  return member;
500
345
  }
501
346
 
502
- /**
503
- * AFK voice channel for this guild
504
- * @type {?VoiceChannel}
505
- * @readonly
506
- */
347
+
507
348
  get afkChannel() {
508
349
  return this.client.channels.resolve(this.afkChannelId);
509
350
  }
510
351
 
511
- /**
512
- * System channel for this guild
513
- * @type {?TextChannel}
514
- * @readonly
515
- */
352
+
516
353
  get systemChannel() {
517
354
  return this.client.channels.resolve(this.systemChannelId);
518
355
  }
519
356
 
520
- /**
521
- * Widget channel for this guild
522
- * @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel)}
523
- * @readonly
524
- */
357
+
525
358
  get widgetChannel() {
526
359
  return this.client.channels.resolve(this.widgetChannelId);
527
360
  }
528
361
 
529
- /**
530
- * Rules channel for this guild
531
- * @type {?TextChannel}
532
- * @readonly
533
- */
362
+
534
363
  get rulesChannel() {
535
364
  return this.client.channels.resolve(this.rulesChannelId);
536
365
  }
537
366
 
538
- /**
539
- * Public updates channel for this guild
540
- * @type {?TextChannel}
541
- * @readonly
542
- */
367
+
543
368
  get publicUpdatesChannel() {
544
369
  return this.client.channels.resolve(this.publicUpdatesChannelId);
545
370
  }
546
371
 
547
- /**
548
- * Safety alerts channel for this guild
549
- * @type {?TextChannel}
550
- * @readonly
551
- */
372
+
552
373
  get safetyAlertsChannel() {
553
374
  return this.client.channels.resolve(this.safetyAlertsChannelId);
554
375
  }
555
376
 
556
- /**
557
- * The maximum bitrate available for this guild
558
- * @type {number}
559
- * @readonly
560
- */
377
+
561
378
  get maximumBitrate() {
562
379
  if (this.features.includes(GuildFeature.VIPRegions)) {
563
380
  return 384_000;
@@ -575,16 +392,7 @@ class Guild extends AnonymousGuild {
575
392
  }
576
393
  }
577
394
 
578
- /**
579
- * Fetches a collection of integrations to this guild.
580
- * Resolves with a collection mapping integrations by their ids.
581
- * @returns {Promise<Collection<Snowflake|string, Integration>>}
582
- * @example
583
- * // Fetch integrations
584
- * guild.fetchIntegrations()
585
- * .then(integrations => console.log(`Fetched ${integrations.size} integrations`))
586
- * .catch(console.error);
587
- */
395
+
588
396
  async fetchIntegrations() {
589
397
  const data = await this.client.rest.get(Routes.guildIntegrations(this.id));
590
398
  return data.reduce(
@@ -593,64 +401,33 @@ class Guild extends AnonymousGuild {
593
401
  );
594
402
  }
595
403
 
596
- /**
597
- * Fetches a collection of templates from this guild.
598
- * Resolves with a collection mapping templates by their codes.
599
- * @returns {Promise<Collection<string, GuildTemplate>>}
600
- */
404
+
601
405
  async fetchTemplates() {
602
406
  const templates = await this.client.rest.get(Routes.guildTemplates(this.id));
603
407
  return templates.reduce((col, data) => col.set(data.code, new GuildTemplate(this.client, data)), new Collection());
604
408
  }
605
409
 
606
- /**
607
- * Fetches the welcome screen for this guild.
608
- * @returns {Promise<WelcomeScreen>}
609
- */
410
+
610
411
  async fetchWelcomeScreen() {
611
412
  const data = await this.client.rest.get(Routes.guildWelcomeScreen(this.id));
612
413
  return new WelcomeScreen(this, data);
613
414
  }
614
415
 
615
- /**
616
- * Creates a template for the guild.
617
- * @param {string} name The name for the template
618
- * @param {string} [description] The description for the template
619
- * @returns {Promise<GuildTemplate>}
620
- */
416
+
621
417
  async createTemplate(name, description) {
622
418
  const data = await this.client.rest.post(Routes.guildTemplates(this.id), { body: { name, description } });
623
419
  return new GuildTemplate(this.client, data);
624
420
  }
625
421
 
626
- /**
627
- * Obtains a guild preview for this guild from Discord.
628
- * @returns {Promise<GuildPreview>}
629
- */
422
+
630
423
  async fetchPreview() {
631
424
  const data = await this.client.rest.get(Routes.guildPreview(this.id));
632
425
  return new GuildPreview(this.client, data);
633
426
  }
634
427
 
635
- /**
636
- * An object containing information about a guild's vanity invite.
637
- * @typedef {Object} Vanity
638
- * @property {?string} code Vanity invite code
639
- * @property {number} uses How many times this invite has been used
640
- */
641
-
642
- /**
643
- * Fetches the vanity URL invite object to this guild.
644
- * Resolves with an object containing the vanity URL invite code and the use count
645
- * @returns {Promise<Vanity>}
646
- * @example
647
- * // Fetch invite data
648
- * guild.fetchVanityData()
649
- * .then(res => {
650
- * console.log(`Vanity URL: https://discord.gg/${res.code} with ${res.uses} uses`);
651
- * })
652
- * .catch(console.error);
653
- */
428
+
429
+
430
+
654
431
  async fetchVanityData() {
655
432
  const data = await this.client.rest.get(Routes.guildVanityUrl(this.id));
656
433
  this.vanityURLCode = data.code;
@@ -659,15 +436,7 @@ class Guild extends AnonymousGuild {
659
436
  return data;
660
437
  }
661
438
 
662
- /**
663
- * Fetches all webhooks for the guild.
664
- * @returns {Promise<Collection<Snowflake, Webhook>>}
665
- * @example
666
- * // Fetch webhooks
667
- * guild.fetchWebhooks()
668
- * .then(webhooks => console.log(`Fetched ${webhooks.size} webhooks`))
669
- * .catch(console.error);
670
- */
439
+
671
440
  async fetchWebhooks() {
672
441
  const apiHooks = await this.client.rest.get(Routes.guildWebhooks(this.id));
673
442
  const hooks = new Collection();
@@ -675,43 +444,16 @@ class Guild extends AnonymousGuild {
675
444
  return hooks;
676
445
  }
677
446
 
678
- /**
679
- * Fetches the guild widget data, requires the widget to be enabled.
680
- * @returns {Promise<Widget>}
681
- * @example
682
- * // Fetches the guild widget data
683
- * guild.fetchWidget()
684
- * .then(widget => console.log(`The widget shows ${widget.channels.size} channels`))
685
- * .catch(console.error);
686
- */
447
+
687
448
  fetchWidget() {
688
449
  return this.client.fetchGuildWidget(this.id);
689
450
  }
690
451
 
691
- /**
692
- * Data for the Guild Widget Settings object
693
- * @typedef {Object} GuildWidgetSettings
694
- * @property {boolean} enabled Whether the widget is enabled
695
- * @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel)} channel The widget invite channel
696
- */
697
-
698
- /**
699
- * The Guild Widget Settings object
700
- * @typedef {Object} GuildWidgetSettingsData
701
- * @property {boolean} enabled Whether the widget is enabled
702
- * @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|Snowflake)} channel
703
- * The widget invite channel
704
- */
705
-
706
- /**
707
- * Fetches the guild widget settings.
708
- * @returns {Promise<GuildWidgetSettings>}
709
- * @example
710
- * // Fetches the guild widget settings
711
- * guild.fetchWidgetSettings()
712
- * .then(widget => console.log(`The widget is ${widget.enabled ? 'enabled' : 'disabled'}`))
713
- * .catch(console.error);
714
- */
452
+
453
+
454
+
455
+
456
+
715
457
  async fetchWidgetSettings() {
716
458
  const data = await this.client.rest.get(Routes.guildWidgetSettings(this.id));
717
459
  this.widgetEnabled = data.enabled;
@@ -722,26 +464,9 @@ class Guild extends AnonymousGuild {
722
464
  };
723
465
  }
724
466
 
725
- /**
726
- * Options used to fetch audit logs.
727
- * @typedef {Object} GuildAuditLogsFetchOptions
728
- * @property {Snowflake|GuildAuditLogsEntry} [before] Consider only entries before this entry
729
- * @property {Snowflake|GuildAuditLogsEntry} [after] Consider only entries after this entry
730
- * @property {number} [limit] The number of entries to return
731
- * @property {UserResolvable} [user] Only return entries for actions made by this user
732
- * @property {?AuditLogEvent} [type] Only return entries for this action type
733
- */
734
-
735
- /**
736
- * Fetches audit logs for this guild.
737
- * @param {GuildAuditLogsFetchOptions} [options={}] Options for fetching audit logs
738
- * @returns {Promise<GuildAuditLogs>}
739
- * @example
740
- * // Output audit log entries
741
- * guild.fetchAuditLogs()
742
- * .then(audit => console.log(audit.entries.first()))
743
- * .catch(console.error);
744
- */
467
+
468
+
469
+
745
470
  async fetchAuditLogs({ before, after, limit, user, type } = {}) {
746
471
  const query = makeURLSearchParams({
747
472
  before: before?.id ?? before,
@@ -760,59 +485,13 @@ class Guild extends AnonymousGuild {
760
485
  return new GuildAuditLogs(this, data);
761
486
  }
762
487
 
763
- /**
764
- * The data for editing a guild.
765
- * @typedef {Object} GuildEditOptions
766
- * @property {string} [name] The name of the guild
767
- * @property {?GuildVerificationLevel} [verificationLevel] The verification level of the guild
768
- * @property {?GuildDefaultMessageNotifications} [defaultMessageNotifications] The default message
769
- * notification level of the guild
770
- * @property {?GuildExplicitContentFilter} [explicitContentFilter] The level of the explicit content filter
771
- * @property {?VoiceChannelResolvable} [afkChannel] The AFK channel of the guild
772
- * @property {number} [afkTimeout] The AFK timeout of the guild
773
- * @property {?(BufferResolvable|Base64Resolvable)} [icon] The icon of the guild
774
- * @property {GuildMemberResolvable} [owner] The owner of the guild
775
- * @property {?(BufferResolvable|Base64Resolvable)} [splash] The invite splash image of the guild
776
- * @property {?(BufferResolvable|Base64Resolvable)} [discoverySplash] The discovery splash image of the guild
777
- * @property {?(BufferResolvable|Base64Resolvable)} [banner] The banner of the guild
778
- * @property {?TextChannelResolvable} [systemChannel] The system channel of the guild
779
- * @property {SystemChannelFlagsResolvable} [systemChannelFlags] The system channel flags of the guild
780
- * @property {?TextChannelResolvable} [rulesChannel] The rules channel of the guild
781
- * @property {?TextChannelResolvable} [publicUpdatesChannel] The community updates channel of the guild
782
- * @property {?TextChannelResolvable} [safetyAlertsChannel] The safety alerts channel of the guild
783
- * @property {?string} [preferredLocale] The preferred locale of the guild
784
- * @property {GuildFeature[]} [features] The features of the guild
785
- * @property {?string} [description] The discovery description of the guild
786
- * @property {boolean} [premiumProgressBarEnabled] Whether the guild's premium progress bar is enabled
787
- * @property {string} [reason] Reason for editing this guild
788
- */
789
-
790
- /**
791
- * Data that can be resolved to a Text Channel object. This can be:
792
- * * A TextChannel
793
- * * A Snowflake
794
- * @typedef {TextChannel|Snowflake} TextChannelResolvable
795
- */
796
-
797
- /**
798
- * Data that can be resolved to a Voice Channel object. This can be:
799
- * * A VoiceChannel
800
- * * A Snowflake
801
- * @typedef {VoiceChannel|Snowflake} VoiceChannelResolvable
802
- */
803
-
804
- /**
805
- * Updates the guild with new information - e.g. a new name.
806
- * @param {GuildEditOptions} options The options to provide
807
- * @returns {Promise<Guild>}
808
- * @example
809
- * // Set the guild name
810
- * guild.edit({
811
- * name: 'Discord Guild',
812
- * })
813
- * .then(updated => console.log(`New guild name ${updated}`))
814
- * .catch(console.error);
815
- */
488
+
489
+
490
+
491
+
492
+
493
+
494
+
816
495
  async edit({
817
496
  verificationLevel,
818
497
  defaultMessageNotifications,
@@ -861,54 +540,15 @@ class Guild extends AnonymousGuild {
861
540
  return this.client.actions.GuildUpdate.handle(data).updated;
862
541
  }
863
542
 
864
- /**
865
- * Welcome channel data
866
- * @typedef {Object} WelcomeChannelData
867
- * @property {string} description The description to show for this welcome channel
868
- * @property {TextChannel|NewsChannel|ForumChannel|Snowflake} channel The channel to link for this welcome channel
869
- * @property {EmojiIdentifierResolvable} [emoji] The emoji to display for this welcome channel
870
- */
871
-
872
- /**
873
- * Welcome screen edit data
874
- * @typedef {Object} WelcomeScreenEditOptions
875
- * @property {boolean} [enabled] Whether the welcome screen is enabled
876
- * @property {string} [description] The description for the welcome screen
877
- * @property {WelcomeChannelData[]} [welcomeChannels] The welcome channel data for the welcome screen
878
- */
879
-
880
- /**
881
- * Data that can be resolved to a GuildTextChannel object. This can be:
882
- * * A TextChannel
883
- * * A NewsChannel
884
- * * A Snowflake
885
- * @typedef {TextChannel|NewsChannel|Snowflake} GuildTextChannelResolvable
886
- */
887
-
888
- /**
889
- * Data that can be resolved to a GuildVoiceChannel object. This can be:
890
- * * A VoiceChannel
891
- * * A StageChannel
892
- * * A Snowflake
893
- * @typedef {VoiceChannel|StageChannel|Snowflake} GuildVoiceChannelResolvable
894
- */
895
-
896
- /**
897
- * Updates the guild's welcome screen
898
- * @param {WelcomeScreenEditOptions} options The options to provide
899
- * @returns {Promise<WelcomeScreen>}
900
- * @example
901
- * guild.editWelcomeScreen({
902
- * description: 'Hello World',
903
- * enabled: true,
904
- * welcomeChannels: [
905
- * {
906
- * description: 'foobar',
907
- * channel: '222197033908436994',
908
- * }
909
- * ],
910
- * })
911
- */
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
912
552
  async editWelcomeScreen(options) {
913
553
  const { enabled, description, welcomeChannels } = options;
914
554
  const welcome_channels = welcomeChannels?.map(welcomeChannelData => {
@@ -931,263 +571,97 @@ class Guild extends AnonymousGuild {
931
571
  return new WelcomeScreen(this, patchData);
932
572
  }
933
573
 
934
- /**
935
- * Edits the level of the explicit content filter.
936
- * @param {?GuildExplicitContentFilter} explicitContentFilter The new level of the explicit content filter
937
- * @param {string} [reason] Reason for changing the level of the guild's explicit content filter
938
- * @returns {Promise<Guild>}
939
- */
574
+
940
575
  setExplicitContentFilter(explicitContentFilter, reason) {
941
576
  return this.edit({ explicitContentFilter, reason });
942
577
  }
943
578
 
944
- /**
945
- * Edits the setting of the default message notifications of the guild.
946
- * @param {?GuildDefaultMessageNotifications} defaultMessageNotifications
947
- * The new default message notification level of the guild
948
- * @param {string} [reason] Reason for changing the setting of the default message notifications
949
- * @returns {Promise<Guild>}
950
- */
579
+
951
580
  setDefaultMessageNotifications(defaultMessageNotifications, reason) {
952
581
  return this.edit({ defaultMessageNotifications, reason });
953
582
  }
954
583
 
955
- /**
956
- * Edits the flags of the default message notifications of the guild.
957
- * @param {SystemChannelFlagsResolvable} systemChannelFlags The new flags for the default message notifications
958
- * @param {string} [reason] Reason for changing the flags of the default message notifications
959
- * @returns {Promise<Guild>}
960
- */
584
+
961
585
  setSystemChannelFlags(systemChannelFlags, reason) {
962
586
  return this.edit({ systemChannelFlags, reason });
963
587
  }
964
588
 
965
- /**
966
- * Edits the name of the guild.
967
- * @param {string} name The new name of the guild
968
- * @param {string} [reason] Reason for changing the guild's name
969
- * @returns {Promise<Guild>}
970
- * @example
971
- * // Edit the guild name
972
- * guild.setName('Discord Guild')
973
- * .then(updated => console.log(`Updated guild name to ${updated.name}`))
974
- * .catch(console.error);
975
- */
589
+
976
590
  setName(name, reason) {
977
591
  return this.edit({ name, reason });
978
592
  }
979
593
 
980
- /**
981
- * Edits the verification level of the guild.
982
- * @param {?GuildVerificationLevel} verificationLevel The new verification level of the guild
983
- * @param {string} [reason] Reason for changing the guild's verification level
984
- * @returns {Promise<Guild>}
985
- * @example
986
- * // Edit the guild verification level
987
- * guild.setVerificationLevel(1)
988
- * .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`))
989
- * .catch(console.error);
990
- */
594
+
991
595
  setVerificationLevel(verificationLevel, reason) {
992
596
  return this.edit({ verificationLevel, reason });
993
597
  }
994
598
 
995
- /**
996
- * Edits the AFK channel of the guild.
997
- * @param {?VoiceChannelResolvable} afkChannel The new AFK channel
998
- * @param {string} [reason] Reason for changing the guild's AFK channel
999
- * @returns {Promise<Guild>}
1000
- * @example
1001
- * // Edit the guild AFK channel
1002
- * guild.setAFKChannel(channel)
1003
- * .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel.name}`))
1004
- * .catch(console.error);
1005
- */
599
+
1006
600
  setAFKChannel(afkChannel, reason) {
1007
601
  return this.edit({ afkChannel, reason });
1008
602
  }
1009
603
 
1010
- /**
1011
- * Edits the system channel of the guild.
1012
- * @param {?TextChannelResolvable} systemChannel The new system channel
1013
- * @param {string} [reason] Reason for changing the guild's system channel
1014
- * @returns {Promise<Guild>}
1015
- * @example
1016
- * // Edit the guild system channel
1017
- * guild.setSystemChannel(channel)
1018
- * .then(updated => console.log(`Updated guild system channel to ${guild.systemChannel.name}`))
1019
- * .catch(console.error);
1020
- */
604
+
1021
605
  setSystemChannel(systemChannel, reason) {
1022
606
  return this.edit({ systemChannel, reason });
1023
607
  }
1024
608
 
1025
- /**
1026
- * Edits the AFK timeout of the guild.
1027
- * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK
1028
- * @param {string} [reason] Reason for changing the guild's AFK timeout
1029
- * @returns {Promise<Guild>}
1030
- * @example
1031
- * // Edit the guild AFK channel
1032
- * guild.setAFKTimeout(60)
1033
- * .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`))
1034
- * .catch(console.error);
1035
- */
609
+
1036
610
  setAFKTimeout(afkTimeout, reason) {
1037
611
  return this.edit({ afkTimeout, reason });
1038
612
  }
1039
613
 
1040
- /**
1041
- * Sets a new guild icon.
1042
- * @param {?(Base64Resolvable|BufferResolvable)} icon The new icon of the guild
1043
- * @param {string} [reason] Reason for changing the guild's icon
1044
- * @returns {Promise<Guild>}
1045
- * @example
1046
- * // Edit the guild icon
1047
- * guild.setIcon('./icon.png')
1048
- * .then(updated => console.log('Updated the guild icon'))
1049
- * .catch(console.error);
1050
- */
614
+
1051
615
  setIcon(icon, reason) {
1052
616
  return this.edit({ icon, reason });
1053
617
  }
1054
618
 
1055
- /**
1056
- * Sets a new owner of the guild.
1057
- * @param {GuildMemberResolvable} owner The new owner of the guild
1058
- * @param {string} [reason] Reason for setting the new owner
1059
- * @returns {Promise<Guild>}
1060
- * @example
1061
- * // Edit the guild owner
1062
- * guild.setOwner(guild.members.cache.first())
1063
- * .then(guild => guild.fetchOwner())
1064
- * .then(owner => console.log(`Updated the guild owner to ${owner.displayName}`))
1065
- * .catch(console.error);
1066
- */
619
+
1067
620
  setOwner(owner, reason) {
1068
621
  return this.edit({ owner, reason });
1069
622
  }
1070
623
 
1071
- /**
1072
- * Sets a new guild invite splash image.
1073
- * @param {?(Base64Resolvable|BufferResolvable)} splash The new invite splash image of the guild
1074
- * @param {string} [reason] Reason for changing the guild's invite splash image
1075
- * @returns {Promise<Guild>}
1076
- * @example
1077
- * // Edit the guild splash
1078
- * guild.setSplash('./splash.png')
1079
- * .then(updated => console.log('Updated the guild splash'))
1080
- * .catch(console.error);
1081
- */
624
+
1082
625
  setSplash(splash, reason) {
1083
626
  return this.edit({ splash, reason });
1084
627
  }
1085
628
 
1086
- /**
1087
- * Sets a new guild discovery splash image.
1088
- * @param {?(Base64Resolvable|BufferResolvable)} discoverySplash The new discovery splash image of the guild
1089
- * @param {string} [reason] Reason for changing the guild's discovery splash image
1090
- * @returns {Promise<Guild>}
1091
- * @example
1092
- * // Edit the guild discovery splash
1093
- * guild.setDiscoverySplash('./discoverysplash.png')
1094
- * .then(updated => console.log('Updated the guild discovery splash'))
1095
- * .catch(console.error);
1096
- */
629
+
1097
630
  setDiscoverySplash(discoverySplash, reason) {
1098
631
  return this.edit({ discoverySplash, reason });
1099
632
  }
1100
633
 
1101
- /**
1102
- * Sets a new guild banner.
1103
- * @param {?(Base64Resolvable|BufferResolvable)} banner The new banner of the guild
1104
- * @param {string} [reason] Reason for changing the guild's banner
1105
- * @returns {Promise<Guild>}
1106
- * @example
1107
- * guild.setBanner('./banner.png')
1108
- * .then(updated => console.log('Updated the guild banner'))
1109
- * .catch(console.error);
1110
- */
634
+
1111
635
  setBanner(banner, reason) {
1112
636
  return this.edit({ banner, reason });
1113
637
  }
1114
638
 
1115
- /**
1116
- * Edits the rules channel of the guild.
1117
- * @param {?TextChannelResolvable} rulesChannel The new rules channel
1118
- * @param {string} [reason] Reason for changing the guild's rules channel
1119
- * @returns {Promise<Guild>}
1120
- * @example
1121
- * // Edit the guild rules channel
1122
- * guild.setRulesChannel(channel)
1123
- * .then(updated => console.log(`Updated guild rules channel to ${guild.rulesChannel.name}`))
1124
- * .catch(console.error);
1125
- */
639
+
1126
640
  setRulesChannel(rulesChannel, reason) {
1127
641
  return this.edit({ rulesChannel, reason });
1128
642
  }
1129
643
 
1130
- /**
1131
- * Edits the community updates channel of the guild.
1132
- * @param {?TextChannelResolvable} publicUpdatesChannel The new community updates channel
1133
- * @param {string} [reason] Reason for changing the guild's community updates channel
1134
- * @returns {Promise<Guild>}
1135
- * @example
1136
- * // Edit the guild community updates channel
1137
- * guild.setPublicUpdatesChannel(channel)
1138
- * .then(updated => console.log(`Updated guild community updates channel to ${guild.publicUpdatesChannel.name}`))
1139
- * .catch(console.error);
1140
- */
644
+
1141
645
  setPublicUpdatesChannel(publicUpdatesChannel, reason) {
1142
646
  return this.edit({ publicUpdatesChannel, reason });
1143
647
  }
1144
648
 
1145
- /**
1146
- * Edits the preferred locale of the guild.
1147
- * @param {?Locale} preferredLocale The new preferred locale of the guild
1148
- * @param {string} [reason] Reason for changing the guild's preferred locale
1149
- * @returns {Promise<Guild>}
1150
- * @example
1151
- * // Edit the guild preferred locale
1152
- * guild.setPreferredLocale('en-US')
1153
- * .then(updated => console.log(`Updated guild preferred locale to ${guild.preferredLocale}`))
1154
- * .catch(console.error);
1155
- */
649
+
1156
650
  setPreferredLocale(preferredLocale, reason) {
1157
651
  return this.edit({ preferredLocale, reason });
1158
652
  }
1159
653
 
1160
- /**
1161
- * Edits the enabled state of the guild's premium progress bar
1162
- * @param {boolean} [enabled=true] The new enabled state of the guild's premium progress bar
1163
- * @param {string} [reason] Reason for changing the state of the guild's premium progress bar
1164
- * @returns {Promise<Guild>}
1165
- */
654
+
1166
655
  setPremiumProgressBarEnabled(enabled = true, reason) {
1167
656
  return this.edit({ premiumProgressBarEnabled: enabled, reason });
1168
657
  }
1169
658
 
1170
- /**
1171
- * Edits the safety alerts channel of the guild.
1172
- * @param {?TextChannelResolvable} safetyAlertsChannel The new safety alerts channel
1173
- * @param {string} [reason] Reason for changing the guild's safety alerts channel
1174
- * @returns {Promise<Guild>}
1175
- * @example
1176
- * // Edit the guild safety alerts channel
1177
- * guild.setSafetyAlertsChannel(channel)
1178
- * .then(updated => console.log(`Updated guild safety alerts channel to ${updated.safetyAlertsChannel.name}`))
1179
- * .catch(console.error);
1180
- */
659
+
1181
660
  setSafetyAlertsChannel(safetyAlertsChannel, reason) {
1182
661
  return this.edit({ safetyAlertsChannel, reason });
1183
662
  }
1184
663
 
1185
- /**
1186
- * Edits the guild's widget settings.
1187
- * @param {GuildWidgetSettingsData} settings The widget settings for the guild
1188
- * @param {string} [reason] Reason for changing the guild's widget settings
1189
- * @returns {Promise<Guild>}
1190
- */
664
+
1191
665
  async setWidgetSettings(settings, reason) {
1192
666
  await this.client.rest.patch(Routes.guildWidgetSettings(this.id), {
1193
667
  body: {
@@ -1199,18 +673,7 @@ class Guild extends AnonymousGuild {
1199
673
  return this;
1200
674
  }
1201
675
 
1202
- /**
1203
- * Sets the guild's MFA level
1204
- * <info>An elevated MFA level requires guild moderators to have 2FA enabled.</info>
1205
- * @param {GuildMFALevel} level The MFA level
1206
- * @param {string} [reason] Reason for changing the guild's MFA level
1207
- * @returns {Promise<Guild>}
1208
- * @example
1209
- * // Set the MFA level of the guild to Elevated
1210
- * guild.setMFALevel(GuildMFALevel.Elevated)
1211
- * .then(guild => console.log("Set guild's MFA level to Elevated"))
1212
- * .catch(console.error);
1213
- */
676
+
1214
677
  async setMFALevel(level, reason) {
1215
678
  await this.client.rest.post(Routes.guildMFA(this.id), {
1216
679
  body: {
@@ -1221,53 +684,27 @@ class Guild extends AnonymousGuild {
1221
684
  return this;
1222
685
  }
1223
686
 
1224
- /**
1225
- * Leaves the guild.
1226
- * @returns {Promise<Guild>}
1227
- * @example
1228
- * // Leave a guild
1229
- * guild.leave()
1230
- * .then(guild => console.log(`Left the guild: ${guild.name}`))
1231
- * .catch(console.error);
1232
- */
687
+
1233
688
  async leave() {
1234
689
  if (this.ownerId === this.client.user.id) throw new DiscordjsError(ErrorCodes.GuildOwned);
1235
690
  await this.client.rest.delete(Routes.userGuild(this.id));
1236
691
  return this;
1237
692
  }
1238
693
 
1239
- /**
1240
- * Deletes the guild.
1241
- * @returns {Promise<Guild>}
1242
- * @example
1243
- * // Delete a guild
1244
- * guild.delete()
1245
- * .then(g => console.log(`Deleted the guild ${g}`))
1246
- * .catch(console.error);
1247
- */
694
+
1248
695
  async delete() {
1249
696
  await this.client.rest.delete(Routes.guild(this.id));
1250
697
  return this;
1251
698
  }
1252
699
 
1253
- /**
1254
- * Sets whether this guild's invites are disabled.
1255
- * @param {boolean} [disabled=true] Whether the invites are disabled
1256
- * @returns {Promise<Guild>}
1257
- */
700
+
1258
701
  async disableInvites(disabled = true) {
1259
702
  const features = this.features.filter(feature => feature !== GuildFeature.InvitesDisabled);
1260
703
  if (disabled) features.push(GuildFeature.InvitesDisabled);
1261
704
  return this.edit({ features });
1262
705
  }
1263
706
 
1264
- /**
1265
- * Whether this guild equals another guild. It compares all properties, so for most operations
1266
- * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often
1267
- * what most users need.
1268
- * @param {Guild} guild The guild to compare with
1269
- * @returns {boolean}
1270
- */
707
+
1271
708
  equals(guild) {
1272
709
  return (
1273
710
  guild &&
@@ -1303,12 +740,7 @@ class Guild extends AnonymousGuild {
1303
740
  return json;
1304
741
  }
1305
742
 
1306
- /**
1307
- * The voice state adapter for this guild that can be used with @discordjs/voice to play audio in voice
1308
- * and stage channels.
1309
- * @type {Function}
1310
- * @readonly
1311
- */
743
+
1312
744
  get voiceAdapterCreator() {
1313
745
  return methods => {
1314
746
  this.client.voice.adapters.set(this.id, methods);
@@ -1325,21 +757,12 @@ class Guild extends AnonymousGuild {
1325
757
  };
1326
758
  }
1327
759
 
1328
- /**
1329
- * Creates a collection of this guild's roles, sorted by their position and ids.
1330
- * @returns {Collection<Snowflake, Role>}
1331
- * @private
1332
- */
760
+
1333
761
  _sortedRoles() {
1334
762
  return discordSort(this.roles.cache);
1335
763
  }
1336
764
 
1337
- /**
1338
- * Creates a collection of this guild's or a specific category's channels, sorted by their position and ids.
1339
- * @param {GuildChannel} [channel] Category to get the channels of
1340
- * @returns {Collection<Snowflake, GuildChannel>}
1341
- * @private
1342
- */
765
+
1343
766
  _sortedChannels(channel) {
1344
767
  const category = channel.type === ChannelType.GuildCategory;
1345
768
  const channelTypes = [ChannelType.GuildText, ChannelType.GuildAnnouncement];
@@ -1355,7 +778,4 @@ class Guild extends AnonymousGuild {
1355
778
 
1356
779
  exports.Guild = Guild;
1357
780
 
1358
- /**
1359
- * @external APIGuild
1360
- * @see {@link https://discord.com/developers/docs/resources/guild#guild-object}
1361
- */
781
+