oceanic.js 1.10.3-dev.c6c9f52 → 1.10.3-dev.ca8b6e8

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 (205) hide show
  1. package/dist/lib/Client.d.ts +99 -0
  2. package/dist/lib/Client.js +263 -0
  3. package/dist/lib/Constants.d.ts +1215 -0
  4. package/dist/lib/Constants.js +1513 -0
  5. package/dist/lib/gateway/Shard.d.ts +83 -0
  6. package/dist/lib/gateway/Shard.js +1621 -0
  7. package/dist/lib/gateway/ShardManager.d.ts +29 -0
  8. package/dist/lib/gateway/ShardManager.js +300 -0
  9. package/dist/lib/index.d.ts +84 -0
  10. package/dist/lib/index.js +168 -0
  11. package/dist/lib/rest/Bucket.d.ts +33 -0
  12. package/dist/lib/rest/Bucket.js +78 -0
  13. package/dist/lib/rest/DiscordHTTPError.d.ts +16 -0
  14. package/dist/lib/rest/DiscordHTTPError.js +65 -0
  15. package/dist/lib/rest/DiscordRESTError.d.ts +19 -0
  16. package/dist/lib/rest/DiscordRESTError.js +89 -0
  17. package/dist/lib/rest/OAuthHelper.d.ts +62 -0
  18. package/dist/lib/rest/OAuthHelper.js +183 -0
  19. package/dist/lib/rest/RESTManager.d.ts +42 -0
  20. package/dist/lib/rest/RESTManager.js +82 -0
  21. package/dist/lib/rest/RequestHandler.d.ts +28 -0
  22. package/dist/lib/rest/RequestHandler.js +313 -0
  23. package/dist/lib/rest/SequentialBucket.d.ts +25 -0
  24. package/dist/lib/rest/SequentialBucket.js +76 -0
  25. package/dist/lib/routes/Applications.d.ts +171 -0
  26. package/dist/lib/routes/Applications.js +447 -0
  27. package/dist/lib/routes/Channels.d.ts +408 -0
  28. package/dist/lib/routes/Channels.js +1160 -0
  29. package/dist/lib/routes/Guilds.d.ts +606 -0
  30. package/dist/lib/routes/Guilds.js +1669 -0
  31. package/dist/lib/routes/Interactions.d.ts +74 -0
  32. package/dist/lib/routes/Interactions.js +141 -0
  33. package/dist/lib/routes/Miscellaneous.d.ts +31 -0
  34. package/dist/lib/routes/Miscellaneous.js +69 -0
  35. package/dist/lib/routes/OAuth.d.ts +108 -0
  36. package/dist/lib/routes/OAuth.js +312 -0
  37. package/dist/lib/routes/Users.d.ts +32 -0
  38. package/dist/lib/routes/Users.js +59 -0
  39. package/dist/lib/routes/Webhooks.d.ts +128 -0
  40. package/dist/lib/routes/Webhooks.js +265 -0
  41. package/dist/lib/structures/AnnouncementChannel.d.ts +36 -0
  42. package/dist/lib/structures/AnnouncementChannel.js +47 -0
  43. package/dist/lib/structures/AnnouncementThreadChannel.d.ts +18 -0
  44. package/dist/lib/structures/AnnouncementThreadChannel.js +27 -0
  45. package/dist/lib/structures/Application.d.ts +102 -0
  46. package/dist/lib/structures/Application.js +189 -0
  47. package/dist/lib/structures/ApplicationCommand.d.ts +74 -0
  48. package/dist/lib/structures/ApplicationCommand.js +141 -0
  49. package/dist/lib/structures/Attachment.d.ts +34 -0
  50. package/dist/lib/structures/Attachment.js +64 -0
  51. package/dist/lib/structures/AuditLogEntry.d.ts +25 -0
  52. package/dist/lib/structures/AuditLogEntry.js +53 -0
  53. package/dist/lib/structures/AutoModerationRule.d.ts +49 -0
  54. package/dist/lib/structures/AutoModerationRule.js +139 -0
  55. package/dist/lib/structures/AutocompleteInteraction.d.ts +62 -0
  56. package/dist/lib/structures/AutocompleteInteraction.js +115 -0
  57. package/dist/lib/structures/Base.d.ts +20 -0
  58. package/dist/lib/structures/Base.js +58 -0
  59. package/dist/lib/structures/BaseEntitlement.d.ts +19 -0
  60. package/dist/lib/structures/BaseEntitlement.js +44 -0
  61. package/dist/lib/structures/CategoryChannel.d.ts +41 -0
  62. package/dist/lib/structures/CategoryChannel.js +105 -0
  63. package/dist/lib/structures/Channel.d.ts +20 -0
  64. package/dist/lib/structures/Channel.js +91 -0
  65. package/dist/lib/structures/ClientApplication.d.ts +153 -0
  66. package/dist/lib/structures/ClientApplication.js +220 -0
  67. package/dist/lib/structures/CommandInteraction.d.ts +127 -0
  68. package/dist/lib/structures/CommandInteraction.js +297 -0
  69. package/dist/lib/structures/ComponentInteraction.d.ts +137 -0
  70. package/dist/lib/structures/ComponentInteraction.js +311 -0
  71. package/dist/lib/structures/Entitlement.d.ts +12 -0
  72. package/dist/lib/structures/Entitlement.js +26 -0
  73. package/dist/lib/structures/ExtendedUser.d.ts +26 -0
  74. package/dist/lib/structures/ExtendedUser.js +57 -0
  75. package/dist/lib/structures/ForumChannel.d.ts +11 -0
  76. package/dist/lib/structures/ForumChannel.js +19 -0
  77. package/dist/lib/structures/GroupChannel.d.ts +62 -0
  78. package/dist/lib/structures/GroupChannel.js +133 -0
  79. package/dist/lib/structures/Guild.d.ts +654 -0
  80. package/dist/lib/structures/Guild.js +1319 -0
  81. package/dist/lib/structures/GuildChannel.d.ts +34 -0
  82. package/dist/lib/structures/GuildChannel.js +75 -0
  83. package/dist/lib/structures/GuildPreview.d.ts +50 -0
  84. package/dist/lib/structures/GuildPreview.js +119 -0
  85. package/dist/lib/structures/GuildScheduledEvent.d.ts +60 -0
  86. package/dist/lib/structures/GuildScheduledEvent.js +154 -0
  87. package/dist/lib/structures/GuildTemplate.d.ts +55 -0
  88. package/dist/lib/structures/GuildTemplate.js +126 -0
  89. package/dist/lib/structures/Integration.d.ts +54 -0
  90. package/dist/lib/structures/Integration.js +156 -0
  91. package/dist/lib/structures/Interaction.d.ts +40 -0
  92. package/dist/lib/structures/Interaction.js +90 -0
  93. package/dist/lib/structures/InteractionResolvedChannel.d.ts +28 -0
  94. package/dist/lib/structures/InteractionResolvedChannel.js +45 -0
  95. package/dist/lib/structures/Invite.d.ts +64 -0
  96. package/dist/lib/structures/Invite.js +193 -0
  97. package/dist/lib/structures/InviteGuild.d.ts +52 -0
  98. package/dist/lib/structures/InviteGuild.js +88 -0
  99. package/dist/lib/structures/MediaChannel.d.ts +11 -0
  100. package/dist/lib/structures/MediaChannel.js +19 -0
  101. package/dist/lib/structures/Member.d.ts +122 -0
  102. package/dist/lib/structures/Member.js +255 -0
  103. package/dist/lib/structures/Message.d.ts +194 -0
  104. package/dist/lib/structures/Message.js +477 -0
  105. package/dist/lib/structures/ModalSubmitInteraction.d.ts +128 -0
  106. package/dist/lib/structures/ModalSubmitInteraction.js +240 -0
  107. package/dist/lib/structures/OAuthApplication.d.ts +79 -0
  108. package/dist/lib/structures/OAuthApplication.js +210 -0
  109. package/dist/lib/structures/OAuthGuild.d.ts +35 -0
  110. package/dist/lib/structures/OAuthGuild.js +61 -0
  111. package/dist/lib/structures/PartialApplication.d.ts +30 -0
  112. package/dist/lib/structures/PartialApplication.js +67 -0
  113. package/dist/lib/structures/Permission.d.ts +21 -0
  114. package/dist/lib/structures/Permission.js +68 -0
  115. package/dist/lib/structures/PermissionOverwrite.d.ts +26 -0
  116. package/dist/lib/structures/PermissionOverwrite.js +49 -0
  117. package/dist/lib/structures/PingInteraction.d.ts +16 -0
  118. package/dist/lib/structures/PingInteraction.js +26 -0
  119. package/dist/lib/structures/Poll.d.ts +28 -0
  120. package/dist/lib/structures/Poll.js +78 -0
  121. package/dist/lib/structures/PrivateChannel.d.ts +90 -0
  122. package/dist/lib/structures/PrivateChannel.js +131 -0
  123. package/dist/lib/structures/PrivateThreadChannel.d.ts +18 -0
  124. package/dist/lib/structures/PrivateThreadChannel.js +27 -0
  125. package/dist/lib/structures/PublicThreadChannel.d.ts +21 -0
  126. package/dist/lib/structures/PublicThreadChannel.js +37 -0
  127. package/dist/lib/structures/Role.d.ts +52 -0
  128. package/dist/lib/structures/Role.js +137 -0
  129. package/dist/lib/structures/SKU.d.ts +32 -0
  130. package/dist/lib/structures/SKU.js +53 -0
  131. package/dist/lib/structures/StageChannel.d.ts +33 -0
  132. package/dist/lib/structures/StageChannel.js +44 -0
  133. package/dist/lib/structures/StageInstance.d.ts +36 -0
  134. package/dist/lib/structures/StageInstance.js +94 -0
  135. package/dist/lib/structures/Team.d.ts +22 -0
  136. package/dist/lib/structures/Team.js +67 -0
  137. package/dist/lib/structures/TestEntitlement.d.ts +10 -0
  138. package/dist/lib/structures/TestEntitlement.js +21 -0
  139. package/dist/lib/structures/TextChannel.d.ts +34 -0
  140. package/dist/lib/structures/TextChannel.js +46 -0
  141. package/dist/lib/structures/TextableChannel.d.ts +158 -0
  142. package/dist/lib/structures/TextableChannel.js +276 -0
  143. package/dist/lib/structures/TextableVoiceChannel.d.ts +39 -0
  144. package/dist/lib/structures/TextableVoiceChannel.js +81 -0
  145. package/dist/lib/structures/ThreadChannel.d.ts +159 -0
  146. package/dist/lib/structures/ThreadChannel.js +295 -0
  147. package/dist/lib/structures/ThreadOnlyChannel.d.ts +99 -0
  148. package/dist/lib/structures/ThreadOnlyChannel.js +233 -0
  149. package/dist/lib/structures/ThreadableChannel.d.ts +36 -0
  150. package/dist/lib/structures/ThreadableChannel.js +58 -0
  151. package/dist/lib/structures/UnavailableGuild.d.ts +11 -0
  152. package/dist/lib/structures/UnavailableGuild.js +21 -0
  153. package/dist/lib/structures/User.d.ts +82 -0
  154. package/dist/lib/structures/User.js +168 -0
  155. package/dist/lib/structures/VoiceChannel.d.ts +20 -0
  156. package/dist/lib/structures/VoiceChannel.js +35 -0
  157. package/dist/lib/structures/VoiceState.d.ts +51 -0
  158. package/dist/lib/structures/VoiceState.js +140 -0
  159. package/dist/lib/structures/Webhook.d.ts +129 -0
  160. package/dist/lib/structures/Webhook.js +206 -0
  161. package/dist/lib/types/applications.d.ts +466 -0
  162. package/dist/lib/types/audit-log.d.ts +122 -0
  163. package/dist/lib/types/auto-moderation.d.ts +99 -0
  164. package/dist/lib/types/channels.d.ts +1244 -0
  165. package/dist/lib/types/client.d.ts +228 -0
  166. package/dist/lib/types/events.d.ts +265 -0
  167. package/dist/lib/types/gateway-raw.d.ts +584 -0
  168. package/dist/lib/types/gateway.d.ts +351 -0
  169. package/dist/lib/types/guild-template.d.ts +33 -0
  170. package/dist/lib/types/guilds.d.ts +855 -0
  171. package/dist/lib/types/index.d.ts +18 -0
  172. package/dist/lib/types/interactions.d.ts +377 -0
  173. package/dist/lib/types/json.d.ts +742 -0
  174. package/dist/lib/types/misc.d.ts +28 -0
  175. package/dist/lib/types/oauth.d.ts +201 -0
  176. package/dist/lib/types/request-handler.d.ts +52 -0
  177. package/dist/lib/types/scheduled-events.d.ts +88 -0
  178. package/dist/lib/types/shared.d.ts +9 -0
  179. package/dist/lib/types/users.d.ts +45 -0
  180. package/dist/lib/types/voice.d.ts +45 -0
  181. package/dist/lib/types/webhooks.d.ts +74 -0
  182. package/dist/lib/util/Collection.d.ts +47 -0
  183. package/dist/lib/util/Collection.js +78 -0
  184. package/dist/lib/util/Errors.d.ts +29 -0
  185. package/dist/lib/util/Errors.js +56 -0
  186. package/dist/lib/util/Routes.d.ts +127 -0
  187. package/dist/lib/util/Routes.js +248 -0
  188. package/dist/lib/util/SimpleCollection.d.ts +12 -0
  189. package/dist/lib/util/SimpleCollection.js +81 -0
  190. package/dist/lib/util/TypedCollection.d.ts +24 -0
  191. package/dist/lib/util/TypedCollection.js +76 -0
  192. package/dist/lib/util/TypedEmitter.d.ts +19 -0
  193. package/dist/lib/util/TypedEmitter.js +19 -0
  194. package/dist/lib/util/Util.d.ts +58 -0
  195. package/dist/lib/util/Util.js +535 -0
  196. package/dist/lib/util/interactions/InteractionOptionsWrapper.d.ts +170 -0
  197. package/dist/lib/util/interactions/InteractionOptionsWrapper.js +213 -0
  198. package/dist/lib/util/interactions/MessageInteractionResponse.d.ts +24 -0
  199. package/dist/lib/util/interactions/MessageInteractionResponse.js +28 -0
  200. package/dist/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.d.ts +24 -0
  201. package/dist/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.js +34 -0
  202. package/dist/lib/util/interactions/SelectMenuValuesWrapper.d.ts +60 -0
  203. package/dist/lib/util/interactions/SelectMenuValuesWrapper.js +124 -0
  204. package/dist/package.json +1 -1
  205. package/package.json +1 -1
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /** @module Member */
5
+ const Base_1 = tslib_1.__importDefault(require("./Base"));
6
+ const Constants_1 = require("../Constants");
7
+ const Routes = tslib_1.__importStar(require("../util/Routes"));
8
+ const Errors_1 = require("../util/Errors");
9
+ /** Represents a member of a guild. */
10
+ class Member extends Base_1.default {
11
+ _cachedGuild;
12
+ /** The member's avatar hash, if they have set a guild avatar. */
13
+ avatar;
14
+ /** When the member's [timeout](https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ) will expire, if active. */
15
+ communicationDisabledUntil;
16
+ /** If this member is server deafened. */
17
+ deaf;
18
+ /** The member's [flags](https://discord.com/developers/docs/resources/guild#guild-member-object-flags). */
19
+ flags;
20
+ /** The id of the guild this member is for. */
21
+ guildID;
22
+ /** Undocumented. */
23
+ isPending;
24
+ /** The date at which this member joined the guild. */
25
+ joinedAt;
26
+ /** If this member is server muted. */
27
+ mute;
28
+ /** This member's nickname, if any. */
29
+ nick;
30
+ /** If this member has not passed the guild's [membership screening](https://discord.com/developers/docs/resources/guild#membership-screening-object) requirements. */
31
+ pending;
32
+ /** The date at which this member started boosting the guild, if applicable. */
33
+ premiumSince;
34
+ /** The presence of this member. */
35
+ presence;
36
+ /** The roles this member has. */
37
+ roles;
38
+ /** The user associated with this member. */
39
+ user;
40
+ constructor(data, client, guildID) {
41
+ let user;
42
+ let id;
43
+ if (!data.user && data.id) {
44
+ user = client.users.get(id = data.id);
45
+ }
46
+ else if (data.user) {
47
+ id = (user = client.users.update(data.user)).id;
48
+ }
49
+ if (!user) {
50
+ throw new TypeError(`Member received without a user${id === undefined ? " or id." : `: ${id}`}`);
51
+ }
52
+ super(user.id, client);
53
+ this.avatar = null;
54
+ this.communicationDisabledUntil = null;
55
+ this.deaf = !!data.deaf;
56
+ this.flags = 0;
57
+ this.guildID = guildID;
58
+ this.joinedAt = null;
59
+ this.mute = !!data.mute;
60
+ this.nick = null;
61
+ this.pending = false;
62
+ this.premiumSince = null;
63
+ this.roles = [];
64
+ this.user = user;
65
+ this.update(data);
66
+ }
67
+ toggleFlag(flag, enable, reason) {
68
+ return this.edit({ flags: enable ? this.flags | flag : this.flags & ~flag, reason });
69
+ }
70
+ update(data) {
71
+ if (data.avatar !== undefined) {
72
+ this.avatar = data.avatar;
73
+ }
74
+ if (data.communication_disabled_until !== undefined) {
75
+ this.communicationDisabledUntil = data.communication_disabled_until === null ? null : new Date(data.communication_disabled_until);
76
+ }
77
+ if (data.deaf !== undefined) {
78
+ this.deaf = data.deaf;
79
+ }
80
+ if (data.flags !== undefined) {
81
+ this.flags = data.flags;
82
+ }
83
+ if (data.is_pending !== undefined) {
84
+ this.isPending = data.is_pending;
85
+ }
86
+ if (data.joined_at !== undefined) {
87
+ this.joinedAt = data.joined_at === null ? null : new Date(data.joined_at);
88
+ }
89
+ if (data.mute !== undefined) {
90
+ this.mute = data.mute;
91
+ }
92
+ if (data.nick !== undefined) {
93
+ this.nick = data.nick;
94
+ }
95
+ if (data.pending !== undefined) {
96
+ this.pending = data.pending;
97
+ }
98
+ if (data.premium_since !== undefined) {
99
+ this.premiumSince = data.premium_since === null ? null : new Date(data.premium_since);
100
+ }
101
+ if (data.roles !== undefined) {
102
+ this.roles = data.roles;
103
+ }
104
+ if (data.user !== undefined) {
105
+ this.user = this.client.users.update(data.user);
106
+ }
107
+ }
108
+ /** If the member associated with the user is a bot. */
109
+ get bot() {
110
+ return this.user.bot;
111
+ }
112
+ /** The Discord-tag of the user associated with this member. */
113
+ get discriminator() {
114
+ return this.user.discriminator;
115
+ }
116
+ /** The nick of this member if set, the display name of this member's user if set, or their username. */
117
+ get displayName() {
118
+ return this.nick ?? this.user.globalName ?? this.username;
119
+ }
120
+ /** The guild this member is for. This will throw an error if the guild is not cached. */
121
+ get guild() {
122
+ this._cachedGuild ??= this.client.guilds.get(this.guildID);
123
+ if (!this._cachedGuild) {
124
+ if (this.client.options.restMode) {
125
+ throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
126
+ }
127
+ if (!this.client.shards.connected) {
128
+ throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
129
+ }
130
+ throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
131
+ }
132
+ return this._cachedGuild;
133
+ }
134
+ /** A string that will mention this member. */
135
+ get mention() {
136
+ return this.user.mention;
137
+ }
138
+ /** The permissions of this member. */
139
+ get permissions() {
140
+ return this.guild.permissionsOf(this);
141
+ }
142
+ /** The user associated with this member's public [flags](https://discord.com/developers/docs/resources/user#user-object-user-flags). */
143
+ get publicFlags() {
144
+ return this.user.publicFlags;
145
+ }
146
+ /** If this user associated with this member is an official discord system user. */
147
+ get system() {
148
+ return this.user.system;
149
+ }
150
+ /** The 4 digits after this user's username, if they have not been migrated. If migrated, this will be a single "0". */
151
+ get tag() {
152
+ return this.user.tag;
153
+ }
154
+ /** The username associated with this member's user. */
155
+ get username() {
156
+ return this.user.username;
157
+ }
158
+ /** The voice state of this member. */
159
+ get voiceState() {
160
+ return this.guild.voiceStates.get(this.id) ?? null;
161
+ }
162
+ /**
163
+ * Add a role to this member.
164
+ * @param roleID The ID of the role to add.
165
+ */
166
+ async addRole(roleID, reason) {
167
+ await this.client.rest.guilds.addMemberRole(this.guildID, this.id, roleID, reason);
168
+ }
169
+ /**
170
+ * The url of this user's guild avatar (or their user avatar if no guild avatar is set, or their default avatar if none apply).
171
+ * @param format The format the url should be.
172
+ * @param size The dimensions of the image.
173
+ */
174
+ avatarURL(format, size) {
175
+ return this.avatar === null ? this.user.avatarURL(format, size) : this.client.util.formatImage(Routes.GUILD_AVATAR(this.guildID, this.id, this.avatar), format, size);
176
+ }
177
+ /**
178
+ * Create a ban for this member.
179
+ * @param options The options for the ban.
180
+ */
181
+ async ban(options) {
182
+ await this.client.rest.guilds.createBan(this.guildID, this.id, options);
183
+ }
184
+ /**
185
+ * Disable the `BYPASSES_VERIFICATION` flag for this member. Requires the **Manage Guild** permission.
186
+ * @param reason The reason for disabling the flag.
187
+ */
188
+ async disableVerificationBypass(reason) {
189
+ await this.toggleFlag(Constants_1.GuildMemberFlags.BYPASSES_VERIFICATION, false, reason);
190
+ }
191
+ /**
192
+ * Edit this member. Use {@link Guild#editCurrentMember | Guild#editCurrentMember} if you wish to update the nick of this client using the `CHANGE_NICKNAME` permission.
193
+ * @param options The options for editing the member.
194
+ */
195
+ async edit(options) {
196
+ return this.client.rest.guilds.editMember(this.guildID, this.id, options);
197
+ }
198
+ /**
199
+ * Edit this guild member's voice state. `channelID` is required, and the user must already be in that channel. See [Discord's docs](https://discord.com/developers/docs/resources/guild#modify-user-voice-state) for more information.
200
+ * @param options The options for editing the voice state.
201
+ */
202
+ async editVoiceState(options) {
203
+ return this.client.rest.guilds.editUserVoiceState(this.guildID, this.id, options);
204
+ }
205
+ /**
206
+ * Enable the `BYPASSES_VERIFICATION` flag for this member. Requires the **Manage Guild** permission.
207
+ * @param reason The reason for enabling the flag.
208
+ */
209
+ async enableVerificationBypass(reason) {
210
+ await this.toggleFlag(Constants_1.GuildMemberFlags.BYPASSES_VERIFICATION, true, reason);
211
+ }
212
+ /**
213
+ * Remove a member from the guild.
214
+ * @param reason The reason for the kick.
215
+ */
216
+ async kick(reason) {
217
+ await this.client.rest.guilds.removeMember(this.guildID, this.id, reason);
218
+ }
219
+ /**
220
+ * Remove a role from this member.
221
+ * @param roleID The ID of the role to remove.
222
+ * @param reason The reason for removing the role.
223
+ */
224
+ async removeRole(roleID, reason) {
225
+ await this.client.rest.guilds.removeMemberRole(this.guildID, this.id, roleID, reason);
226
+ }
227
+ toJSON() {
228
+ return {
229
+ ...super.toJSON(),
230
+ avatar: this.avatar,
231
+ communicationDisabledUntil: this.communicationDisabledUntil?.getTime() ?? null,
232
+ deaf: this.deaf,
233
+ flags: this.flags,
234
+ guildID: this.guildID,
235
+ isPending: this.isPending,
236
+ joinedAt: this.joinedAt?.getTime() ?? null,
237
+ mute: this.mute,
238
+ nick: this.nick,
239
+ pending: this.pending,
240
+ premiumSince: this.premiumSince?.getTime() ?? null,
241
+ presence: this.presence,
242
+ roles: this.roles,
243
+ user: this.user.toJSON()
244
+ };
245
+ }
246
+ /**
247
+ * Remove a ban for this member.
248
+ * @param reason The reason for removing the ban.
249
+ */
250
+ async unban(reason) {
251
+ await this.client.rest.guilds.removeBan(this.guildID, this.id, reason);
252
+ }
253
+ }
254
+ exports.default = Member;
255
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWVtYmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL3N0cnVjdHVyZXMvTWVtYmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHFCQUFxQjtBQUNyQiwwREFBMEI7QUFLMUIsNENBQWtFO0FBQ2xFLCtEQUF5QztBQVd6QywyQ0FBK0M7QUFFL0Msc0NBQXNDO0FBQ3RDLE1BQXFCLE1BQU8sU0FBUSxjQUFJO0lBQzVCLFlBQVksQ0FBUztJQUM3QixpRUFBaUU7SUFDakUsTUFBTSxDQUFnQjtJQUN0QixvSUFBb0k7SUFDcEksMEJBQTBCLENBQWM7SUFDeEMseUNBQXlDO0lBQ3pDLElBQUksQ0FBVTtJQUNkLDJHQUEyRztJQUMzRyxLQUFLLENBQVM7SUFDZCw4Q0FBOEM7SUFDOUMsT0FBTyxDQUFTO0lBQ2hCLG9CQUFvQjtJQUNwQixTQUFTLENBQVc7SUFDcEIsc0RBQXNEO0lBQ3RELFFBQVEsQ0FBYztJQUN0QixzQ0FBc0M7SUFDdEMsSUFBSSxDQUFVO0lBQ2Qsc0NBQXNDO0lBQ3RDLElBQUksQ0FBZ0I7SUFDcEIsc0tBQXNLO0lBQ3RLLE9BQU8sQ0FBVTtJQUNqQiwrRUFBK0U7SUFDL0UsWUFBWSxDQUFjO0lBQzFCLG1DQUFtQztJQUNuQyxRQUFRLENBQVk7SUFDcEIsaUNBQWlDO0lBQ2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xFQUFFLE9BQU8sRUFBRSxJQUFJLElBQUk7WUFDNUQsSUFBSSxFQUF3QixJQUFJLENBQUMsSUFBSTtZQUNyQyxJQUFJLEVBQXdCLElBQUksQ0FBQyxJQUFJO1lBQ3JDLE9BQU8sRUFBcUIsSUFBSSxDQUFDLE9BQU87WUFDeEMsWUFBWSxFQUFnQixJQUFJLENBQUMsWUFBWSxFQUFFLE9BQU8sRUFBRSxJQUFJLElBQUk7WUFDaEUsUUFBUSxFQUFvQixJQUFJLENBQUMsUUFBUTtZQUN6QyxLQUFLLEVBQXVCLElBQUksQ0FBQyxLQUFLO1lBQ3RDLElBQUksRUFBd0IsSUFBSSxDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUU7U0FDakQsQ0FBQztJQUNOLENBQUM7SUFFRDs7O09BR0c7SUFDSCxLQUFLLENBQUMsS0FBSyxDQUFDLE1BQWU7UUFDdkIsTUFBTSxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLEVBQUUsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUMzRSxDQUFDO0NBQ0o7QUE1UUQseUJBNFFDIn0=
@@ -0,0 +1,194 @@
1
+ /** @module Message */
2
+ import Base from "./Base";
3
+ import Attachment from "./Attachment";
4
+ import User from "./User";
5
+ import type Guild from "./Guild";
6
+ import type Member from "./Member";
7
+ import PartialApplication from "./PartialApplication";
8
+ import type ClientApplication from "./ClientApplication";
9
+ import type AnnouncementChannel from "./AnnouncementChannel";
10
+ import type AnnouncementThreadChannel from "./AnnouncementThreadChannel";
11
+ import type PublicThreadChannel from "./PublicThreadChannel";
12
+ import type TextChannel from "./TextChannel";
13
+ import type PrivateChannel from "./PrivateChannel";
14
+ import Poll from "./Poll";
15
+ import type Client from "../Client";
16
+ import TypedCollection from "../util/TypedCollection";
17
+ import { type MessageTypes } from "../Constants";
18
+ import type { Uncached } from "../types/shared";
19
+ import type { AnyTextableGuildChannel, AnyTextableChannel, ChannelMention, EditMessageOptions, Embed, GetReactionsOptions, MessageActivity, MessageInteraction, MessageReference, RawAttachment, RawMessage, StartThreadFromMessageOptions, StickerItem, MessageReaction, MessageActionRow, AnyThreadChannel, RoleSubscriptionData, MessageInteractionMetadata, GetPollAnswerUsersOptions } from "../types/channels";
20
+ import type { DeleteWebhookMessageOptions, EditWebhookMessageOptions } from "../types/webhooks";
21
+ import type { JSONMessage } from "../types/json";
22
+ /** Represents a message. */
23
+ export default class Message<T extends AnyTextableChannel | Uncached = AnyTextableChannel | Uncached> extends Base {
24
+ private _cachedChannel;
25
+ private _cachedGuild?;
26
+ /** The [activity](https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure) associated with this message. */
27
+ activity?: MessageActivity;
28
+ /**
29
+ * The application associated with this message. This can be present in two scenarios:
30
+ * * If the message was from an interaction or application owned webhook ({@link ClientApplication} if any shard has reached READY, {@link PartialApplication} otherwise).
31
+ * * If the message has a rich presence embed ({@link PartialApplication})
32
+ */
33
+ application?: PartialApplication | ClientApplication;
34
+ /**
35
+ * The ID of the application associated with this message. This can be present in two scenarios:
36
+ * * If the message was from an interaction or application owned webhook ({@link ClientApplication} if any shard has reached READY, {@link PartialApplication} otherwise).
37
+ * * If the message has a rich presence embed ({@link PartialApplication})
38
+ */
39
+ applicationID: string | null;
40
+ /** The attachments on this message. */
41
+ attachments: TypedCollection<RawAttachment, Attachment>;
42
+ /** The author of this message. */
43
+ author: User;
44
+ /** The ID of the channel this message was created in. */
45
+ channelID: string;
46
+ /** The components on this message. */
47
+ components: Array<MessageActionRow>;
48
+ /** The content of this message. */
49
+ content: string;
50
+ /** The timestamp at which this message was last edited. */
51
+ editedTimestamp: Date | null;
52
+ /** The embeds on this message. */
53
+ embeds: Array<Embed>;
54
+ /** The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) on this message. */
55
+ flags: number;
56
+ /** The ID of the guild this message is in. */
57
+ guildID: T extends AnyTextableGuildChannel ? string : string | null;
58
+ /**
59
+ * The interaction info, if this message was the result of an interaction.
60
+ * @deprecated Use {@link Message#interactionMetadata | Message#interactionMetadata } instead.
61
+ */
62
+ interaction?: MessageInteraction;
63
+ /** The interaction info, if this message was the result of an interaction. */
64
+ interactionMetadata?: MessageInteractionMetadata;
65
+ /** The member that created this message, if this message is in a guild. */
66
+ member: T extends AnyTextableGuildChannel ? Member : Member | undefined;
67
+ /** Channels mentioned in a `CROSSPOSTED` channel follower message. See [Discord's docs](https://discord.com/developers/docs/resources/channel#channel-mention-object) for more information. */
68
+ mentionChannels?: Array<ChannelMention>;
69
+ /** The mentions in this message. */
70
+ mentions: {
71
+ /** The ids of the channels mentioned in this message. */
72
+ channels: Array<string>;
73
+ /** If @everyone/@here is mentioned in this message. */
74
+ everyone: boolean;
75
+ /** The members mentioned in this message. */
76
+ members: Array<Member>;
77
+ /** The ids of the roles mentioned in this message. */
78
+ roles: Array<string>;
79
+ /** The users mentioned in this message. */
80
+ users: Array<User>;
81
+ };
82
+ /** If this message is a `REPLY` or `THREAD_STARTER_MESSAGE`, some info about the referenced message. */
83
+ messageReference?: MessageReference;
84
+ /** A nonce for ensuring a message was sent. */
85
+ nonce?: number | string;
86
+ /** If this message is pinned. */
87
+ pinned: boolean;
88
+ /** The poll on this message, if any. */
89
+ poll?: Poll;
90
+ /** This message's relative position, if in a thread. */
91
+ position?: number;
92
+ /** The reactions on this message. */
93
+ reactions: Array<MessageReaction>;
94
+ /** If this message is a `REPLY` or `THREAD_STARTER_MESSAGE`, this will be the message that's referenced. */
95
+ referencedMessage?: Message | null;
96
+ /** The data of the role subscription purchase or renewal that prompted this message. */
97
+ roleSubscriptionData?: RoleSubscriptionData;
98
+ /** The sticker items on this message. */
99
+ stickerItems?: Array<StickerItem>;
100
+ /** The thread associated with this message, if any. */
101
+ thread?: AnyThreadChannel;
102
+ /** The timestamp at which this message was sent. */
103
+ timestamp: Date;
104
+ /** If this message was read aloud. */
105
+ tts: boolean;
106
+ /** The [type](https://discord.com/developers/docs/resources/channel#message-object-message-types) of this message. */
107
+ type: MessageTypes;
108
+ /** The webhook associated with this message, if sent via a webhook. This only has an `id` property. */
109
+ webhookID?: string;
110
+ constructor(data: RawMessage, client: Client);
111
+ protected update(data: Partial<RawMessage>): void;
112
+ /** The channel this message was created in. */
113
+ get channel(): T extends AnyTextableChannel ? T : undefined;
114
+ /** The guild this message is in. This will throw an error if the guild is not cached. */
115
+ get guild(): T extends AnyTextableGuildChannel ? Guild : Guild | null;
116
+ /** A link to this message. */
117
+ get jumpLink(): string;
118
+ /**
119
+ * Add a reaction to this message.
120
+ * @param emoji The reaction to add to the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
121
+ */
122
+ createReaction(emoji: string): Promise<void>;
123
+ /**
124
+ * Crosspost this message in an announcement channel.
125
+ */
126
+ crosspost(): Promise<Message<T>>;
127
+ /**
128
+ * Delete this message.
129
+ * @param reason The reason for deleting the message.
130
+ */
131
+ delete(reason?: string): Promise<void>;
132
+ /**
133
+ * Remove a reaction from this message.
134
+ * @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
135
+ * @param user The user to remove the reaction from, `@me` for the current user (default).
136
+ */
137
+ deleteReaction(emoji: string, user?: string): Promise<void>;
138
+ /**
139
+ * Remove all, or a specific emoji's reactions from this message.
140
+ * @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. Omit to remove all reactions.
141
+ */
142
+ deleteReactions(emoji?: string): Promise<void>;
143
+ /**
144
+ * Delete this message as a webhook.
145
+ * @param token The token of the webhook.
146
+ * @param options Options for deleting the message.
147
+ */
148
+ deleteWebhook(token: string, options: DeleteWebhookMessageOptions): Promise<void>;
149
+ /**
150
+ * Edit this message.
151
+ * @param options The options for editing the message.
152
+ */
153
+ edit(options: EditMessageOptions): Promise<Message<T>>;
154
+ /**
155
+ * Edit this message as a webhook.
156
+ * @param token The token of the webhook.
157
+ * @param options The options for editing the message.
158
+ */
159
+ editWebhook(token: string, options: EditWebhookMessageOptions): Promise<Message<T>>;
160
+ /** End this The poll on this message now. */
161
+ expire(): Promise<void>;
162
+ /**
163
+ * Get the users that voted on a poll answer.
164
+ * @param answerID The ID of the poll answer to get voters for.
165
+ * @param options The options for getting the voters.
166
+ */
167
+ getPollAnswerUsers(answerID: number, options?: GetPollAnswerUsersOptions): Promise<Array<User>>;
168
+ /**
169
+ * Get the users who reacted with a specific emoji on this message.
170
+ * @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
171
+ * @param options The options for getting the reactions.
172
+ */
173
+ getReactions(emoji: string, options?: GetReactionsOptions): Promise<Array<User>>;
174
+ /** Whether this message belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the message properties typing definitions based on the channel it belongs to. */
175
+ inCachedGuildChannel(): this is Message<AnyTextableGuildChannel>;
176
+ /** Whether this message belongs to a direct message channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the message properties typing definitions based on the channel it belongs to. */
177
+ inDirectMessageChannel(): this is Message<PrivateChannel | Uncached>;
178
+ /**
179
+ * Pin this message.
180
+ * @param reason The reason for pinning the message.
181
+ */
182
+ pin(reason?: string): Promise<void>;
183
+ /**
184
+ * Create a thread from this message.
185
+ * @param options The options for creating the thread.
186
+ */
187
+ startThread(options: StartThreadFromMessageOptions): Promise<T extends AnnouncementChannel ? AnnouncementThreadChannel : T extends TextChannel ? PublicThreadChannel : never>;
188
+ toJSON(): JSONMessage;
189
+ /**
190
+ * Unpin this message.
191
+ * @param reason The reason for unpinning the message.
192
+ */
193
+ unpin(reason?: string): Promise<void>;
194
+ }