seyfert 4.5.0 → 4.6.0

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 (175) hide show
  1. package/lib/api/Routes/guilds.d.ts +12 -1
  2. package/lib/api/Routes/index.d.ts +3 -1
  3. package/lib/api/Routes/invites.d.ts +1 -1
  4. package/lib/api/Routes/oauth2.d.ts +11 -0
  5. package/lib/api/Routes/oauth2.js +2 -0
  6. package/lib/api/Routes/skus.d.ts +11 -4
  7. package/lib/api/Routes/users.d.ts +2 -1
  8. package/lib/api/Routes/voice.d.ts +4 -0
  9. package/lib/api/Routes/webhooks.d.ts +1 -1
  10. package/lib/api/api.d.ts +15 -5
  11. package/lib/api/api.js +243 -114
  12. package/lib/api/bucket.js +13 -7
  13. package/lib/api/shared.d.ts +3 -1
  14. package/lib/api/utils/constants.d.ts +1 -1
  15. package/lib/api/utils/constants.js +1 -1
  16. package/lib/builders/Attachment.d.ts +6 -1
  17. package/lib/builders/Attachment.js +13 -9
  18. package/lib/builders/CheckboxGroup.js +1 -1
  19. package/lib/builders/FileUpload.d.ts +8 -1
  20. package/lib/builders/FileUpload.js +9 -0
  21. package/lib/builders/RadioGroup.js +1 -1
  22. package/lib/client/base.d.ts +3 -3
  23. package/lib/client/collectors.d.ts +10 -8
  24. package/lib/client/transformers.d.ts +5 -0
  25. package/lib/client/workerclient.d.ts +8 -1
  26. package/lib/client/workerclient.js +28 -9
  27. package/lib/commands/applications/chat.d.ts +6 -4
  28. package/lib/commands/applications/options.d.ts +6 -4
  29. package/lib/commands/applications/shared.d.ts +2 -2
  30. package/lib/commands/handle.d.ts +7 -3
  31. package/lib/commands/handle.js +36 -11
  32. package/lib/commands/handler.js +11 -0
  33. package/lib/commands/optionresolver.d.ts +6 -7
  34. package/lib/common/it/error.d.ts +13 -0
  35. package/lib/common/it/error.js +15 -1
  36. package/lib/common/it/logger.js +12 -9
  37. package/lib/common/shorters/application.d.ts +1 -1
  38. package/lib/common/shorters/application.js +1 -1
  39. package/lib/common/shorters/bans.js +1 -1
  40. package/lib/common/shorters/guilds.js +5 -1
  41. package/lib/common/shorters/interaction.js +7 -4
  42. package/lib/common/shorters/invites.d.ts +5 -0
  43. package/lib/common/shorters/members.js +2 -1
  44. package/lib/common/shorters/messages.js +2 -2
  45. package/lib/common/shorters/threads.js +1 -1
  46. package/lib/common/shorters/webhook.js +3 -3
  47. package/lib/common/types/util.d.ts +7 -0
  48. package/lib/components/componentcommand.js +2 -2
  49. package/lib/components/customId.d.ts +3 -0
  50. package/lib/components/customId.js +11 -0
  51. package/lib/components/handler.js +2 -3
  52. package/lib/components/modalcommand.js +2 -2
  53. package/lib/events/hooks/invite.d.ts +1 -0
  54. package/lib/events/hooks/presence.d.ts +1 -0
  55. package/lib/events/hooks/thread.d.ts +1 -0
  56. package/lib/structures/AnonymousGuild.d.ts +1 -1
  57. package/lib/structures/AnonymousGuild.js +1 -1
  58. package/lib/structures/Guild.d.ts +3 -0
  59. package/lib/structures/GuildMember.d.ts +2 -2
  60. package/lib/structures/GuildMember.js +22 -4
  61. package/lib/structures/GuildPreview.d.ts +1 -1
  62. package/lib/structures/GuildPreview.js +1 -1
  63. package/lib/structures/GuildRole.d.ts +13 -0
  64. package/lib/structures/GuildRole.js +21 -0
  65. package/lib/structures/GuildTemplate.js +1 -1
  66. package/lib/structures/Interaction.d.ts +7 -7
  67. package/lib/structures/Interaction.js +35 -21
  68. package/lib/structures/Message.d.ts +2 -1
  69. package/lib/structures/channels.d.ts +29 -16
  70. package/lib/structures/channels.js +59 -19
  71. package/lib/structures/extra/BaseGuild.d.ts +4 -4
  72. package/lib/structures/extra/BaseGuild.js +4 -4
  73. package/lib/types/gateway.d.ts +243 -239
  74. package/lib/types/index.d.ts +2 -2
  75. package/lib/types/payloads/_interactions/_applicationCommands/_chatInput/attachment.d.ts +5 -2
  76. package/lib/types/payloads/_interactions/_applicationCommands/_chatInput/shared.d.ts +2 -2
  77. package/lib/types/payloads/_interactions/_applicationCommands/_chatInput/shared.js +1 -1
  78. package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +7 -7
  79. package/lib/types/payloads/_interactions/_applicationCommands/contextMenu.d.ts +13 -13
  80. package/lib/types/payloads/_interactions/_applicationCommands/permissions.d.ts +4 -4
  81. package/lib/types/payloads/_interactions/_applicationCommands/permissions.js +2 -2
  82. package/lib/types/payloads/_interactions/applicationCommands.d.ts +10 -10
  83. package/lib/types/payloads/_interactions/applicationCommands.js +4 -4
  84. package/lib/types/payloads/_interactions/autocomplete.d.ts +2 -2
  85. package/lib/types/payloads/_interactions/base.d.ts +13 -7
  86. package/lib/types/payloads/_interactions/modalSubmit.d.ts +4 -4
  87. package/lib/types/payloads/_interactions/responses.d.ts +10 -10
  88. package/lib/types/payloads/_interactions/responses.js +2 -2
  89. package/lib/types/payloads/application.d.ts +21 -15
  90. package/lib/types/payloads/application.js +7 -7
  91. package/lib/types/payloads/auditLog.d.ts +22 -17
  92. package/lib/types/payloads/auditLog.js +7 -2
  93. package/lib/types/payloads/autoModeration.d.ts +11 -11
  94. package/lib/types/payloads/autoModeration.js +5 -5
  95. package/lib/types/payloads/channel.d.ts +87 -78
  96. package/lib/types/payloads/channel.js +16 -11
  97. package/lib/types/payloads/components.d.ts +41 -31
  98. package/lib/types/payloads/components.js +9 -5
  99. package/lib/types/payloads/emoji.d.ts +2 -2
  100. package/lib/types/payloads/emoji.js +1 -1
  101. package/lib/types/payloads/gateway.d.ts +33 -29
  102. package/lib/types/payloads/gateway.js +5 -5
  103. package/lib/types/payloads/guild.d.ts +68 -68
  104. package/lib/types/payloads/guild.js +14 -14
  105. package/lib/types/payloads/guildScheduledEvent.d.ts +11 -11
  106. package/lib/types/payloads/guildScheduledEvent.js +3 -3
  107. package/lib/types/payloads/index.d.ts +2 -2
  108. package/lib/types/payloads/interactions.d.ts +3 -3
  109. package/lib/types/payloads/invite.d.ts +11 -11
  110. package/lib/types/payloads/invite.js +3 -3
  111. package/lib/types/payloads/monetization.d.ts +4 -4
  112. package/lib/types/payloads/monetization.js +2 -2
  113. package/lib/types/payloads/oauth2.d.ts +21 -17
  114. package/lib/types/payloads/oauth2.js +21 -17
  115. package/lib/types/payloads/permissions.d.ts +5 -5
  116. package/lib/types/payloads/permissions.js +2 -2
  117. package/lib/types/payloads/poll.d.ts +7 -7
  118. package/lib/types/payloads/poll.js +2 -2
  119. package/lib/types/payloads/soundboard.d.ts +2 -2
  120. package/lib/types/payloads/soundboard.js +1 -1
  121. package/lib/types/payloads/stageInstance.d.ts +5 -5
  122. package/lib/types/payloads/stageInstance.js +1 -1
  123. package/lib/types/payloads/sticker.d.ts +8 -8
  124. package/lib/types/payloads/sticker.js +3 -3
  125. package/lib/types/payloads/teams.d.ts +8 -8
  126. package/lib/types/payloads/teams.js +3 -3
  127. package/lib/types/payloads/template.d.ts +3 -3
  128. package/lib/types/payloads/template.js +1 -1
  129. package/lib/types/payloads/user.d.ts +24 -22
  130. package/lib/types/payloads/user.js +7 -5
  131. package/lib/types/payloads/voice.d.ts +4 -4
  132. package/lib/types/payloads/voice.js +1 -1
  133. package/lib/types/payloads/webhokEvents.d.ts +5 -5
  134. package/lib/types/payloads/webhokEvents.js +2 -2
  135. package/lib/types/payloads/webhook.d.ts +4 -4
  136. package/lib/types/payloads/webhook.js +1 -1
  137. package/lib/types/rest/application.d.ts +14 -14
  138. package/lib/types/rest/auditLog.d.ts +1 -1
  139. package/lib/types/rest/autoModeration.d.ts +7 -7
  140. package/lib/types/rest/channel.d.ts +79 -74
  141. package/lib/types/rest/channel.js +1 -1
  142. package/lib/types/rest/emoji.d.ts +8 -8
  143. package/lib/types/rest/gateway.d.ts +2 -2
  144. package/lib/types/rest/guild.d.ts +98 -98
  145. package/lib/types/rest/guild.js +5 -5
  146. package/lib/types/rest/guildScheduledEvent.d.ts +11 -11
  147. package/lib/types/rest/index.d.ts +34 -3
  148. package/lib/types/rest/index.js +33 -2
  149. package/lib/types/rest/interactions.d.ts +48 -48
  150. package/lib/types/rest/invite.d.ts +5 -5
  151. package/lib/types/rest/monetization.d.ts +9 -9
  152. package/lib/types/rest/monetization.js +1 -1
  153. package/lib/types/rest/oauth2.d.ts +22 -18
  154. package/lib/types/rest/poll.d.ts +4 -4
  155. package/lib/types/rest/soundboard.d.ts +8 -8
  156. package/lib/types/rest/stageInstance.d.ts +6 -6
  157. package/lib/types/rest/sticker.d.ts +10 -10
  158. package/lib/types/rest/template.d.ts +11 -11
  159. package/lib/types/rest/user.d.ts +18 -14
  160. package/lib/types/rest/voice.d.ts +5 -5
  161. package/lib/types/rest/webhook.d.ts +38 -38
  162. package/lib/types/utils/index.d.ts +19 -19
  163. package/lib/types/utils/index.js +19 -19
  164. package/lib/websocket/SharedTypes.d.ts +2 -2
  165. package/lib/websocket/constants/index.js +2 -2
  166. package/lib/websocket/discord/heartbeater.d.ts +1 -0
  167. package/lib/websocket/discord/heartbeater.js +8 -0
  168. package/lib/websocket/discord/shard.d.ts +19 -10
  169. package/lib/websocket/discord/shard.js +254 -121
  170. package/lib/websocket/discord/sharder.d.ts +2 -2
  171. package/lib/websocket/discord/sharder.js +1 -1
  172. package/lib/websocket/discord/shared.d.ts +7 -2
  173. package/lib/websocket/discord/workermanager.d.ts +3 -1
  174. package/lib/websocket/discord/workermanager.js +31 -24
  175. package/package.json +2 -2
