seyfert 1.2.2 → 1.3.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 (162) hide show
  1. package/LICENSE +190 -190
  2. package/README.md +46 -46
  3. package/lib/api/Router.d.ts +9 -0
  4. package/lib/api/Router.js +16 -8
  5. package/lib/api/Routes/cdn.d.ts +26 -15
  6. package/lib/api/Routes/channels.d.ts +15 -1
  7. package/lib/api/api.d.ts +2 -3
  8. package/lib/api/api.js +4 -9
  9. package/lib/api/index.d.ts +0 -1
  10. package/lib/api/index.js +0 -1
  11. package/lib/api/utils/utils.d.ts +1 -1
  12. package/lib/api/utils/utils.js +2 -2
  13. package/lib/builders/Modal.d.ts +4 -1
  14. package/lib/builders/Modal.js +4 -1
  15. package/lib/builders/Poll.d.ts +16 -0
  16. package/lib/builders/Poll.js +48 -0
  17. package/lib/builders/index.d.ts +1 -0
  18. package/lib/builders/index.js +1 -0
  19. package/lib/cache/adapters/default.d.ts +1 -0
  20. package/lib/cache/adapters/default.js +4 -0
  21. package/lib/cache/adapters/index.d.ts +1 -0
  22. package/lib/cache/adapters/index.js +1 -0
  23. package/lib/cache/adapters/limited.d.ts +50 -0
  24. package/lib/cache/adapters/limited.js +188 -0
  25. package/lib/cache/adapters/redis.d.ts +2 -0
  26. package/lib/cache/adapters/redis.js +17 -0
  27. package/lib/cache/adapters/types.d.ts +1 -0
  28. package/lib/cache/adapters/workeradapter.d.ts +1 -0
  29. package/lib/cache/adapters/workeradapter.js +6 -9
  30. package/lib/cache/index.d.ts +8 -3
  31. package/lib/cache/index.js +41 -7
  32. package/lib/cache/resources/channels.d.ts +2 -1
  33. package/lib/cache/resources/default/base.d.ts +3 -3
  34. package/lib/cache/resources/default/base.js +8 -3
  35. package/lib/cache/resources/default/guild-based.d.ts +2 -1
  36. package/lib/cache/resources/default/guild-based.js +7 -3
  37. package/lib/cache/resources/default/guild-related.d.ts +2 -1
  38. package/lib/cache/resources/default/guild-related.js +7 -3
  39. package/lib/cache/resources/emojis.d.ts +2 -0
  40. package/lib/cache/resources/emojis.js +4 -0
  41. package/lib/cache/resources/guilds.d.ts +2 -0
  42. package/lib/cache/resources/guilds.js +4 -0
  43. package/lib/cache/resources/members.d.ts +2 -0
  44. package/lib/cache/resources/members.js +5 -1
  45. package/lib/cache/resources/messages.d.ts +15 -0
  46. package/lib/cache/resources/messages.js +53 -0
  47. package/lib/cache/resources/overwrites.d.ts +4 -0
  48. package/lib/cache/resources/overwrites.js +4 -0
  49. package/lib/cache/resources/presence.d.ts +1 -0
  50. package/lib/cache/resources/presence.js +4 -0
  51. package/lib/cache/resources/roles.d.ts +2 -0
  52. package/lib/cache/resources/roles.js +4 -0
  53. package/lib/cache/resources/stage-instances.d.ts +1 -0
  54. package/lib/cache/resources/stage-instances.js +5 -1
  55. package/lib/cache/resources/stickers.d.ts +2 -0
  56. package/lib/cache/resources/stickers.js +4 -0
  57. package/lib/cache/resources/threads.d.ts +2 -0
  58. package/lib/cache/resources/threads.js +4 -0
  59. package/lib/cache/resources/users.d.ts +2 -0
  60. package/lib/cache/resources/users.js +4 -0
  61. package/lib/cache/resources/voice-states.d.ts +2 -1
  62. package/lib/cache/resources/voice-states.js +8 -4
  63. package/lib/client/base.d.ts +26 -14
  64. package/lib/client/base.js +41 -13
  65. package/lib/client/client.d.ts +6 -5
  66. package/lib/client/client.js +13 -1
  67. package/lib/client/oninteractioncreate.js +2 -2
  68. package/lib/client/onmessagecreate.js +17 -14
  69. package/lib/client/workerclient.d.ts +3 -3
  70. package/lib/client/workerclient.js +23 -14
  71. package/lib/collection.d.ts +8 -3
  72. package/lib/collection.js +22 -4
  73. package/lib/commands/applications/chat.d.ts +17 -20
  74. package/lib/commands/applications/chat.js +6 -21
  75. package/lib/commands/applications/chatcontext.d.ts +1 -1
  76. package/lib/commands/applications/menucontext.d.ts +1 -1
  77. package/lib/commands/applications/shared.d.ts +4 -0
  78. package/lib/commands/applications/shared.js +6 -0
  79. package/lib/commands/decorators.d.ts +11 -1
  80. package/lib/commands/decorators.js +24 -0
  81. package/lib/commands/handler.d.ts +11 -7
  82. package/lib/commands/handler.js +43 -14
  83. package/lib/common/index.d.ts +2 -0
  84. package/lib/common/index.js +2 -0
  85. package/lib/common/it/utils.d.ts +0 -1
  86. package/lib/common/it/utils.js +0 -1
  87. package/lib/common/shorters/channels.d.ts +8 -3
  88. package/lib/common/shorters/channels.js +27 -12
  89. package/lib/common/shorters/guilds.d.ts +6 -5
  90. package/lib/common/shorters/guilds.js +22 -4
  91. package/lib/common/shorters/interaction.d.ts +13 -0
  92. package/lib/common/shorters/interaction.js +61 -0
  93. package/lib/common/shorters/messages.d.ts +6 -3
  94. package/lib/common/shorters/messages.js +33 -15
  95. package/lib/common/shorters/roles.d.ts +3 -3
  96. package/lib/common/shorters/roles.js +12 -17
  97. package/lib/common/shorters/templates.d.ts +7 -6
  98. package/lib/common/shorters/templates.js +28 -6
  99. package/lib/common/shorters/threads.d.ts +39 -0
  100. package/lib/common/shorters/threads.js +76 -0
  101. package/lib/common/shorters/webhook.d.ts +1 -1
  102. package/lib/common/shorters/webhook.js +8 -2
  103. package/lib/common/types/options.d.ts +2 -2
  104. package/lib/common/types/write.d.ts +8 -5
  105. package/lib/components/ButtonComponent.js +1 -1
  106. package/lib/components/componentcontext.d.ts +1 -1
  107. package/lib/components/handler.d.ts +6 -17
  108. package/lib/components/handler.js +7 -2
  109. package/lib/events/handler.d.ts +8 -14
  110. package/lib/events/handler.js +9 -4
  111. package/lib/events/hooks/guild.d.ts +1 -1
  112. package/lib/events/hooks/guild.js +2 -2
  113. package/lib/events/hooks/message.d.ts +26 -8
  114. package/lib/events/hooks/message.js +18 -7
  115. package/lib/langs/handler.d.ts +4 -8
  116. package/lib/langs/handler.js +7 -2
  117. package/lib/structures/AutoModerationRule.d.ts +6 -6
  118. package/lib/structures/Guild.d.ts +15 -13
  119. package/lib/structures/GuildEmoji.d.ts +2 -2
  120. package/lib/structures/GuildEmoji.js +1 -1
  121. package/lib/structures/GuildMember.js +1 -1
  122. package/lib/structures/GuildRole.d.ts +5 -5
  123. package/lib/structures/GuildTemplate.d.ts +10 -10
  124. package/lib/structures/Interaction.d.ts +3 -3
  125. package/lib/structures/Interaction.js +27 -48
  126. package/lib/structures/Message.d.ts +5 -3
  127. package/lib/structures/Message.js +5 -0
  128. package/lib/structures/Poll.d.ts +15 -0
  129. package/lib/structures/Poll.js +26 -0
  130. package/lib/structures/User.d.ts +2 -3
  131. package/lib/structures/User.js +9 -4
  132. package/lib/structures/Webhook.d.ts +2 -2
  133. package/lib/structures/Webhook.js +1 -1
  134. package/lib/structures/channels.d.ts +11 -3
  135. package/lib/structures/channels.js +16 -8
  136. package/lib/structures/extra/BaseGuild.js +3 -3
  137. package/lib/structures/extra/Permissions.d.ts +1 -0
  138. package/lib/structures/index.d.ts +1 -0
  139. package/lib/structures/index.js +1 -0
  140. package/lib/websocket/SharedTypes.d.ts +7 -2
  141. package/lib/websocket/discord/worker.d.ts +1 -1
  142. package/lib/websocket/discord/workermanager.js +3 -9
  143. package/lib/websocket/structures/timeout.js +9 -12
  144. package/package.json +8 -8
  145. package/lib/api/CDN.d.ts +0 -212
  146. package/lib/api/CDN.js +0 -228
  147. package/lib/client/http/adapters/bun.d.ts +0 -14
  148. package/lib/client/http/adapters/bun.js +0 -117
  149. package/lib/client/http/adapters/index.d.ts +0 -15
  150. package/lib/client/http/adapters/index.js +0 -27
  151. package/lib/client/http/adapters/uws.d.ts +0 -17
  152. package/lib/client/http/adapters/uws.js +0 -142
  153. package/lib/client/http/httpclient.d.ts +0 -13
  154. package/lib/client/http/httpclient.js +0 -48
  155. package/lib/common/shorters/overwrites.d.ts +0 -29
  156. package/lib/common/shorters/overwrites.js +0 -63
  157. package/lib/components/listener.d.ts +0 -11
  158. package/lib/components/listener.js +0 -17
  159. package/lib/structures/extra/BaseComponent.d.ts +0 -9
  160. package/lib/structures/extra/BaseComponent.js +0 -12
  161. package/lib/structures/extra/BaseSelectMenuComponent.d.ts +0 -9
  162. package/lib/structures/extra/BaseSelectMenuComponent.js +0 -13
