@wolfstar/plugin-gateway 0.12.0 → 0.13.0-next-20261008155539

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/dist/esm/index.js CHANGED
@@ -10781,6 +10781,13 @@ var Attachment = class extends Attachment$1 {
10781
10781
  initStructure(this, data, relations);
10782
10782
  }
10783
10783
  /**
10784
+ * The URL of the file, like discord.js's `Attachment#attachment`, so that an attachment can be resent with
10785
+ * `AttachmentBuilder.from`.
10786
+ */
10787
+ get attachment() {
10788
+ return this.url;
10789
+ }
10790
+ /**
10784
10791
  * The name of the file.
10785
10792
  */
10786
10793
  get name() {
@@ -18088,6 +18095,164 @@ function resolveCache(options) {
18088
18095
  */
18089
18096
  const GatewayErrorCodes = Object.freeze(Object.fromEntries(Object.keys(GatewayErrorMessages).map((code) => [code, code])));
18090
18097
 
18098
+ //#endregion
18099
+ //#region src/structures/messages/AttachmentBuilder.ts
18100
+ const SpoilerPrefix = "SPOILER_";
18101
+ /**
18102
+ * Builds a file to send with a message, like discord.js's `AttachmentBuilder`. Pass it in the `files` of a message.
18103
+ *
18104
+ * @example
18105
+ * ```ts
18106
+ * const file = new AttachmentBuilder("./howl.ogg").setDescription("A howl").setSpoiler();
18107
+ * await channel.send({ content: "Awoo", files: [file] });
18108
+ * ```
18109
+ */
18110
+ var AttachmentBuilder = class AttachmentBuilder {
18111
+ /**
18112
+ * The contents of the file: its data, a path on disk, a URL, a stream, or a blob.
18113
+ */
18114
+ attachment;
18115
+ /**
18116
+ * The name of the file, `undefined` to infer it from a path or URL.
18117
+ */
18118
+ name;
18119
+ /**
18120
+ * The description (alt text) of the file.
18121
+ */
18122
+ description;
18123
+ /**
18124
+ * The title of the file.
18125
+ */
18126
+ title;
18127
+ /**
18128
+ * The duration of a voice message, in seconds.
18129
+ */
18130
+ duration;
18131
+ /**
18132
+ * The waveform of a voice message, base64-encoded.
18133
+ */
18134
+ waveform;
18135
+ /**
18136
+ * Whether the file is a spoiler while it has no name to prefix with `SPOILER_`.
18137
+ */
18138
+ pendingSpoiler = false;
18139
+ /**
18140
+ * @param attachment The contents of the file.
18141
+ * @param data The name and description of the file.
18142
+ */
18143
+ constructor(attachment, data = {}) {
18144
+ this.attachment = attachment;
18145
+ this.name = data.name;
18146
+ this.description = data.description;
18147
+ }
18148
+ /**
18149
+ * Whether the file is a spoiler: its name starts with `SPOILER_`.
18150
+ */
18151
+ get spoiler() {
18152
+ return this.name === void 0 ? this.pendingSpoiler : basename$1(this.name).startsWith(SpoilerPrefix);
18153
+ }
18154
+ /**
18155
+ * Sets the description (alt text) of the file.
18156
+ *
18157
+ * @param description The description.
18158
+ */
18159
+ setDescription(description) {
18160
+ this.description = description;
18161
+ return this;
18162
+ }
18163
+ /**
18164
+ * Sets the contents of the file, and its name when given.
18165
+ *
18166
+ * @param attachment The contents of the file.
18167
+ * @param name The name of the file, kept as is when omitted.
18168
+ */
18169
+ setFile(attachment, name) {
18170
+ this.attachment = attachment;
18171
+ if (name !== void 0) this.setName(name);
18172
+ return this;
18173
+ }
18174
+ /**
18175
+ * Sets the name of the file.
18176
+ *
18177
+ * @param name The name of the file.
18178
+ */
18179
+ setName(name) {
18180
+ this.name = name;
18181
+ if (this.pendingSpoiler) {
18182
+ this.pendingSpoiler = false;
18183
+ this.setSpoiler();
18184
+ }
18185
+ return this;
18186
+ }
18187
+ /**
18188
+ * Marks the file as a spoiler, or not, by adding or removing the `SPOILER_` prefix of its name.
18189
+ *
18190
+ * @param spoiler Whether the file is a spoiler.
18191
+ */
18192
+ setSpoiler(spoiler = true) {
18193
+ if (this.name === void 0) this.pendingSpoiler = spoiler;
18194
+ else if (!spoiler) while (this.name.startsWith(SpoilerPrefix)) this.name = this.name.slice(8);
18195
+ else if (!this.name.startsWith(SpoilerPrefix)) this.name = `${SpoilerPrefix}${this.name}`;
18196
+ return this;
18197
+ }
18198
+ /**
18199
+ * Sets the title of the file.
18200
+ *
18201
+ * @param title The title.
18202
+ */
18203
+ setTitle(title) {
18204
+ this.title = title;
18205
+ return this;
18206
+ }
18207
+ /**
18208
+ * Sets the duration of a voice message.
18209
+ *
18210
+ * @param duration The duration, in seconds.
18211
+ */
18212
+ setDuration(duration) {
18213
+ this.duration = duration;
18214
+ return this;
18215
+ }
18216
+ /**
18217
+ * Sets the waveform of a voice message.
18218
+ *
18219
+ * @param waveform The waveform, base64-encoded.
18220
+ */
18221
+ setWaveform(waveform) {
18222
+ this.waveform = waveform;
18223
+ return this;
18224
+ }
18225
+ /**
18226
+ * The file as an {@link AttachmentPayload}.
18227
+ */
18228
+ toJSON() {
18229
+ const payload = { attachment: this.attachment };
18230
+ if (this.name !== void 0) payload.name = this.name;
18231
+ if (this.description !== void 0) payload.description = this.description;
18232
+ if (this.title !== void 0) payload.title = this.title;
18233
+ if (this.duration !== void 0) payload.duration = this.duration;
18234
+ if (this.waveform !== void 0) payload.waveform = this.waveform;
18235
+ if (this.name === void 0 && this.pendingSpoiler) payload.spoiler = true;
18236
+ return payload;
18237
+ }
18238
+ /**
18239
+ * Copies a file.
18240
+ *
18241
+ * @param other The builder, payload, or received attachment to copy.
18242
+ */
18243
+ static from(other) {
18244
+ const builder = new AttachmentBuilder(other.attachment, {
18245
+ name: other.name ?? void 0,
18246
+ description: other.description ?? void 0
18247
+ });
18248
+ if (other.title != null) builder.title = other.title;
18249
+ if (other.duration != null) builder.duration = other.duration;
18250
+ if (other.waveform != null) builder.waveform = other.waveform;
18251
+ if (other.spoiler) builder.setSpoiler();
18252
+ return builder;
18253
+ }
18254
+ };
18255
+
18091
18256
  //#endregion
18092
18257
  //#region src/util/decorators.ts
18093
18258
  /**
@@ -18169,5 +18334,5 @@ const DefaultSweeperSettings = Object.freeze({
18169
18334
  });
18170
18335
 
18171
18336
  //#endregion
18172
- export { Action, ActionRow, ActionsManager, Activity, ActivityFlagsBitField, AnnouncementChannel, AnnouncementThreadChannel, AnonymousGuild, ApplicationFlagsBitField, AppliedTagsMixin, Attachment, AttachmentFlagsBitField, AutoModerationActionExecution, AutoModerationRule, AutoModerationRuleManager, BaseChannel, BaseChannelMixin, BaseInvite, BaseManager, BitField, CachedManager, CategoryChannel, CategoryChannelChildManager, Channel, ChannelFlagsBitField, ChannelManager, ChannelMessageManager, ChannelOwnerMixin, ChannelParentMixin, ChannelPermissionMixin, ChannelSelectMenuComponent, ChannelSlowmodeMixin, ChannelThreadManager, ChannelThreadsMixin, ChannelTopicMixin, ChannelWebhooksMixin, CheckboxComponent, CheckboxGroupComponent, ClientUser, CollectionCache, Colors, Component, ComponentMixin, ContainerComponent, DMChannel, DMChannelMixin, DataManager, DefaultSweeperSettings, DispatchAction, DispatchHandlers, DispatchQueue, DispatchStateCodecs, DispatchTimeoutError, Embed, Emoji, EntityStoreCache, EventGatewayListener, FileComponent, FileUploadComponent, ForumChannel, GatewayClient, GatewayError, GatewayErrorCodes, GatewayErrorMessages, GatewayEvents, GatewayRangeError, GatewaySessionStoreError, GatewayTypeError, GroupDMChannel, GroupDMInvite, GroupDMMixin, Guild, GuildAuditLogsEntry, GuildBan, GuildBanManager, GuildChannelFields, GuildChannelInfoTimeoutError, GuildChannelManager, GuildChannelMixin, GuildEmoji, GuildEmojiManager, GuildEmojiRoleManager, GuildIntegrationManager, GuildInvite, GuildInviteManager, GuildManager, GuildMember, GuildMemberFlagsBitField, GuildMemberManager, GuildMemberRoleManager, GuildMembersRateLimitError, GuildMembersTimeoutError, GuildOnboarding, GuildOnboardingPrompt, GuildOnboardingPromptOption, GuildPreview, GuildScheduledEvent, GuildScheduledEventManager, GuildSoundboardSoundManager, GuildSoundboardSoundsTimeoutError, GuildStickerManager, GuildTemplate, GuildTemplateManager, GuildTemplatesPattern, Integration, IntentsBitField, InteractiveButtonComponent, InviteGuild, InvitesPattern, LabelComponent, LinkButtonComponent, MediaChannel, MediaGalleryComponent, MediaGalleryItem, MentionableSelectMenuComponent, Message, MessageFlagsBitField, MessageManager, MessageMentions, MessagePayload, MessageReaction, Mixin, MultiDispatchAction, MultiDispatchHandlers, NullCache, NumberFlagsBitField, Partials, PermissionOverwriteManager, PermissionOverwrites, PermissionsBitField, Poll, PollAnswer, PollAnswerVoterManager, PremiumButtonComponent, Presence, PresenceManager, PrivateThreadChannel, PublicThreadChannel, RadioGroupComponent, ReactionEmoji, ReactionManager, ReactionUserManager, RegisterAsGatewayListener, RichPresenceAssets, Role, RoleFlagsBitField, RoleManager, RoleSelectMenuComponent, SectionComponent, SeparatorComponent, SoundboardSound, StageChannel, StageInstance, StageInstanceManager, Sticker, StickerPack, StringSelectMenuComponent, Structure, StructureMixin, SweepableEntityNames, Sweepers, SystemChannelFlagsBitField, TextChannel, TextChannelMixin, TextDisplayComponent, TextGuildChannelMixin, TextInputComponent, ThreadChannelMemberManager, ThreadChannelMixin, ThreadManager, ThreadMember, ThreadMemberManager, ThreadOnlyChannelMixin, ThumbnailComponent, Typing, UnfurledMediaItem, User, UserFlagsBitField, UserManager, UserSelectMenuComponent, VoiceChannel, VoiceChannelMixin, VoiceState, VoiceStateManager, Webhook, WebhookManager, WebhookMixin, WelcomeScreen, Widget, WidgetMember, basename, bindClient, cacheWithLimits, cleanCodeBlockContent, cleanContent, compareRolePositions, computeCachedPermissionsIn, computeCachedTargetPermissions, computeChannelPermissions, computeGuildPermissions, computePermissionsIn, computePositions, computeTargetPermissions, createChannel, createComponent, createInvite, discordSort, dispatchPartition, fillGuildId, findComponentByCustomId, findName, flatten, getGatewayClient, getSortableGroupTypes, initStructure, isDeepEqual, isThreadChannelType, kClient, kClone, kData, kPatch, kPatchRelations, kRelations, lazyRelation, makeError, makePlainError, moveElementInArray, parseEmoji, parseWebhookURL, requireGuild, requireMe, resolveBase64, resolveCode, resolveColor, resolveFile, resolveGuildTemplateCode, resolveId, resolveImage, resolveImageOption, resolveInviteCode, resolveOverwriteOptions, resolvePartialEmoji, resolveSKUId, sameOverwrites, snakeCase, snowflakeTimestamp, toAPIOverwrite, toChannelBody, toSnakeCase, transformAPIAuditLogChange, transformAPIAutoModerationAction, transformAPIAutoModerationRuleTriggerMetadata, transformAPIAvatarDecorationData, transformAPIChannelMention, transformAPIEmbedAsset, transformAPIEmbedAuthor, transformAPIEmbedFooter, transformAPIGuildDefaultReaction, transformAPIGuildForumTag, transformAPIGuildScheduledEventEntityMetadata, transformAPIGuildScheduledEventRecurrenceRule, transformAPIIncidentsData, transformAPIMessageActivity, transformAPIMessageCall, transformAPIMessageInteractionMetadata, transformAPIMessageReference, transformAPIMessageSharedClientTheme, transformAPIRoleSubscriptionData, transformAPIRoleTags, transformAPIUserPrimaryGuild, transformAutoModerationAction, transformAutoModerationRuleTriggerMetadata, transformCollectibles, transformGuildDefaultReaction, transformGuildForumTag, transformGuildScheduledEventRecurrenceRule, transformResolved, verifyString, withGuildId };
18337
+ export { Action, ActionRow, ActionsManager, Activity, ActivityFlagsBitField, AnnouncementChannel, AnnouncementThreadChannel, AnonymousGuild, ApplicationFlagsBitField, AppliedTagsMixin, Attachment, AttachmentBuilder, AttachmentFlagsBitField, AutoModerationActionExecution, AutoModerationRule, AutoModerationRuleManager, BaseChannel, BaseChannelMixin, BaseInvite, BaseManager, BitField, CachedManager, CategoryChannel, CategoryChannelChildManager, Channel, ChannelFlagsBitField, ChannelManager, ChannelMessageManager, ChannelOwnerMixin, ChannelParentMixin, ChannelPermissionMixin, ChannelSelectMenuComponent, ChannelSlowmodeMixin, ChannelThreadManager, ChannelThreadsMixin, ChannelTopicMixin, ChannelWebhooksMixin, CheckboxComponent, CheckboxGroupComponent, ClientUser, CollectionCache, Colors, Component, ComponentMixin, ContainerComponent, DMChannel, DMChannelMixin, DataManager, DefaultSweeperSettings, DispatchAction, DispatchHandlers, DispatchQueue, DispatchStateCodecs, DispatchTimeoutError, Embed, Emoji, EntityStoreCache, EventGatewayListener, FileComponent, FileUploadComponent, ForumChannel, GatewayClient, GatewayError, GatewayErrorCodes, GatewayErrorMessages, GatewayEvents, GatewayRangeError, GatewaySessionStoreError, GatewayTypeError, GroupDMChannel, GroupDMInvite, GroupDMMixin, Guild, GuildAuditLogsEntry, GuildBan, GuildBanManager, GuildChannelFields, GuildChannelInfoTimeoutError, GuildChannelManager, GuildChannelMixin, GuildEmoji, GuildEmojiManager, GuildEmojiRoleManager, GuildIntegrationManager, GuildInvite, GuildInviteManager, GuildManager, GuildMember, GuildMemberFlagsBitField, GuildMemberManager, GuildMemberRoleManager, GuildMembersRateLimitError, GuildMembersTimeoutError, GuildOnboarding, GuildOnboardingPrompt, GuildOnboardingPromptOption, GuildPreview, GuildScheduledEvent, GuildScheduledEventManager, GuildSoundboardSoundManager, GuildSoundboardSoundsTimeoutError, GuildStickerManager, GuildTemplate, GuildTemplateManager, GuildTemplatesPattern, Integration, IntentsBitField, InteractiveButtonComponent, InviteGuild, InvitesPattern, LabelComponent, LinkButtonComponent, MediaChannel, MediaGalleryComponent, MediaGalleryItem, MentionableSelectMenuComponent, Message, MessageFlagsBitField, MessageManager, MessageMentions, MessagePayload, MessageReaction, Mixin, MultiDispatchAction, MultiDispatchHandlers, NullCache, NumberFlagsBitField, Partials, PermissionOverwriteManager, PermissionOverwrites, PermissionsBitField, Poll, PollAnswer, PollAnswerVoterManager, PremiumButtonComponent, Presence, PresenceManager, PrivateThreadChannel, PublicThreadChannel, RadioGroupComponent, ReactionEmoji, ReactionManager, ReactionUserManager, RegisterAsGatewayListener, RichPresenceAssets, Role, RoleFlagsBitField, RoleManager, RoleSelectMenuComponent, SectionComponent, SeparatorComponent, SoundboardSound, StageChannel, StageInstance, StageInstanceManager, Sticker, StickerPack, StringSelectMenuComponent, Structure, StructureMixin, SweepableEntityNames, Sweepers, SystemChannelFlagsBitField, TextChannel, TextChannelMixin, TextDisplayComponent, TextGuildChannelMixin, TextInputComponent, ThreadChannelMemberManager, ThreadChannelMixin, ThreadManager, ThreadMember, ThreadMemberManager, ThreadOnlyChannelMixin, ThumbnailComponent, Typing, UnfurledMediaItem, User, UserFlagsBitField, UserManager, UserSelectMenuComponent, VoiceChannel, VoiceChannelMixin, VoiceState, VoiceStateManager, Webhook, WebhookManager, WebhookMixin, WelcomeScreen, Widget, WidgetMember, basename, bindClient, cacheWithLimits, cleanCodeBlockContent, cleanContent, compareRolePositions, computeCachedPermissionsIn, computeCachedTargetPermissions, computeChannelPermissions, computeGuildPermissions, computePermissionsIn, computePositions, computeTargetPermissions, createChannel, createComponent, createInvite, discordSort, dispatchPartition, fillGuildId, findComponentByCustomId, findName, flatten, getGatewayClient, getSortableGroupTypes, initStructure, isDeepEqual, isThreadChannelType, kClient, kClone, kData, kPatch, kPatchRelations, kRelations, lazyRelation, makeError, makePlainError, moveElementInArray, parseEmoji, parseWebhookURL, requireGuild, requireMe, resolveBase64, resolveCode, resolveColor, resolveFile, resolveGuildTemplateCode, resolveId, resolveImage, resolveImageOption, resolveInviteCode, resolveOverwriteOptions, resolvePartialEmoji, resolveSKUId, sameOverwrites, snakeCase, snowflakeTimestamp, toAPIOverwrite, toChannelBody, toSnakeCase, transformAPIAuditLogChange, transformAPIAutoModerationAction, transformAPIAutoModerationRuleTriggerMetadata, transformAPIAvatarDecorationData, transformAPIChannelMention, transformAPIEmbedAsset, transformAPIEmbedAuthor, transformAPIEmbedFooter, transformAPIGuildDefaultReaction, transformAPIGuildForumTag, transformAPIGuildScheduledEventEntityMetadata, transformAPIGuildScheduledEventRecurrenceRule, transformAPIIncidentsData, transformAPIMessageActivity, transformAPIMessageCall, transformAPIMessageInteractionMetadata, transformAPIMessageReference, transformAPIMessageSharedClientTheme, transformAPIRoleSubscriptionData, transformAPIRoleTags, transformAPIUserPrimaryGuild, transformAutoModerationAction, transformAutoModerationRuleTriggerMetadata, transformCollectibles, transformGuildDefaultReaction, transformGuildForumTag, transformGuildScheduledEventRecurrenceRule, transformResolved, verifyString, withGuildId };
18173
18338
  //# sourceMappingURL=index.js.map