@@ -94,6 +94,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
94
94
  title: x.title,
95
95
  description: x.description,
96
96
  filename: x.filename,
97
+ is_spoiler: x.spoiler,
97
98
  };
98
99
  }
99
100
  return {
@@ -103,10 +104,20 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
103
104
  });
104
105
  }
105
106
  else if (files?.length) {
106
- payload.attachments = files?.map(({ filename }, i) => ({
107
- id: i.toString(),
108
- filename,
109
- }));
107
+ payload.attachments = files.map((file, i) => {
108
+ if (file instanceof builders_1.AttachmentBuilder)
109
+ return { id: i.toString(), ...(0, builders_1.resolveAttachment)(file) };
110
+ if (file instanceof builders_1.Attachment) {
111
+ return {
112
+ id: i.toString(),
113
+ title: file.title,
114
+ description: file.description,
115
+ filename: file.filename,
116
+ is_spoiler: file.spoiler,
117
+ };
118
+ }
119
+ return { id: i.toString(), filename: file.filename };
120
+ });
110
121
  }
111
122
  return payload;
112
123
  }
@@ -118,7 +129,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
118
129
  const data = body.data instanceof builders_1.Modal ? body.data : rest;
119
130
  const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : undefined;
120
131
  await (this.replied = this.__reply({
121
- body: BaseInteraction.transformBodyRequest({ data, type: body.type }, parsedFiles, this.client),
132
+ body: BaseInteraction.transformBodyRequest({ data, type: body.type }, files, this.client),
122
133
  files: parsedFiles,
123
134
  }).then(() => (this.replied = true)));