@@ -17,11 +17,10 @@ export declare class User extends DiscordBase<APIUser> {
17
17
  dm(force?: boolean): Promise<import("./channels").DMChannel>;
18
18
  write(body: MessageCreateBodyRequest): Promise<import("./Message").Message>;
19
19
  avatarURL(options?: ImageOptions): string;
20
+ avatarDecorationURL(options?: ImageOptions): string | undefined;
20
21
  bannerURL(options?: ImageOptions): string | undefined;
21
22
  presence(): import("..").ReturnCache<(Omit<import("discord-api-types/v10").GatewayPresenceUpdate, "user"> & {
22
- id: string; /**
23
- * Fetch user
24
- */
23
+ id: string;
25
24
  } & {
26
25
  guild_id: string;
27
26
  }) | undefined>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.User = void 0;
4
+ const api_1 = require("../api");
4
5
  const DiscordBase_1 = require("./extra/DiscordBase");
5
6
  class User extends DiscordBase_1.DiscordBase {
6
7
  get tag() {
@@ -26,15 +27,19 @@ class User extends DiscordBase_1.DiscordBase {
26
27
  }
27
28
  avatarURL(options) {
28
29
  if (!this.avatar) {
29
- const avatarIndex = this.discriminator === '0' ? Number(BigInt(this.id) >> 22n) % 6 : Number.parseInt(this.discriminator) % 5;
30
- return this.rest.cdn.defaultAvatar(avatarIndex);
30
+ return this.rest.cdn.embed.avatars.get((0, api_1.calculateUserDefaultAvatarIndex)(this.id, this.discriminator));
31
31
  }
32
- return this.rest.cdn.avatar(this.id, this.avatar, options);
32
+ return this.rest.cdn.avatars(this.id).get(this.avatar, options);
33
+ }
34
+ avatarDecorationURL(options) {
35
+ if (!this.avatarDecoration)
36
+ return;
37
+ return this.rest.cdn['avatar-decorations'](this.id).get(this.avatarDecoration, options);
33
38
  }
34
39
  bannerURL(options) {
35
40
  if (!this.banner)
36
41
  return;
37
- return this.rest.cdn.banner(this.id, this.banner, options);
42
+ return this.rest.cdn.banners(this.id).get(this.banner, options);
38
43
  }
39
44
  presence() {
40
45
  return this.client.members.presence(this.id);
@@ -54,7 +54,7 @@ export declare class Webhook extends DiscordBase {
54
54
  * @param reason The reason for editing the webhook.
55
55
  * @returns A promise that resolves when the webhook is successfully edited.
56
56
  */
57
- edit(body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody, reason?: string): Promise<import("discord-api-types/v10").RESTGetAPIWebhookWithTokenResult>;
57
+ edit(body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody, reason?: string): Promise<Webhook>;
58
58
  /**
59
59
  * Deletes the webhook.
60
60
  * @param reason The reason for deleting the webhook.
@@ -85,7 +85,7 @@ export declare class Webhook extends DiscordBase {
85
85
  /** Deletes the webhook. */
86
86
  delete: (reason?: string) => Promise<never>;
87
87
  /** Edits the webhook. */
88
- edit: (body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, reason?: string) => Promise<import("discord-api-types/v10").RESTGetAPIWebhookWithTokenResult>;
88
+ edit: (body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, reason?: string) => Promise<Webhook>;
89
89
  /** Fetches the webhook data from the Discord API. */
90
90
  fetch: () => Promise<Webhook>;
91
91
  };
@@ -60,7 +60,7 @@ class Webhook extends DiscordBase_1.DiscordBase {
60
60
  if (!this.avatar) {
61
61
  return null;
62
62
  }
63
- return this.rest.cdn.avatar(this.id, this.avatar, options);
63
+ return this.rest.cdn.avatars(this.id).get(this.avatar, options);
64
64
  }
65
65
  /**
66
66
  * Fetches the webhook data from the Discord API.
@@ -64,12 +64,14 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
64
64
  id: string;
65
65
  deny: import("./extra/Permissions").PermissionsBitField;
66
66
  allow: import("./extra/Permissions").PermissionsBitField;
67
+ guildId: string;
67
68
  }[] | undefined>;
68
69
  values: () => {
69
70
  type: number;
70
71
  id: string;
71
72
  deny: import("./extra/Permissions").PermissionsBitField;
72
73
  allow: import("./extra/Permissions").PermissionsBitField;
74
+ guildId: string;
73
75
  }[][];
74
76
  };
75
77
  memberPermissions(member: GuildMember, checkAdmin?: boolean): Promise<import("./extra/Permissions").PermissionsBitField>;
@@ -80,18 +82,21 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
80
82
  id: string;
81
83
  deny: import("./extra/Permissions").PermissionsBitField;
82
84
  allow: import("./extra/Permissions").PermissionsBitField;
85
+ guildId: string;
83
86
  } | undefined;
84
87
  roles: {
85
88
  type: number;
86
89
  id: string;
87
90
  deny: import("./extra/Permissions").PermissionsBitField;
88
91
  allow: import("./extra/Permissions").PermissionsBitField;
92
+ guildId: string;
89
93
  }[];
90
94
  member: {
91
95
  type: number;
92
96
  id: string;
93
97
  deny: import("./extra/Permissions").PermissionsBitField;
94
98
  allow: import("./extra/Permissions").PermissionsBitField;
99
+ guildId: string;
95
100
  } | undefined;
96
101
  }>;
97
102
  guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
@@ -110,7 +115,7 @@ export declare class MessagesMethods extends DiscordBase {
110
115
  crosspost: (messageId: string, reason?: string) => Promise<import("./Message").Message>;
111
116
  delete: (messageId: string, reason?: string) => Promise<void>;
112
117
  fetch: (messageId: string) => Promise<import("./Message").Message>;
113
- purge: (messages: string[], reason?: string) => Promise<never>;
118
+ purge: (messages: string[], reason?: string) => Promise<void | undefined>;
114
119
  };
115
120
  pins: {
116
121
  fetch: () => Promise<import("./Message").Message[]>;
@@ -131,7 +136,7 @@ export declare class MessagesMethods extends DiscordBase {
131
136
  crosspost: (messageId: string, reason?: string) => Promise<import("./Message").Message>;
132
137
  delete: (messageId: string, reason?: string) => Promise<void>;
133
138
  fetch: (messageId: string) => Promise<import("./Message").Message>;
134
- purge: (messages: string[], reason?: string) => Promise<never>;
139
+ purge: (messages: string[], reason?: string) => Promise<void | undefined>;
135
140
  };
136
141
  static reactions(ctx: MethodContext<{
137
142
  channelId: string;
@@ -178,6 +183,7 @@ export declare class VoiceChannelMethods extends DiscordBase {
178
183
  setUserLimit(user_limit: number | null, reason?: string): Promise<AllChannels>;
179
184
  setRTC(rtc_region: string | null, reason?: string): Promise<AllChannels>;
180
185
  setVideoQuality(quality: keyof typeof VideoQualityMode, reason?: string): Promise<AllChannels>;
186
+ setVoiceState(status?: string | null): Promise<never>;
181
187
  states(): Promise<import("./VoiceState").VoiceState[]>;
182
188
  }
183
189
  export declare class WebhookGuildMethods extends DiscordBase {
@@ -243,6 +249,8 @@ export declare class ThreadChannel extends BaseChannel<ChannelType.PublicThread
243
249
  list: () => Promise<import("./Webhook").Webhook[]>;
244
250
  create: (body: RESTPostAPIChannelWebhookJSONBody) => Promise<import("./Webhook").Webhook>;
245
251
  };
252
+ join(): Promise<this>;
253
+ leave(): Promise<this>;
246
254
  setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<AllChannels>;
247
255
  pin(reason?: string): Promise<AllChannels>;
248
256
  unpin(reason?: string): Promise<AllChannels>;
@@ -262,7 +270,7 @@ export interface NewsChannel extends ObjectToLower<APINewsChannel>, WebhookChann
262
270
  }
263
271
  export declare class NewsChannel extends BaseChannel<ChannelType.GuildAnnouncement> {
264
272
  type: ChannelType.GuildAnnouncement;
265
- addFollower(webhook_channel_id: string, reason?: string): Promise<import("discord-api-types/v10").APIFollowedChannel>;
273
+ addFollower(webhookChannelId: string, reason?: string): Promise<import("discord-api-types/v10").APIFollowedChannel>;
266
274
  }
267
275
  export declare class DirectoryChannel extends BaseChannel<ChannelType.GuildDirectory> {
268
276
  }
@@ -160,11 +160,13 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
160
160
  };
161
161
  }
162
162
  static transformMessageBody(body) {
163
+ const poll = body.poll;
163
164
  return {
164
165
  ...body,
165
- components: body.components?.map(x => ('toJSON' in x ? x.toJSON() : x)) ?? undefined,
166
+ components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
166
167
  embeds: body.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
167
168
  attachments: body.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) })) ?? undefined,
169
+ poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
168
170
  };
169
171
  }
170
172
  }
@@ -251,6 +253,9 @@ class VoiceChannelMethods extends DiscordBase_1.DiscordBase {
251
253
  setVideoQuality(quality, reason) {
252
254
  return this.edit({ video_quality_mode: v10_1.VideoQualityMode[quality] }, reason);
253
255
  }
256
+ setVoiceState(status = null) {
257
+ return this.client.channels.setVoiceStatus(this.id, status);
258
+ }
254
259
  async states() {
255
260
  if (!this.guildId)
256
261
  return [];
@@ -328,6 +333,14 @@ let ThreadChannel = class ThreadChannel extends BaseChannel {
328
333
  client: this.client,
329
334
  channelId: this.parentId,
330
335
  });
336
+ async join() {
337
+ await this.client.threads.join(this.id);
338
+ return this;
339
+ }
340
+ async leave() {
341
+ await this.client.threads.leave(this.id);
342
+ return this;
343
+ }
331
344
  setRatelimitPerUser(rate_limit_per_user) {
332
345
  return this.edit({ rate_limit_per_user });
333
346
  }
@@ -365,13 +378,8 @@ class CategoryChannel extends BaseGuildChannel {
365
378
  }
366
379
  exports.CategoryChannel = CategoryChannel;
367
380
  let NewsChannel = class NewsChannel extends BaseChannel {
368
- addFollower(webhook_channel_id, reason) {
369
- return this.api.channels(this.id).followers.post({
370
- body: {
371
- webhook_channel_id,
372
- },
373
- reason,
374
- });
381
+ addFollower(webhookChannelId, reason) {
382
+ return this.client.guilds.channels.addFollower(this.id, webhookChannelId, reason);
375
383
  }
376
384
  };
377
385
  exports.NewsChannel = NewsChannel;
@@ -38,7 +38,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
38
38
  if (!this.icon) {
39
39
  return;
40
40
  }
41
- return this.rest.cdn.icon(this.id, this.icon, options);
41
+ return this.rest.cdn.icons(this.id).get(this.icon, options);
42
42
  }
43
43
  /**
44
44
  * splashURL gets the current guild splash as a string.
@@ -50,7 +50,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
50
50
  if (!this.splash) {
51
51
  return;
52
52
  }
53
- return this.rest.cdn.discoverySplash(this.id, this.splash, options);
53
+ return this.rest.cdn['discovery-splashes'](this.id).get(this.splash, options);
54
54
  }
55
55
  /**
56
56
  * bannerURL gets the current guild banner as a string.
@@ -62,7 +62,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
62
62
  if (!this.banner) {
63
63
  return;
64
64
  }
65
- return this.rest.cdn.banner(this.id, this.banner, options);
65
+ return this.rest.cdn.banners(this.id).get(this.banner, options);
66
66
  }
67
67
  toString() {
68
68
  return this.name;
@@ -51,6 +51,7 @@ export declare class PermissionsBitField extends BitField<typeof PermissionFlags
51
51
  readonly CreateEvents: bigint;
52
52
  readonly UseExternalSounds: bigint;
53
53
  readonly SendVoiceMessages: bigint;
54
+ readonly SendPolls: bigint;
54
55
  };
55
56
  static All: bigint;
56
57
  keys: (bits?: BitFieldResolvable<typeof PermissionFlagsBits>[]) => PermissionStrings;
@@ -14,3 +14,4 @@ export * from './User';
14
14
  export * from './VoiceState';
15
15
  export * from './Webhook';
16
16
  export * from './channels';
17
+ export * from './Poll';
@@ -30,3 +30,4 @@ __exportStar(require("./User"), exports);
30
30
  __exportStar(require("./VoiceState"), exports);
31
31
  __exportStar(require("./Webhook"), exports);
32
32
  __exportStar(require("./channels"), exports);
33
+ __exportStar(require("./Poll"), exports);
@@ -1,4 +1,4 @@
1
- import { type APIAuditLogEntry, type APIAutoModerationRule, type APIChannel, type APIEntitlement, type APIGuild, type APIGuildMember, type APIGuildScheduledEvent, type APIStageInstance, type APIUser, type GatewayActivity, type GatewayAutoModerationActionExecutionDispatchData, type GatewayChannelPinsUpdateDispatchData, type GatewayChannelUpdateDispatchData, GatewayDispatchEvents, type GatewayGuildBanAddDispatchData, type GatewayGuildBanRemoveDispatchData, type GatewayGuildCreateDispatchData, type GatewayGuildDeleteDispatchData, type GatewayGuildEmojisUpdateDispatchData, type GatewayGuildIntegrationsUpdateDispatchData, type GatewayGuildMemberRemoveDispatchData, type GatewayGuildMemberUpdateDispatchData, type GatewayGuildMembersChunkDispatchData, type GatewayGuildRoleCreateDispatchData, type GatewayGuildRoleDeleteDispatchData, type GatewayGuildRoleUpdateDispatchData, type GatewayGuildScheduledEventUserRemoveDispatchData, type GatewayGuildStickersUpdateDispatchData, type GatewayIntegrationCreateDispatchData, type GatewayIntegrationDeleteDispatchData, type GatewayInteractionCreateDispatchData, type GatewayInviteCreateDispatchData, type GatewayInviteDeleteDispatchData, type GatewayMessageCreateDispatchData, type GatewayMessageDeleteBulkDispatchData, type GatewayMessageDeleteDispatchData, type GatewayMessageReactionAddDispatchData, type GatewayMessageReactionRemoveAllDispatchData, type GatewayMessageReactionRemoveDispatchData, type GatewayMessageReactionRemoveEmojiDispatchData, type GatewayMessageUpdateDispatchData, type GatewayPresenceUpdateData, type GatewayPresenceUpdateDispatchData, type GatewayReadyDispatchData, type GatewayRequestGuildMembersDataWithQuery, type GatewayRequestGuildMembersDataWithUserIds, type GatewayThreadCreateDispatchData, type GatewayThreadDeleteDispatchData, type GatewayThreadListSyncDispatchData, type GatewayThreadMemberUpdateDispatchData, type GatewayThreadMembersUpdateDispatchData, type GatewayTypingStartDispatchData, type GatewayUserUpdateDispatchData, type GatewayVoiceServerUpdateDispatchData, type GatewayVoiceStateUpdateData, type GatewayWebhooksUpdateDispatchData, type PresenceUpdateStatus } from 'discord-api-types/v10';
1
+ import { type APIAuditLogEntry, type APIAutoModerationRule, type APIChannel, type APIEntitlement, type APIGuild, type APIGuildMember, type APIGuildScheduledEvent, type APIStageInstance, type APIUser, type GatewayActivity, type GatewayAutoModerationActionExecutionDispatchData, type GatewayChannelPinsUpdateDispatchData, type GatewayChannelUpdateDispatchData, GatewayDispatchEvents, type GatewayGuildBanAddDispatchData, type GatewayGuildBanRemoveDispatchData, type GatewayGuildCreateDispatchData, type GatewayGuildDeleteDispatchData, type GatewayGuildEmojisUpdateDispatchData, type GatewayGuildIntegrationsUpdateDispatchData, type GatewayGuildMemberRemoveDispatchData, type GatewayGuildMemberUpdateDispatchData, type GatewayGuildMembersChunkDispatchData, type GatewayGuildRoleCreateDispatchData, type GatewayGuildRoleDeleteDispatchData, type GatewayGuildRoleUpdateDispatchData, type GatewayGuildScheduledEventUserRemoveDispatchData, type GatewayGuildStickersUpdateDispatchData, type GatewayIntegrationCreateDispatchData, type GatewayIntegrationDeleteDispatchData, type GatewayInteractionCreateDispatchData, type GatewayInviteCreateDispatchData, type GatewayInviteDeleteDispatchData, type GatewayMessageCreateDispatchData, type GatewayMessageDeleteBulkDispatchData, type GatewayMessageDeleteDispatchData, type GatewayMessageReactionAddDispatchData, type GatewayMessageReactionRemoveAllDispatchData, type GatewayMessageReactionRemoveDispatchData, type GatewayMessageReactionRemoveEmojiDispatchData, type GatewayMessageUpdateDispatchData, type GatewayPresenceUpdateData, type GatewayPresenceUpdateDispatchData, type GatewayReadyDispatchData, type GatewayRequestGuildMembersDataWithQuery, type GatewayRequestGuildMembersDataWithUserIds, type GatewayThreadCreateDispatchData, type GatewayThreadDeleteDispatchData, type GatewayThreadListSyncDispatchData, type GatewayThreadMemberUpdateDispatchData, type GatewayThreadMembersUpdateDispatchData, type GatewayTypingStartDispatchData, type GatewayUserUpdateDispatchData, type GatewayVoiceServerUpdateDispatchData, type GatewayVoiceStateUpdateData, type GatewayWebhooksUpdateDispatchData, type PresenceUpdateStatus, type GatewayMessagePollVoteDispatchData } from 'discord-api-types/v10';
2
2
  import type { RestToKeys } from '../common';
3
3
  import type { GatewayGuildMemberAddDispatchDataFixed } from '../structures';
4
4
  /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
@@ -87,6 +87,11 @@ export type StageSameEvents = RestToKeys<[
87
87
  GatewayDispatchEvents.StageInstanceUpdate,
88
88
  GatewayDispatchEvents.StageInstanceDelete
89
89
  ]>;
90
+ export type PollVoteSameEvents = RestToKeys<[
91
+ GatewayMessagePollVoteDispatchData,
92
+ GatewayDispatchEvents.MessagePollVoteRemove,
93
+ GatewayDispatchEvents.MessagePollVoteAdd
94
+ ]>;
90
95
  export type IntegrationSameEvents = RestToKeys<[
91
96
  GatewayIntegrationCreateDispatchData,
92
97
  GatewayDispatchEvents.IntegrationCreate,
@@ -121,7 +126,7 @@ export type EntitlementEvents = RestToKeys<[
121
126
  GatewayDispatchEvents.EntitlementDelete,
122
127
  GatewayDispatchEvents.EntitlementUpdate
123
128
  ]>;
124
- export type NormalizeEvents = Events & AutoModetaractionRuleEvents & ChannelSameEvents & GuildScheduledSameEvents & GuildScheduledUserSameEvents & IntegrationSameEvents & EntitlementEvents & StageSameEvents & {
129
+ export type NormalizeEvents = Events & AutoModetaractionRuleEvents & ChannelSameEvents & GuildScheduledSameEvents & GuildScheduledUserSameEvents & IntegrationSameEvents & EntitlementEvents & PollVoteSameEvents & StageSameEvents & {
125
130
  RAW: GatewayDispatchEvents;
126
131
  };
127
132
  export type GatewayEvents = {
@@ -25,7 +25,7 @@ export type WorkerSendResultPayload = CreateWorkerMessage<'RESULT_PAYLOAD', {
25
25
  }>;
26
26
  export type WorkerSendCacheRequest = CreateWorkerMessage<'CACHE_REQUEST', {
27
27
  nonce: string;
28
- method: 'scan' | 'get' | 'set' | 'patch' | 'values' | 'keys' | 'count' | 'remove' | 'contains' | 'getToRelationship' | 'bulkAddToRelationShip' | 'addToRelationship' | 'removeRelationship' | 'removeToRelationship';
28
+ method: 'scan' | 'get' | 'set' | 'patch' | 'values' | 'keys' | 'count' | 'remove' | 'flush' | 'contains' | 'getToRelationship' | 'bulkAddToRelationShip' | 'addToRelationship' | 'removeRelationship' | 'removeToRelationship';
29
29
  args: any[];
30
30
  }>;
31
31
  export type WorkerSendShardInfo = CreateWorkerMessage<'SHARD_INFO', WorkerShardInfo & {
@@ -310,19 +310,13 @@ class WorkerManager extends Map {
310
310
  return nonce;
311
311
  }
312
312
  generateSendPromise(nonce, message = 'Timeout') {
313
- let resolve = (_) => {
314
- /**/
315
- };
316
- let timeout = -1;
317
- const promise = new Promise((res, rej) => {
318
- resolve = res;
319
- timeout = setTimeout(() => {
313
+ return new Promise((res, rej) => {
314
+ const timeout = setTimeout(() => {
320
315
  this.promises.delete(nonce);
321
316
  rej(new Error(message));
322
317
  }, 60e3);
318
+ this.promises.set(nonce, { resolve: res, timeout });
323
319
  });
324
- this.promises.set(nonce, { resolve, timeout });
325
- return promise;
326
320
  }
327
321
  async send(data, shardId) {
328
322
  const workerId = this.calculateWorkerId(shardId);
@@ -9,18 +9,15 @@ class ConnectTimeout {
9
9
  this.intervalTime = intervalTime;
10
10
  }
11
11
  wait() {
12
- let resolve = (_x) => {
13
- //
14
- };
15
- const promise = new Promise(r => (resolve = r));
16
- if (!this.promises.length) {
17
- this.interval = setInterval(() => {
18
- this.shift();
19
- }, this.intervalTime);
20
- resolve(true);
21
- }
22
- this.promises.push(resolve);
23
- return promise;
12
+ return new Promise(res => {
13
+ if (!this.promises.length) {
14
+ this.interval = setInterval(() => {
15
+ this.shift();
16
+ }, this.intervalTime);
17
+ res(true);
18
+ }
19
+ this.promises.push(res);
20
+ });
24
21
  }
25
22
  shift() {
26
23
  this.promises.shift()?.(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -21,7 +21,7 @@
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
23
  "chokidar": "^3.6.0",
24
- "discord-api-types": "^0.37.76",
24
+ "discord-api-types": "^0.37.81",
25
25
  "magic-bytes.js": "^1.10.0",
26
26
  "ts-mixer": "^6.0.4",
27
27
  "ws": "^8.16.0"
@@ -34,16 +34,16 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@biomejs/biome": "1.6.0",
37
- "@commitlint/cli": "^19.2.1",
38
- "@commitlint/config-conventional": "^19.1.0",
39
- "@types/node": "^20.11.30",
37
+ "@commitlint/cli": "^19.2.2",
38
+ "@commitlint/config-conventional": "^19.2.2",
39
+ "@types/node": "^20.12.7",
40
40
  "@types/ws": "^8.5.10",
41
41
  "husky": "^9.0.11",
42
42
  "lint-staged": "^15.2.2",
43
- "typescript": "^5.4.3"
43
+ "typescript": "^5.4.5"
44
44
  },
45
45
  "optionalDependencies": {
46
- "ioredis": "^5.3.2",
46
+ "ioredis": "^5.4.1",
47
47
  "tweetnacl": "^1.0.3",
48
48
  "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.42.0"
49
49
  },
@@ -71,4 +71,4 @@
71
71
  "url": "https://github.com/socram03"
72
72
  }
73
73
  ]
74
- }
74
+ }
package/lib/api/CDN.d.ts DELETED
@@ -1,212 +0,0 @@
1
- import { type ImageExtension, type ImageSize, type StickerExtension } from './utils/constants.js';
2
- /**
3
- * The options used for image URLs
4
- */
5
- export interface BaseImageURLOptions {
6
- /**
7
- * The extension to use for the image URL
8
- *
9
- * @defaultValue `'webp'`
10
- */
11
- extension?: ImageExtension;
12
- /**
13
- * The size specified in the image URL
14
- */
15
- size?: ImageSize;
16
- }
17
- /**
18
- * The options used for image URLs with animated content
19
- */
20
- export interface ImageURLOptions extends BaseImageURLOptions {
21
- /**
22
- * Whether or not to prefer the static version of an image asset.
23
- */
24
- forceStatic?: boolean;
25
- }
26
- /**
27
- * The options to use when making a CDN URL
28
- */
29
- export interface MakeURLOptions {
30
- /**
31
- * The allowed extensions that can be used
32
- */
33
- allowedExtensions?: readonly string[];
34
- /**
35
- * The extension to use for the image URL
36
- *
37
- * @defaultValue `'webp'`
38
- */
39
- extension?: ImageExtension | StickerExtension | undefined;
40
- /**
41
- * The size specified in the image URL
42
- */
43
- size?: ImageSize;
44
- }
45
- /**
46
- * The CDN link builder
47
- */
48
- export declare class CDN {
49
- private readonly base;
50
- constructor(base?: string);
51
- /**
52
- * Generates an app asset URL for a client's asset.
53
- *
54
- * @param clientId - The client id that has the asset
55
- * @param assetHash - The hash provided by Discord for this asset
56
- * @param options - Optional options for the asset
57
- */
58
- appAsset(clientId: string, assetHash: string, options?: Readonly<BaseImageURLOptions>): string;
59
- /**
60
- * Generates an app icon URL for a client's icon.
61
- *
62
- * @param clientId - The client id that has the icon
63
- * @param iconHash - The hash provided by Discord for this icon
64
- * @param options - Optional options for the icon
65
- */
66
- appIcon(clientId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
67
- /**
68
- * Generates an avatar URL, e.g. for a user or a webhook.
69
- *
70
- * @param id - The id that has the icon
71
- * @param avatarHash - The hash provided by Discord for this avatar
72
- * @param options - Optional options for the avatar
73
- */
74
- avatar(id: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
75
- /**
76
- * Generates a user avatar decoration URL.
77
- *
78
- * @param userId - The id of the user
79
- * @param userAvatarDecoration - The hash provided by Discord for this avatar decoration
80
- * @param options - Optional options for the avatar decoration
81
- */
82
- avatarDecoration(userId: string, userAvatarDecoration: string, options?: Readonly<BaseImageURLOptions>): string;
83
- /**
84
- * Generates a banner URL, e.g. for a user or a guild.
85
- *
86
- * @param id - The id that has the banner splash
87
- * @param bannerHash - The hash provided by Discord for this banner
88
- * @param options - Optional options for the banner
89
- */
90
- banner(id: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
91
- /**
92
- * Generates an icon URL for a channel, e.g. a group DM.
93
- *
94
- * @param channelId - The channel id that has the icon
95
- * @param iconHash - The hash provided by Discord for this channel
96
- * @param options - Optional options for the icon
97
- */
98
- channelIcon(channelId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
99
- /**
100
- * Generates a default avatar URL
101
- *
102
- * @param index - The default avatar index
103
- * @remarks
104
- * To calculate the index for a user do `(userId >> 22) % 6`,
105
- * or `discriminator % 5` if they're using the legacy username system.
106
- */
107
- defaultAvatar(index: number): string;
108
- /**
109
- * Generates a discovery splash URL for a guild's discovery splash.
110
- *
111
- * @param guildId - The guild id that has the discovery splash
112
- * @param splashHash - The hash provided by Discord for this splash
113
- * @param options - Optional options for the splash
114
- */
115
- discoverySplash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
116
- /**
117
- * Generates an emoji's URL for an emoji.
118
- *
119
- * @param emojiId - The emoji id
120
- * @param options - Optional options for the emoji
121
- */
122
- emoji(emojiId: string, options?: Readonly<BaseImageURLOptions>): string;
123
- /**
124
- * Generates a guild member avatar URL.
125
- *
126
- * @param guildId - The id of the guild
127
- * @param userId - The id of the user
128
- * @param avatarHash - The hash provided by Discord for this avatar
129
- * @param options - Optional options for the avatar
130
- */
131
- guildMemberAvatar(guildId: string, userId: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
132
- /**
133
- * Generates a guild member banner URL.
134
- *
135
- * @param guildId - The id of the guild
136
- * @param userId - The id of the user
137
- * @param bannerHash - The hash provided by Discord for this banner
138
- * @param options - Optional options for the banner
139
- */
140
- guildMemberBanner(guildId: string, userId: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
141
- /**
142
- * Generates an icon URL, e.g. for a guild.
143
- *
144
- * @param id - The id that has the icon splash
145
- * @param iconHash - The hash provided by Discord for this icon
146
- * @param options - Optional options for the icon
147
- */
148
- icon(id: string, iconHash: string, options?: Readonly<ImageURLOptions>): string;
149
- /**
150
- * Generates a URL for the icon of a role
151
- *
152
- * @param roleId - The id of the role that has the icon
153
- * @param roleIconHash - The hash provided by Discord for this role icon
154
- * @param options - Optional options for the role icon
155
- */
156
- roleIcon(roleId: string, roleIconHash: string, options?: Readonly<BaseImageURLOptions>): string;
157
- /**
158
- * Generates a guild invite splash URL for a guild's invite splash.
159
- *
160
- * @param guildId - The guild id that has the invite splash
161
- * @param splashHash - The hash provided by Discord for this splash
162
- * @param options - Optional options for the splash
163
- */
164
- splash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
165
- /**
166
- * Generates a sticker URL.
167
- *
168
- * @param stickerId - The sticker id
169
- * @param extension - The extension of the sticker
170
- * @privateRemarks
171
- * Stickers cannot have a `.webp` extension, so we default to a `.png`
172
- */
173
- sticker(stickerId: string, extension?: StickerExtension): string;
174
- /**
175
- * Generates a sticker pack banner URL.
176
- *
177
- * @param bannerId - The banner id
178
- * @param options - Optional options for the banner
179
- */
180
- stickerPackBanner(bannerId: string, options?: Readonly<BaseImageURLOptions>): string;
181
- /**
182
- * Generates a team icon URL for a team's icon.
183
- *
184
- * @param teamId - The team id that has the icon
185
- * @param iconHash - The hash provided by Discord for this icon
186
- * @param options - Optional options for the icon
187
- */
188
- teamIcon(teamId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
189
- /**
190
- * Generates a cover image for a guild scheduled event.
191
- *
192
- * @param scheduledEventId - The scheduled event id
193
- * @param coverHash - The hash provided by discord for this cover image
194
- * @param options - Optional options for the cover image
195
- */
196
- guildScheduledEventCover(scheduledEventId: string, coverHash: string, options?: Readonly<BaseImageURLOptions>): string;
197
- /**
198
- * Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
199
- *
200
- * @param route - The base cdn route
201
- * @param hash - The hash provided by Discord for this icon
202
- * @param options - Optional options for the link
203
- */
204
- private dynamicMakeURL;
205
- /**
206
- * Constructs the URL for the resource
207
- *
208
- * @param route - The base cdn route
209
- * @param options - The extension/size options for the link
210
- */
211
- private makeURL;
212
- }