124
135
  return;
@@ -353,6 +364,7 @@ class EntryPointInteraction extends ApplicationCommandInteraction {
353
364
  const response = await this.client.proxy
354
365
  .interactions(this.id)(this.token)
355
366
  .callback.post({
367
+ auth: false,
356
368
  body,
357
369
  query: { with_response: true },
358
370
  });
@@ -446,13 +458,15 @@ class MentionableSelectMenuInteraction extends SelectMenuInteraction {
446
458
  super(client, interaction);
447
459
  this.__reply = __reply;
448
460
  const resolved = interaction.data.resolved;
449
- this.roles = resolved.roles
450
- ? this.values.map(x => transformers_1.Transformers.GuildRole(this.client, resolved.roles[x], this.guildId))
451
- : [];
452
- this.members = resolved.members
453
- ? this.values.map(x => transformers_1.Transformers.InteractionGuildMember(this.client, resolved.members[x], resolved.users[this.values.find(u => u === x)], this.guildId))
454
- : [];
455
- this.users = resolved.users ? this.values.map(x => transformers_1.Transformers.User(this.client, resolved.users[x])) : [];
461
+ this.roles = this.values
462
+ .filter(x => resolved.roles?.[x])
463
+ .map(x => transformers_1.Transformers.GuildRole(this.client, resolved.roles[x], this.guildId));
464
+ this.members = this.values
465
+ .filter(x => resolved.members?.[x])
466
+ .map(x => transformers_1.Transformers.InteractionGuildMember(this.client, resolved.members[x], resolved.users[x], this.guildId));
467
+ this.users = this.values
468
+ .filter(x => resolved.users?.[x])
469
+ .map(x => transformers_1.Transformers.User(this.client, resolved.users[x]));
456
470
  }
457
471
  isMentionableSelectMenu() {
458
472
  return true;
@@ -482,9 +496,9 @@ class UserSelectMenuInteraction extends SelectMenuInteraction {
482
496
  this.__reply = __reply;
483
497
  const resolved = interaction.data.resolved;
484
498
  this.users = this.values.map(x => transformers_1.Transformers.User(this.client, resolved.users[x]));
485
- this.members = resolved.members
486
- ? this.values.map(x => transformers_1.Transformers.InteractionGuildMember(this.client, resolved.members[x], resolved.users[this.values.find(u => u === x)], this.guildId))
487
- : [];
499
+ this.members = this.values
500
+ .filter(x => resolved.members?.[x])
501
+ .map(x => transformers_1.Transformers.InteractionGuildMember(this.client, resolved.members[x], resolved.users[x], this.guildId));
488
502
  }
489
503
  isUserSelectMenu() {
490
504
  return true;
@@ -632,14 +646,14 @@ let ModalSubmitInteraction = class ModalSubmitInteraction extends BaseInteractio
632
646
  return value;
633
647
  }
634
648
  getFiles(customId, required) {
635
- const value = this.getComponent(customId, [types_1.ComponentType.FileUpload]);
636
- if (value) {
649
+ const component = this.getComponent(customId, [types_1.ComponentType.FileUpload]);
650
+ if (component && 'values' in component) {
637
651
  const attachments = this.data.resolved?.attachments;
638
652
  if (attachments) {
639
- return Object.values(attachments).map(x => new builders_1.Attachment(this.client, {
640
- ...x,
641
- proxy_url: x.url,
642
- }));
653
+ return component.values
654
+ .map(x => attachments[x])
655
+ .filter((x) => !!x)
656
+ .map(x => new builders_1.Attachment(this.client, { ...x, proxy_url: x.url }));
643
657
  }
644
658
  if (required)
645
659
  throw new common_1.SeyfertError('INTERNAL_ERROR', {
@@ -6,13 +6,14 @@ import { type ObjectToLower } from '../common';
6
6
  import type { EmojiResolvable } from '../common/types/resolvables';
7
7
  import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../common/types/write';
8
8
  import type { TopLevelComponents } from '../components';
9
- import type { APIChannelMention, APIEmbed, APIMessage, GatewayMessageCreateDispatchData } from '../types';
9
+ import type { APIChannelMention, APIEmbed, APIMessage, GatewayMessageCreateDispatchData, TextChannelType } from '../types';
10
10
  import { DiscordBase } from './extra/DiscordBase';
11
11
  import type { MessageWebhookMethodEditParams, MessageWebhookMethodWriteParams } from './Webhook';
12
12
  export type MessageData = APIMessage | GatewayMessageCreateDispatchData;
13
13
  export interface BaseMessage extends DiscordBase, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll' | 'embeds'>> {
14
14
  timestamp?: number;
15
15
  guildId?: string;
16
+ channelType?: TextChannelType;
16
17
  author: UserStructure;
17
18
  member?: GuildMemberStructure;
18
19
  components: TopLevelComponents[];
@@ -1,15 +1,15 @@
1
- import { Collection, type RawFile, type ReturnCache } from '..';
1
+ import { Collection, type ReturnCache } from '..';
2
2
  import type { Overwrites } from '../cache/resources/overwrites';
3
- import { type BaseChannelStructure, type BaseGuildChannelStructure, type CategoryChannelStructure, type DirectoryChannelStructure, type DMChannelStructure, type ForumChannelStructure, type GuildMemberStructure, type GuildStructure, type MediaChannelStructure, type MessageStructure, type NewsChannelStructure, type StageChannelStructure, type TextGuildChannelStructure, type ThreadChannelStructure, type UserStructure, type VoiceChannelStructure, type VoiceStateStructure, type WebhookStructure } from '../client';
3
+ import { type BaseChannelStructure, type BaseGuildChannelStructure, type CategoryChannelStructure, type DirectoryChannelStructure, type DMChannelStructure, type ForumChannelStructure, type GroupDMChannelStructure, type GuildMemberStructure, type GuildStructure, type MediaChannelStructure, type MessageStructure, type NewsChannelStructure, type StageChannelStructure, type TextGuildChannelStructure, type ThreadChannelStructure, type UserStructure, type VoiceChannelStructure, type VoiceStateStructure, type WebhookStructure } from '../client';
4
4
  import type { SeyfertChannelMap, UsingClient } from '../commands';
5
- import { type ChannelShorterOverwriteBody, type CreateInviteFromChannel, type EmojiResolvable, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MethodContext, type ObjectToLower, type StringToNumber, type ThreadOnlyCreateBodyRequest, type ToClass } from '../common';
6
- import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildChannel, type APIGuildForumChannel, type APIGuildForumDefaultReactionEmoji, type APIGuildForumTag, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, ChannelType, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTGetAPIChannelMessagesPinsQuery, type RESTGetAPIChannelMessagesQuery, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIGuildChannelPositionsJSONBody, type RESTPostAPIChannelWebhookJSONBody, type RESTPostAPIGuildChannelJSONBody, type SortOrderType, type ThreadAutoArchiveDuration, VideoQualityMode } from '../types';
5
+ import { type ChannelShorterOverwriteBody, type CreateInviteFromChannel, type EmojiResolvable, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MethodContext, type ObjectToLower, type ResolverProps, type StringToNumber, type ThreadOnlyCreateBodyRequest, type ToClass } from '../common';
6
+ import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildChannel, type APIGuildForumChannel, type APIGuildForumDefaultReactionEmoji, type APIGuildForumTag, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APIInteractionDataResolvedChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, ChannelType, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTGetAPIChannelMessagesPinsQuery, type RESTGetAPIChannelMessagesQuery, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIGuildChannelPositionsJSONBody, type RESTPostAPIChannelWebhookJSONBody, type RESTPostAPIGuildChannelJSONBody, type SortOrderType, type ThreadAutoArchiveDuration, VideoQualityMode } from '../types';
7
7
  import { DiscordBase } from './extra/DiscordBase';
8
+ import { PermissionsBitField } from './extra/Permissions';
8
9
  import type { GuildMember } from './GuildMember';
9
10
  import type { GuildRole } from './GuildRole';
10
11
  export declare class BaseNoEditableChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
11
12
  type: T;
12
- constructor(client: UsingClient, data: APIChannelBase<ChannelType>);
13
13
  static __intent__(id: '@me'): 'DirectMessages';
14
14
  static __intent__(id: string): 'DirectMessages' | 'Guilds';
15
15
  /** The URL to the channel */
@@ -156,6 +156,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
156
156
  slug?: string | undefined;
157
157
  coverImage?: string | undefined;
158
158
  flags?: import("../types").ApplicationFlags | undefined;
159
+ flagsNew?: string | undefined;
159
160
  approximateGuildCount?: number | undefined;
160
161
  approximateUserInstallCount?: number | undefined;
161
162
  redirectUris?: string[] | undefined;
@@ -329,6 +330,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
329
330
  slug?: string | undefined;
330
331
  coverImage?: string | undefined;
331
332
  flags?: import("../types").ApplicationFlags | undefined;
333
+ flagsNew?: string | undefined;
332
334
  approximateGuildCount?: number | undefined;
333
335
  approximateUserInstallCount?: number | undefined;
334
336
  redirectUris?: string[] | undefined;
@@ -484,6 +486,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
484
486
  slug?: string | undefined;
485
487
  coverImage?: string | undefined;
486
488
  flags?: import("../types").ApplicationFlags | undefined;
489
+ flagsNew?: string | undefined;
487
490
  approximateGuildCount?: number | undefined;
488
491
  approximateUserInstallCount?: number | undefined;
489
492
  redirectUris?: string[] | undefined;
@@ -563,28 +566,28 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
563
566
  edit: (overwriteId: string, body: ChannelShorterOverwriteBody, reason?: string) => Promise<void>;
564
567
  delete: (overwriteId: string, reason?: string) => Promise<void>;
565
568
  };
566
- memberPermissions(member: GuildMember, checkAdmin?: boolean): Promise<import("./extra/Permissions").PermissionsBitField>;
567
- rolePermissions(role: GuildRole, checkAdmin?: boolean): Promise<import("./extra/Permissions").PermissionsBitField>;
569
+ memberPermissions(member: GuildMember, checkAdmin?: boolean): Promise<PermissionsBitField>;
570
+ rolePermissions(role: GuildRole, checkAdmin?: boolean): Promise<PermissionsBitField>;
568
571
  overwritesFor(member: GuildMember): Promise<{
569
572
  everyone: {
570
573
  type: import("../types").OverwriteType;
571
574
  id: string;
572
- deny: import("./extra/Permissions").PermissionsBitField;
573
- allow: import("./extra/Permissions").PermissionsBitField;
575
+ deny: PermissionsBitField;
576
+ allow: PermissionsBitField;
574
577
  guildId: string;
575
578
  } | undefined;
576
579
  roles: {
577
580
  type: import("../types").OverwriteType;
578
581
  id: string;
579
- deny: import("./extra/Permissions").PermissionsBitField;
580
- allow: import("./extra/Permissions").PermissionsBitField;
582
+ deny: PermissionsBitField;
583
+ allow: PermissionsBitField;
581
584
  guildId: string;
582
585
  }[];
583
586
  member: {
584
587
  type: import("../types").OverwriteType;
585
588
  id: string;
586
- deny: import("./extra/Permissions").PermissionsBitField;
587
- allow: import("./extra/Permissions").PermissionsBitField;
589
+ deny: PermissionsBitField;
590
+ allow: PermissionsBitField;
588
591
  guildId: string;
589
592
  } | undefined;
590
593
  }>;
@@ -659,12 +662,13 @@ export declare class MessagesMethods extends DiscordBase {
659
662
  set: (messageId: string, reason?: string) => Promise<undefined>;
660
663
  delete: (messageId: string, reason?: string) => Promise<undefined>;
661
664
  };
662
- static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest, files: RawFile[] | undefined, self: UsingClient): T;
665
+ static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest, files: ResolverProps['files'], self: UsingClient): T;
663
666
  }
664
667
  export interface TextBaseGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites' | 'guild_id'>>, MessagesMethods {
665
668
  }
666
669
  export declare class TextBaseGuildChannel extends BaseGuildChannel {
667
670
  }
671
+ export declare function channelFrom<T extends APIInteractionDataResolvedChannel>(data: T, client: UsingClient): ResolvedChannel<SeyfertChannelMap[T['type'] & keyof SeyfertChannelMap]>;
668
672
  export declare function channelFrom(data: APIChannelBase<ChannelType>, client: UsingClient): AllChannels;
669
673
  export interface TopicableGuildChannel extends BaseChannel<ChannelType> {
670
674
  }
@@ -788,9 +792,18 @@ export declare class NewsChannel extends BaseGuildChannel {
788
792
  export declare class DirectoryChannel extends BaseChannel<ChannelType.GuildDirectory> {
789
793
  }
790
794
  export type AllGuildChannels = TextGuildChannelStructure | VoiceChannelStructure | MediaChannelStructure | ForumChannelStructure | ThreadChannelStructure | CategoryChannelStructure | NewsChannelStructure | DirectoryChannelStructure | StageChannelStructure;
791
- export type AllTextableChannels = TextGuildChannelStructure | VoiceChannelStructure | DMChannelStructure | NewsChannelStructure | ThreadChannelStructure;
795
+ export type AllTextableChannels = TextGuildChannelStructure | VoiceChannelStructure | DMChannelStructure | GroupDMChannelStructure | NewsChannelStructure | ThreadChannelStructure;
792
796
  export type AllGuildTextableChannels = TextGuildChannelStructure | VoiceChannelStructure | NewsChannelStructure | ThreadChannelStructure;
793
797
  export type AllGuildVoiceChannels = VoiceChannelStructure | StageChannelStructure;
794
- export type AllChannels = BaseChannelStructure | BaseGuildChannelStructure | TextGuildChannelStructure | DMChannelStructure | VoiceChannelStructure | MediaChannelStructure | ForumChannelStructure | ThreadChannelStructure | CategoryChannelStructure | NewsChannelStructure | DirectoryChannelStructure | StageChannelStructure;
798
+ export type AllChannels = BaseChannelStructure | BaseGuildChannelStructure | TextGuildChannelStructure | DMChannelStructure | GroupDMChannelStructure | VoiceChannelStructure | MediaChannelStructure | ForumChannelStructure | ThreadChannelStructure | CategoryChannelStructure | NewsChannelStructure | DirectoryChannelStructure | StageChannelStructure;
799
+ export interface ResolvedChannelPermissions {
800
+ /** Computed permissions for the invoking user in the resolved guild channel. */
801
+ permissions: PermissionsBitField;
802
+ /** Computed permissions for the bot user in the resolved guild channel. */
803
+ appPermissions?: PermissionsBitField;
804
+ }
805
+ type WithResolvedChannelPermissions<T extends AllChannels, Permissions extends Partial<ResolvedChannelPermissions>> = T extends AllGuildChannels | BaseGuildChannelStructure ? T & Permissions : T;
806
+ export type ResolvedChannel<T extends AllChannels = SeyfertChannelMap[keyof SeyfertChannelMap]> = WithResolvedChannelPermissions<T, ResolvedChannelPermissions>;
807
+ export type MaybeResolvedChannel<T extends AllChannels = SeyfertChannelMap[keyof SeyfertChannelMap]> = WithResolvedChannelPermissions<T, Partial<ResolvedChannelPermissions>>;
795
808
  export type GuildChannelTypes = ChannelType.GuildAnnouncement | ChannelType.GuildVoice | ChannelType.GuildText | ChannelType.GuildStageVoice | ChannelType.GuildForum | ChannelType.GuildMedia | ChannelType.GuildCategory | ChannelType.AnnouncementThread | ChannelType.PrivateThread | ChannelType.PublicThread;
796
809
  export {};
@@ -15,10 +15,8 @@ const common_1 = require("../common");
15
15
  const mixer_1 = require("../deps/mixer");
16
16
  const types_1 = require("../types");
17
17
  const DiscordBase_1 = require("./extra/DiscordBase");
18
+ const Permissions_1 = require("./extra/Permissions");
18
19
  class BaseNoEditableChannel extends DiscordBase_1.DiscordBase {
19
- constructor(client, data) {
20
- super(client, data);
21
- }
22
20
  static __intent__(id) {
23
21
  return id === '@me' ? 'DirectMessages' : 'Guilds';
24
22
  }
@@ -224,6 +222,7 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
224
222
  title: x.title,
225
223
  description: x.description,
226
224
  filename: x.filename,
225
+ is_spoiler: x.spoiler,
227
226
  };
228
227
  }
229
228
  return {
@@ -233,10 +232,20 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
233
232
  }) ?? undefined;
234
233
  }
235
234
  else if (files?.length) {
236
- payload.attachments = files?.map(({ filename }, i) => ({
237
- id: i.toString(),
238
- filename,
239
- }));
235
+ payload.attachments = files.map((file, i) => {
236
+ if (file instanceof builders_1.AttachmentBuilder)
237
+ return { id: i.toString(), ...(0, builders_1.resolveAttachment)(file) };
238
+ if (file instanceof builders_1.Attachment) {
239
+ return {
240
+ id: i.toString(),
241
+ title: file.title,
242
+ description: file.description,
243
+ filename: file.filename,
244
+ is_spoiler: file.spoiler,
245
+ };
246
+ }
247
+ return { id: i.toString(), filename: file.filename };
248
+ });
240
249
  }
241
250
  return payload;
242
251
  }
@@ -249,36 +258,67 @@ exports.TextBaseGuildChannel = TextBaseGuildChannel = __decorate([
249
258
  (0, mixer_1.mix)(MessagesMethods)
250
259
  ], TextBaseGuildChannel);
251
260
  function channelFrom(data, client) {
261
+ let channel;
252
262
  switch (data.type) {
253
263
  case types_1.ChannelType.GuildStageVoice:
254
- return client_1.Transformers.StageChannel(client, data);
264
+ channel = client_1.Transformers.StageChannel(client, data);
265
+ break;
255
266
  case types_1.ChannelType.GuildMedia:
256
- return client_1.Transformers.MediaChannel(client, data);
267
+ channel = client_1.Transformers.MediaChannel(client, data);
268
+ break;
257
269
  case types_1.ChannelType.DM:
258
- return client_1.Transformers.DMChannel(client, data);
270
+ case types_1.ChannelType.GroupDM:
271
+ channel = client_1.Transformers.DMChannel(client, data);
272
+ break;
259
273
  case types_1.ChannelType.GuildForum:
260
- return client_1.Transformers.ForumChannel(client, data);
274
+ channel = client_1.Transformers.ForumChannel(client, data);
275
+ break;
261
276
  case types_1.ChannelType.AnnouncementThread:
262
277
  case types_1.ChannelType.PrivateThread:
263
278
  case types_1.ChannelType.PublicThread:
264
- return client_1.Transformers.ThreadChannel(client, data);
279
+ channel = client_1.Transformers.ThreadChannel(client, data);
280
+ break;
265
281
  case types_1.ChannelType.GuildDirectory:
266
- return client_1.Transformers.DirectoryChannel(client, data);
282
+ channel = client_1.Transformers.DirectoryChannel(client, data);
283
+ break;
267
284
  case types_1.ChannelType.GuildVoice:
268
- return client_1.Transformers.VoiceChannel(client, data);
285
+ channel = client_1.Transformers.VoiceChannel(client, data);
286
+ break;
269
287
  case types_1.ChannelType.GuildText:
270
- return client_1.Transformers.TextGuildChannel(client, data);
288
+ channel = client_1.Transformers.TextGuildChannel(client, data);
289
+ break;
271
290
  case types_1.ChannelType.GuildCategory:
272
- return client_1.Transformers.CategoryChannel(client, data);
291
+ channel = client_1.Transformers.CategoryChannel(client, data);
292
+ break;
273
293
  case types_1.ChannelType.GuildAnnouncement:
274
- return client_1.Transformers.NewsChannel(client, data);
294
+ channel = client_1.Transformers.NewsChannel(client, data);
295
+ break;
275
296
  default: {
276
297
  if ('guild_id' in data) {
277
- return client_1.Transformers.BaseGuildChannel(client, data);
298
+ channel = client_1.Transformers.BaseGuildChannel(client, data);
299
+ }
300
+ else {
301
+ channel = client_1.Transformers.BaseChannel(client, data);
278
302
  }
279
- return client_1.Transformers.BaseChannel(client, data);
280
303
  }
281
304
  }
305
+ if (channel.type !== types_1.ChannelType.DM &&
306
+ channel.type !== types_1.ChannelType.GroupDM &&
307
+ 'permissions' in data &&
308
+ typeof data.permissions === 'string') {
309
+ const appPermissions = 'app_permissions' in data && typeof data.app_permissions === 'string'
310
+ ? data.app_permissions
311
+ : 'appPermissions' in data
312
+ ? data.appPermissions
313
+ : undefined;
314
+ Object.assign(channel, {
315
+ permissions: new Permissions_1.PermissionsBitField(BigInt(data.permissions)),
316
+ ...(typeof appPermissions === 'string'
317
+ ? { appPermissions: new Permissions_1.PermissionsBitField(BigInt(appPermissions)) }
318
+ : {}),
319
+ });
320
+ }
321
+ return channel;
282
322
  }
283
323
  class TopicableGuildChannel extends DiscordBase_1.DiscordBase {
284
324
  setTopic(topic, reason) {
@@ -13,7 +13,7 @@ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
13
13
  get partnered(): boolean;
14
14
  /**
15
15
  * If the guild is verified.
16
- * @link https://discord.com/developers/docs/resources/guild#guild-object-guild-features
16
+ * @link https://docs.discord.com/developers/resources/guild#guild-object-guild-features
17
17
  */
18
18
  get verified(): boolean;
19
19
  /**
@@ -27,19 +27,19 @@ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
27
27
  leave(): Promise<void | undefined>;
28
28
  /**
29
29
  * iconURL gets the current guild icon.
30
- * @link https://discord.com/developers/docs/reference#image-formatting
30
+ * @link https://docs.discord.com/developers/reference#image-formatting
31
31
  */
32
32
  iconURL(options?: ImageOptions): string | undefined;
33
33
  /**
34
34
  * splashURL gets the current guild splash as a string.
35
- * @link https://discord.com/developers/docs/reference#image-formatting
35
+ * @link https://docs.discord.com/developers/reference#image-formatting
36
36
  * @param options - Image options for the splash url.
37
37
  * @returns Splash url or void.
38
38
  */
39
39
  splashURL(options?: ImageOptions): string | undefined;
40
40
  /**
41
41
  * bannerURL gets the current guild banner as a string.
42
- * @link https://discord.com/developers/docs/reference#image-formatting
42
+ * @link https://docs.discord.com/developers/reference#image-formatting
43
43
  * @param options - Image options for the banner url.
44
44
  * @returns Banner url or void
45
45
  */
@@ -16,7 +16,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
16
16
  }
17
17
  /**
18
18
  * If the guild is verified.
19
- * @link https://discord.com/developers/docs/resources/guild#guild-object-guild-features
19
+ * @link https://docs.discord.com/developers/resources/guild#guild-object-guild-features
20
20
  */
21
21
  get verified() {
22
22
  if (!this.features) {
@@ -41,7 +41,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
41
41
  }
42
42
  /**
43
43
  * iconURL gets the current guild icon.
44
- * @link https://discord.com/developers/docs/reference#image-formatting
44
+ * @link https://docs.discord.com/developers/reference#image-formatting
45
45
  */
46
46
  iconURL(options) {
47
47
  if (!this.icon)
@@ -50,7 +50,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
50
50
  }
51
51
  /**
52
52
  * splashURL gets the current guild splash as a string.
53
- * @link https://discord.com/developers/docs/reference#image-formatting
53
+ * @link https://docs.discord.com/developers/reference#image-formatting
54
54
  * @param options - Image options for the splash url.
55
55
  * @returns Splash url or void.
56
56
  */
@@ -61,7 +61,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
61
61
  }
62
62
  /**
63
63
  * bannerURL gets the current guild banner as a string.
64
- * @link https://discord.com/developers/docs/reference#image-formatting
64
+ * @link https://docs.discord.com/developers/reference#image-formatting
65
65
  * @param options - Image options for the banner url.
66
66
  * @returns Banner url or void
67
67
  */