seyfert 1.3.3 → 1.5.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 (138) hide show
  1. package/README.md +7 -7
  2. package/lib/api/Router.js +3 -1
  3. package/lib/api/Routes/guilds.d.ts +4 -1
  4. package/lib/api/api.js +13 -7
  5. package/lib/builders/Attachment.d.ts +1 -4
  6. package/lib/builders/Attachment.js +4 -4
  7. package/lib/cache/adapters/workeradapter.js +7 -3
  8. package/lib/cache/index.d.ts +6 -2
  9. package/lib/cache/index.js +18 -0
  10. package/lib/cache/resources/bans.d.ts +12 -0
  11. package/lib/cache/resources/bans.js +35 -0
  12. package/lib/cache/resources/default/base.d.ts +1 -2
  13. package/lib/cache/resources/default/guild-based.d.ts +1 -2
  14. package/lib/cache/resources/members.js +4 -4
  15. package/lib/cache/resources/messages.js +8 -6
  16. package/lib/client/base.d.ts +33 -7
  17. package/lib/client/base.js +80 -21
  18. package/lib/client/client.d.ts +18 -6
  19. package/lib/client/client.js +45 -37
  20. package/lib/client/collectors.d.ts +36 -0
  21. package/lib/client/collectors.js +85 -0
  22. package/lib/client/httpclient.d.ts +7 -8
  23. package/lib/client/httpclient.js +96 -17
  24. package/lib/client/oninteractioncreate.d.ts +2 -2
  25. package/lib/client/oninteractioncreate.js +15 -7
  26. package/lib/client/onmessagecreate.d.ts +12 -2
  27. package/lib/client/onmessagecreate.js +105 -82
  28. package/lib/client/workerclient.d.ts +5 -2
  29. package/lib/client/workerclient.js +66 -63
  30. package/lib/collection.d.ts +2 -2
  31. package/lib/collection.js +2 -2
  32. package/lib/commands/applications/chat.d.ts +11 -10
  33. package/lib/commands/applications/chat.js +23 -8
  34. package/lib/commands/applications/chatcontext.d.ts +1 -1
  35. package/lib/commands/applications/chatcontext.js +2 -2
  36. package/lib/commands/applications/menu.d.ts +8 -7
  37. package/lib/commands/applications/menu.js +3 -50
  38. package/lib/commands/applications/menucontext.d.ts +1 -1
  39. package/lib/commands/applications/menucontext.js +3 -3
  40. package/lib/commands/applications/options.d.ts +3 -1
  41. package/lib/commands/applications/shared.d.ts +12 -0
  42. package/lib/commands/basecontext.d.ts +26 -0
  43. package/lib/commands/{basecontex.js → basecontext.js} +24 -0
  44. package/lib/commands/decorators.d.ts +11 -17
  45. package/lib/commands/decorators.js +7 -14
  46. package/lib/commands/handler.d.ts +6 -1
  47. package/lib/commands/handler.js +161 -29
  48. package/lib/common/bot/watcher.d.ts +1 -2
  49. package/lib/common/bot/watcher.js +9 -4
  50. package/lib/common/index.d.ts +1 -0
  51. package/lib/common/index.js +3 -1
  52. package/lib/common/it/formatter.d.ts +155 -0
  53. package/lib/common/it/formatter.js +184 -0
  54. package/lib/common/it/logger.d.ts +1 -1
  55. package/lib/common/it/logger.js +14 -13
  56. package/lib/common/it/utils.d.ts +2 -0
  57. package/lib/common/it/utils.js +21 -9
  58. package/lib/common/shorters/bans.d.ts +43 -0
  59. package/lib/common/shorters/bans.js +78 -0
  60. package/lib/common/shorters/emojis.d.ts +1 -1
  61. package/lib/common/shorters/emojis.js +4 -3
  62. package/lib/common/shorters/interaction.js +9 -7
  63. package/lib/common/shorters/messages.js +2 -2
  64. package/lib/common/shorters/webhook.js +2 -2
  65. package/lib/components/componentcommand.d.ts +22 -0
  66. package/lib/components/{command.js → componentcommand.js} +3 -5
  67. package/lib/components/componentcontext.d.ts +20 -16
  68. package/lib/components/componentcontext.js +27 -9
  69. package/lib/components/handler.d.ts +11 -6
  70. package/lib/components/handler.js +106 -32
  71. package/lib/components/index.d.ts +3 -1
  72. package/lib/components/index.js +3 -1
  73. package/lib/components/modalcommand.d.ts +16 -0
  74. package/lib/components/modalcommand.js +10 -0
  75. package/lib/components/modalcontext.d.ts +104 -0
  76. package/lib/components/modalcontext.js +132 -0
  77. package/lib/events/event.d.ts +4 -3
  78. package/lib/events/handler.d.ts +12 -6
  79. package/lib/events/handler.js +60 -20
  80. package/lib/events/hooks/application_command.d.ts +2 -2
  81. package/lib/events/hooks/auto_moderation.d.ts +5 -5
  82. package/lib/events/hooks/channel.d.ts +5 -5
  83. package/lib/events/hooks/custom.d.ts +3 -3
  84. package/lib/events/hooks/dispatch.d.ts +4 -4
  85. package/lib/events/hooks/entitlement.d.ts +4 -4
  86. package/lib/events/hooks/guild.d.ts +41 -96
  87. package/lib/events/hooks/guild.js +6 -6
  88. package/lib/events/hooks/integration.d.ts +61 -4
  89. package/lib/events/hooks/interactions.d.ts +2 -2
  90. package/lib/events/hooks/invite.d.ts +6 -3
  91. package/lib/events/hooks/message.d.ts +23 -18
  92. package/lib/events/hooks/message.js +1 -1
  93. package/lib/events/hooks/presence.d.ts +11 -3
  94. package/lib/events/hooks/presence.js +2 -2
  95. package/lib/events/hooks/stage.d.ts +7 -13
  96. package/lib/events/hooks/stage.js +2 -2
  97. package/lib/events/hooks/thread.d.ts +21 -10
  98. package/lib/events/hooks/thread.js +2 -2
  99. package/lib/events/hooks/typing.d.ts +3 -2
  100. package/lib/events/hooks/user.d.ts +2 -2
  101. package/lib/events/hooks/user.js +2 -2
  102. package/lib/events/hooks/voice.d.ts +5 -45
  103. package/lib/events/hooks/voice.js +4 -7
  104. package/lib/events/hooks/webhook.d.ts +2 -2
  105. package/lib/index.d.ts +4 -4
  106. package/lib/index.js +11 -5
  107. package/lib/langs/handler.d.ts +4 -1
  108. package/lib/langs/handler.js +3 -3
  109. package/lib/structures/Guild.d.ts +9 -1
  110. package/lib/structures/Guild.js +2 -0
  111. package/lib/structures/GuildBan.d.ts +25 -0
  112. package/lib/structures/GuildBan.js +36 -0
  113. package/lib/structures/GuildEmoji.d.ts +1 -1
  114. package/lib/structures/GuildMember.d.ts +7 -2
  115. package/lib/structures/GuildMember.js +4 -4
  116. package/lib/structures/Interaction.d.ts +4 -3
  117. package/lib/structures/Interaction.js +29 -12
  118. package/lib/structures/Message.d.ts +69 -8
  119. package/lib/structures/Message.js +59 -17
  120. package/lib/structures/Sticker.d.ts +3 -3
  121. package/lib/structures/User.d.ts +1 -0
  122. package/lib/structures/User.js +4 -1
  123. package/lib/structures/VoiceState.d.ts +6 -5
  124. package/lib/structures/VoiceState.js +6 -3
  125. package/lib/structures/channels.d.ts +4 -1
  126. package/lib/structures/channels.js +37 -6
  127. package/lib/structures/extra/functions.js +1 -1
  128. package/lib/websocket/discord/basesocket.d.ts +1 -0
  129. package/lib/websocket/discord/basesocket.js +17 -0
  130. package/lib/websocket/discord/shard.d.ts +1 -0
  131. package/lib/websocket/discord/shard.js +6 -0
  132. package/lib/websocket/discord/sharder.js +10 -3
  133. package/lib/websocket/discord/shared.d.ts +1 -0
  134. package/lib/websocket/discord/workermanager.d.ts +2 -3
  135. package/lib/websocket/discord/workermanager.js +4 -2
  136. package/package.json +7 -7
  137. package/lib/commands/basecontex.d.ts +0 -15
  138. package/lib/components/command.d.ts +0 -24
@@ -1,6 +1,8 @@
1
- import type { GatewayStageInstanceCreateDispatchData, GatewayStageInstanceDeleteDispatchData } from 'discord-api-types/v10';
2
- import type { BaseClient } from '../../client/base';
3
- export declare const STAGE_INSTANCE_CREATE: (_self: BaseClient, data: GatewayStageInstanceCreateDispatchData) => {
1
+ import type { GatewayStageInstanceCreateDispatchData, GatewayStageInstanceDeleteDispatchData, GatewayStageInstanceUpdateDispatchData } from 'discord-api-types/v10';
2
+ import type { UsingClient } from '../../commands';
3
+ import { type ObjectToLower } from '../../common';
4
+ import type { StageInstances } from '../../cache/resources/stage-instances';
5
+ export declare const STAGE_INSTANCE_CREATE: (_self: UsingClient, data: GatewayStageInstanceCreateDispatchData) => {
4
6
  id: string;
5
7
  guildId: string;
6
8
  channelId: string;
@@ -9,16 +11,7 @@ export declare const STAGE_INSTANCE_CREATE: (_self: BaseClient, data: GatewaySta
9
11
  discoverableDisabled: boolean;
10
12
  guildScheduledEventId?: string | undefined;
11
13
  };
12
- export declare const STAGE_INSTANCE_DELETE: (_self: BaseClient, data: GatewayStageInstanceDeleteDispatchData) => {
13
- id: string;
14
- guildId: string;
15
- channelId: string;
16
- topic: string;
17
- privacyLevel: import("discord-api-types/v10").StageInstancePrivacyLevel;
18
- discoverableDisabled: boolean;
19
- guildScheduledEventId?: string | undefined;
20
- };
21
- export declare const STAGE_INSTANCE_UPDATE: (_self: BaseClient, data: GatewayStageInstanceDeleteDispatchData) => {
14
+ export declare const STAGE_INSTANCE_DELETE: (_self: UsingClient, data: GatewayStageInstanceDeleteDispatchData) => {
22
15
  id: string;
23
16
  guildId: string;
24
17
  channelId: string;
@@ -27,3 +20,4 @@ export declare const STAGE_INSTANCE_UPDATE: (_self: BaseClient, data: GatewaySta
27
20
  discoverableDisabled: boolean;
28
21
  guildScheduledEventId?: string | undefined;
29
22
  };
23
+ export declare const STAGE_INSTANCE_UPDATE: (self: UsingClient, data: GatewayStageInstanceUpdateDispatchData) => Promise<[stage: ObjectToLower<GatewayStageInstanceUpdateDispatchData>, old?: ReturnType<StageInstances['get']>]>;
@@ -10,7 +10,7 @@ const STAGE_INSTANCE_DELETE = (_self, data) => {
10
10
  return (0, common_1.toCamelCase)(data);
11
11
  };
12
12
  exports.STAGE_INSTANCE_DELETE = STAGE_INSTANCE_DELETE;
13
- const STAGE_INSTANCE_UPDATE = (_self, data) => {
14
- return (0, common_1.toCamelCase)(data);
13
+ const STAGE_INSTANCE_UPDATE = async (self, data) => {
14
+ return [(0, common_1.toCamelCase)(data), await self.cache.stageInstances?.get(data.id)];
15
15
  };
16
16
  exports.STAGE_INSTANCE_UPDATE = STAGE_INSTANCE_UPDATE;
@@ -1,9 +1,9 @@
1
1
  import type { GatewayThreadCreateDispatchData, GatewayThreadDeleteDispatchData, GatewayThreadListSyncDispatchData, GatewayThreadMemberUpdateDispatchData, GatewayThreadMembersUpdateDispatchData, GatewayThreadUpdateDispatchData } from 'discord-api-types/v10';
2
- import type { BaseClient } from '../../client/base';
3
2
  import { ThreadChannel } from '../../structures';
4
- export declare const THREAD_CREATE: (self: BaseClient, data: GatewayThreadCreateDispatchData) => ThreadChannel;
5
- export declare const THREAD_DELETE: (self: BaseClient, data: GatewayThreadDeleteDispatchData) => ThreadChannel;
6
- export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadListSyncDispatchData) => {
3
+ import type { UsingClient } from '../../commands';
4
+ export declare const THREAD_CREATE: (self: UsingClient, data: GatewayThreadCreateDispatchData) => ThreadChannel;
5
+ export declare const THREAD_DELETE: (self: UsingClient, data: GatewayThreadDeleteDispatchData) => ThreadChannel;
6
+ export declare const THREAD_LIST_SYNC: (_self: UsingClient, data: GatewayThreadListSyncDispatchData) => {
7
7
  guildId: string;
8
8
  channelIds?: string[] | undefined;
9
9
  threads: ({
@@ -31,6 +31,10 @@ export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadLi
31
31
  premiumType?: import("discord-api-types/v10").UserPremiumType | undefined;
32
32
  publicFlags?: import("discord-api-types/v10").UserFlags | undefined;
33
33
  avatarDecoration?: string | null | undefined;
34
+ avatarDecorationData?: {
35
+ asset: string;
36
+ skuId: string;
37
+ } | null | undefined;
34
38
  }[] | undefined;
35
39
  } | {
36
40
  defaultForumLayout: import("discord-api-types/v10").ForumLayoutType;
@@ -72,8 +76,8 @@ export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadLi
72
76
  topic?: string | null | undefined;
73
77
  type: import("discord-api-types/v10").ChannelType.GuildAnnouncement;
74
78
  id: string;
75
- rateLimitPerUser?: number | undefined;
76
79
  flags?: import("discord-api-types/v10").ChannelFlags | undefined;
80
+ rateLimitPerUser?: number | undefined;
77
81
  lastMessageId?: string | null | undefined;
78
82
  lastPinTimestamp?: string | null | undefined;
79
83
  name: string;
@@ -116,6 +120,10 @@ export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadLi
116
120
  premiumType?: import("discord-api-types/v10").UserPremiumType | undefined;
117
121
  publicFlags?: import("discord-api-types/v10").UserFlags | undefined;
118
122
  avatarDecoration?: string | null | undefined;
123
+ avatarDecorationData?: {
124
+ asset: string;
125
+ skuId: string;
126
+ } | null | undefined;
119
127
  }[] | undefined;
120
128
  } | {
121
129
  name: string;
@@ -213,8 +221,8 @@ export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadLi
213
221
  topic?: string | null | undefined;
214
222
  type: import("discord-api-types/v10").ChannelType.GuildText;
215
223
  id: string;
216
- rateLimitPerUser?: number | undefined;
217
224
  flags?: import("discord-api-types/v10").ChannelFlags | undefined;
225
+ rateLimitPerUser?: number | undefined;
218
226
  lastMessageId?: string | null | undefined;
219
227
  lastPinTimestamp?: string | null | undefined;
220
228
  name: string;
@@ -251,8 +259,8 @@ export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadLi
251
259
  appliedTags: string[];
252
260
  type: import("discord-api-types/v10").ThreadChannelType;
253
261
  id: string;
254
- rateLimitPerUser?: number | undefined;
255
262
  flags?: import("discord-api-types/v10").ChannelFlags | undefined;
263
+ rateLimitPerUser?: number | undefined;
256
264
  lastMessageId?: string | null | undefined;
257
265
  lastPinTimestamp?: string | null | undefined;
258
266
  name: string;
@@ -284,10 +292,11 @@ export declare const THREAD_LIST_SYNC: (_self: BaseClient, data: GatewayThreadLi
284
292
  flags: import("discord-api-types/v10").GuildMemberFlags;
285
293
  pending?: boolean | undefined;
286
294
  communicationDisabledUntil?: string | null | undefined;
295
+ avatarDecorationData?: import("discord-api-types/v10").APIAvatarDecorationData | null | undefined;
287
296
  } | undefined;
288
297
  }[];
289
298
  };
290
- export declare const THREAD_MEMBER_UPDATE: (_self: BaseClient, data: GatewayThreadMemberUpdateDispatchData) => {
299
+ export declare const THREAD_MEMBER_UPDATE: (_self: UsingClient, data: GatewayThreadMemberUpdateDispatchData) => {
291
300
  id?: string | undefined;
292
301
  userId?: string | undefined;
293
302
  joinTimestamp: string;
@@ -304,10 +313,11 @@ export declare const THREAD_MEMBER_UPDATE: (_self: BaseClient, data: GatewayThre
304
313
  flags: import("discord-api-types/v10").GuildMemberFlags;
305
314
  pending?: boolean | undefined;
306
315
  communicationDisabledUntil?: string | null | undefined;
316
+ avatarDecorationData?: import("discord-api-types/v10").APIAvatarDecorationData | null | undefined;
307
317
  } | undefined;
308
318
  guildId: string;
309
319
  };
310
- export declare const THREAD_MEMBERS_UPDATE: (_self: BaseClient, data: GatewayThreadMembersUpdateDispatchData) => {
320
+ export declare const THREAD_MEMBERS_UPDATE: (_self: UsingClient, data: GatewayThreadMembersUpdateDispatchData) => {
311
321
  id: string;
312
322
  guildId: string;
313
323
  memberCount: number;
@@ -328,8 +338,9 @@ export declare const THREAD_MEMBERS_UPDATE: (_self: BaseClient, data: GatewayThr
328
338
  flags: import("discord-api-types/v10").GuildMemberFlags;
329
339
  pending?: boolean | undefined;
330
340
  communicationDisabledUntil?: string | null | undefined;
341
+ avatarDecorationData?: import("discord-api-types/v10").APIAvatarDecorationData | null | undefined;
331
342
  } | undefined;
332
343
  }[] | undefined;
333
344
  removedMemberIds?: string[] | undefined;
334
345
  };
335
- export declare const THREAD_UPDATE: (self: BaseClient, data: GatewayThreadUpdateDispatchData) => ThreadChannel;
346
+ export declare const THREAD_UPDATE: (self: UsingClient, data: GatewayThreadUpdateDispatchData) => Promise<[thread: ThreadChannel, old?: ThreadChannel]>;
@@ -23,7 +23,7 @@ const THREAD_MEMBERS_UPDATE = (_self, data) => {
23
23
  return (0, common_1.toCamelCase)(data);
24
24
  };
25
25
  exports.THREAD_MEMBERS_UPDATE = THREAD_MEMBERS_UPDATE;
26
- const THREAD_UPDATE = (self, data) => {
27
- return new structures_1.ThreadChannel(self, data);
26
+ const THREAD_UPDATE = async (self, data) => {
27
+ return [new structures_1.ThreadChannel(self, data), await self.cache.threads?.get(data.id)];
28
28
  };
29
29
  exports.THREAD_UPDATE = THREAD_UPDATE;
@@ -1,7 +1,7 @@
1
1
  import type { GatewayTypingStartDispatchData } from 'discord-api-types/v10';
2
- import type { BaseClient } from '../../client/base';
3
2
  import { GuildMember } from '../../structures';
4
- export declare const TYPING_START: (self: BaseClient, data: GatewayTypingStartDispatchData) => {
3
+ import type { UsingClient } from '../../commands';
4
+ export declare const TYPING_START: (self: UsingClient, data: GatewayTypingStartDispatchData) => {
5
5
  channelId: string;
6
6
  guildId?: string | undefined;
7
7
  userId: string;
@@ -18,6 +18,7 @@ export declare const TYPING_START: (self: BaseClient, data: GatewayTypingStartDi
18
18
  flags: import("discord-api-types/v10").GuildMemberFlags;
19
19
  pending?: boolean | undefined;
20
20
  communicationDisabledUntil?: string | null | undefined;
21
+ avatarDecorationData?: import("discord-api-types/v10").APIAvatarDecorationData | null | undefined;
21
22
  } | undefined;
22
23
  } | {
23
24
  member: GuildMember;
@@ -1,4 +1,4 @@
1
1
  import type { GatewayUserUpdateDispatchData } from 'discord-api-types/v10';
2
- import type { BaseClient } from '../../client/base';
3
2
  import { User } from '../../structures';
4
- export declare const USER_UPDATE: (self: BaseClient, data: GatewayUserUpdateDispatchData) => User;
3
+ import type { UsingClient } from '../../commands';
4
+ export declare const USER_UPDATE: (self: UsingClient, data: GatewayUserUpdateDispatchData) => Promise<[user: User, old?: User]>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.USER_UPDATE = void 0;
4
4
  const structures_1 = require("../../structures");
5
- const USER_UPDATE = (self, data) => {
6
- return new structures_1.User(self, data);
5
+ const USER_UPDATE = async (self, data) => {
6
+ return [new structures_1.User(self, data), await self.cache.users?.get(data.id)];
7
7
  };
8
8
  exports.USER_UPDATE = USER_UPDATE;
@@ -1,49 +1,9 @@
1
- import type { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from 'discord-api-types/v10';
2
- import type { BaseClient } from '../../client/base';
3
- import { GuildMember } from '../../structures';
4
- export declare const VOICE_SERVER_UPDATE: (_self: BaseClient, data: GatewayVoiceServerUpdateDispatchData) => {
1
+ import type { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from '../../types';
2
+ import { VoiceState } from '../../structures';
3
+ import type { UsingClient } from '../../commands';
4
+ export declare const VOICE_SERVER_UPDATE: (_self: UsingClient, data: GatewayVoiceServerUpdateDispatchData) => {
5
5
  token: string;
6
6
  guildId: string;
7
7
  endpoint: string | null;
8
8
  };
9
- export declare const VOICE_STATE_UPDATE: (self: BaseClient, data: GatewayVoiceStateUpdateDispatchData) => {
10
- guildId?: string | undefined;
11
- channelId: string | null;
12
- userId: string;
13
- member?: {
14
- user?: import("discord-api-types/v10").APIUser | undefined;
15
- nick?: string | null | undefined;
16
- avatar?: string | null | undefined;
17
- roles: string[];
18
- joinedAt: string;
19
- premiumSince?: string | null | undefined;
20
- deaf: boolean;
21
- mute: boolean;
22
- flags: import("discord-api-types/v10").GuildMemberFlags;
23
- pending?: boolean | undefined;
24
- communicationDisabledUntil?: string | null | undefined;
25
- } | undefined;
26
- sessionId: string;
27
- deaf: boolean;
28
- mute: boolean;
29
- selfDeaf: boolean;
30
- selfMute: boolean;
31
- selfStream?: boolean | undefined;
32
- selfVideo: boolean;
33
- suppress: boolean;
34
- requestToSpeakTimestamp: string | null;
35
- } | {
36
- member: GuildMember;
37
- guildId?: string | undefined;
38
- channelId: string | null;
39
- userId: string;
40
- sessionId: string;
41
- deaf: boolean;
42
- mute: boolean;
43
- selfDeaf: boolean;
44
- selfMute: boolean;
45
- selfStream?: boolean | undefined;
46
- selfVideo: boolean;
47
- suppress: boolean;
48
- requestToSpeakTimestamp: string | null;
49
- };
9
+ export declare const VOICE_STATE_UPDATE: (self: UsingClient, data: GatewayVoiceStateUpdateDispatchData) => Promise<[VoiceState] | [state: VoiceState, old?: VoiceState]>;
@@ -7,12 +7,9 @@ const VOICE_SERVER_UPDATE = (_self, data) => {
7
7
  return (0, common_1.toCamelCase)(data);
8
8
  };
9
9
  exports.VOICE_SERVER_UPDATE = VOICE_SERVER_UPDATE;
10
- const VOICE_STATE_UPDATE = (self, data) => {
11
- return data.member?.user
12
- ? {
13
- ...(0, common_1.toCamelCase)(data),
14
- member: new structures_1.GuildMember(self, data.member, data.member?.user, data.guild_id),
15
- }
16
- : (0, common_1.toCamelCase)(data);
10
+ const VOICE_STATE_UPDATE = async (self, data) => {
11
+ if (!data.guild_id)
12
+ return [new structures_1.VoiceState(self, data)];
13
+ return [new structures_1.VoiceState(self, data), await self.cache.voiceStates?.get(data.user_id, data.guild_id)];
17
14
  };
18
15
  exports.VOICE_STATE_UPDATE = VOICE_STATE_UPDATE;
@@ -1,6 +1,6 @@
1
1
  import type { GatewayWebhooksUpdateDispatchData } from 'discord-api-types/v10';
2
- import type { BaseClient } from '../../client/base';
3
- export declare const WEBHOOKS_UPDATE: (_self: BaseClient, data: GatewayWebhooksUpdateDispatchData) => {
2
+ import type { UsingClient } from '../../commands';
3
+ export declare const WEBHOOKS_UPDATE: (_self: UsingClient, data: GatewayWebhooksUpdateDispatchData) => {
4
4
  guildId: string;
5
5
  channelId: string;
6
6
  };
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { BaseClientOptions, InternalRuntimeConfig, InternalRuntimeConfigHTTP, RuntimeConfig, RuntimeConfigHTTP } from './client/base';
2
- import type { ClientNameEvents, EventContext } from './events';
3
- export { Logger, PermissionStrings, Watcher } from './common';
1
+ import { type BaseClientOptions, type InternalRuntimeConfig, type InternalRuntimeConfigHTTP, type RuntimeConfig, type RuntimeConfigHTTP } from './client/base';
2
+ import type { CustomEventsKeys, ClientNameEvents, EventContext } from './events';
3
+ export { Logger, PermissionStrings, Watcher, Formatter } from './common';
4
4
  export { Collection, LimitedCollection } from './collection';
5
5
  export * from './api';
6
6
  export * from './builders';
@@ -27,7 +27,7 @@ export declare function throwError(msg: string): never;
27
27
  * }
28
28
  * });
29
29
  */
30
- export declare function createEvent<E extends ClientNameEvents>(data: {
30
+ export declare function createEvent<E extends ClientNameEvents | CustomEventsKeys>(data: {
31
31
  data: {
32
32
  name: E;
33
33
  once?: boolean;
package/lib/index.js CHANGED
@@ -14,11 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.extendContext = exports.config = exports.createEvent = exports.throwError = exports.WorkerManager = exports.ShardManager = exports.LimitedCollection = exports.Collection = exports.Watcher = exports.Logger = void 0;
17
+ exports.extendContext = exports.config = exports.createEvent = exports.throwError = exports.WorkerManager = exports.ShardManager = exports.LimitedCollection = exports.Collection = exports.Formatter = exports.Watcher = exports.Logger = void 0;
18
18
  const v10_1 = require("discord-api-types/gateway/v10");
19
- var common_1 = require("./common");
20
- Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return common_1.Logger; } });
21
- Object.defineProperty(exports, "Watcher", { enumerable: true, get: function () { return common_1.Watcher; } });
19
+ const base_1 = require("./client/base");
20
+ const common_1 = require("./common");
21
+ var common_2 = require("./common");
22
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return common_2.Logger; } });
23
+ Object.defineProperty(exports, "Watcher", { enumerable: true, get: function () { return common_2.Watcher; } });
24
+ Object.defineProperty(exports, "Formatter", { enumerable: true, get: function () { return common_2.Formatter; } });
22
25
  //
23
26
  var collection_1 = require("./collection");
24
27
  Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return collection_1.Collection; } });
@@ -87,10 +90,13 @@ exports.config = {
87
90
  * @returns The internal runtime configuration for HTTP.
88
91
  */
89
92
  http(data) {
90
- return {
93
+ const obj = {
91
94
  port: 8080,
92
95
  ...data,
93
96
  };
97
+ if ((0, common_1.isCloudfareWorker)())
98
+ base_1.BaseClient._seyfertConfig = obj;
99
+ return obj;
94
100
  },
95
101
  };
96
102
  /**
@@ -10,7 +10,10 @@ export declare class LangsHandler extends BaseHandler {
10
10
  get(userLocale: string): import("./router").__InternalParseLocale<import("..").DefaultLocale> & {
11
11
  get(locale?: string | undefined): import("..").DefaultLocale;
12
12
  };
13
- load(dir: string): Promise<void>;
13
+ load(dir: string, instances?: {
14
+ name: string;
15
+ file: Record<string, any>;
16
+ }[]): Promise<void>;
14
17
  setHandlers({ callback }: {
15
18
  callback: LangsHandler['callback'];
16
19
  }): void;
@@ -30,10 +30,10 @@ class LangsHandler extends common_1.BaseHandler {
30
30
  const locale = this.getLocale(userLocale);
31
31
  return (0, router_1.LangRouter)(locale, this.defaultLang ?? locale, this.values)();
32
32
  }
33
- async load(dir) {
34
- const files = await this.loadFilesK(await this.getFiles(dir));
33
+ async load(dir, instances) {
34
+ const files = instances ?? (await this.loadFilesK(await this.getFiles(dir)));
35
35
  for (const i of files) {
36
- const locale = i.name.split('.').slice(0, -1).join('.');
36
+ const locale = i.name.split('.').slice(0, -1).join('.') || i.name;
37
37
  const result = this.callback(locale, i.file);
38
38
  if (result)
39
39
  this.values[locale] = result;
@@ -9,6 +9,7 @@ import { GuildTemplate } from './GuildTemplate';
9
9
  import { Sticker } from './Sticker';
10
10
  import { BaseGuild } from './extra/BaseGuild';
11
11
  import type { DiscordBase } from './extra/DiscordBase';
12
+ import { GuildBan } from './GuildBan';
12
13
  export interface Guild extends ObjectToLower<Omit<APIGuild, 'stickers' | 'emojis' | 'roles'>>, DiscordBase {
13
14
  }
14
15
  declare const Guild_base: ToClass<Omit<BaseGuild, "name" | "id" | "description" | "icon" | "splash" | "banner" | "features" | "welcomeScreen" | "verificationLevel" | "vanityUrlCode">, Guild<"api">>;
@@ -76,10 +77,17 @@ export declare class Guild<State extends StructStates = 'api'> extends Guild_bas
76
77
  edit: (emojiId: string, body: import("discord-api-types/v10").RESTPatchAPIGuildEmojiJSONBody, reason?: string | undefined) => Promise<GuildEmoji>;
77
78
  create: (body: Omit<import("discord-api-types/v10").RESTPostAPIGuildEmojiJSONBody, "image"> & {
78
79
  image: import("../common").ImageResolvable;
79
- }) => Promise<void>;
80
+ }) => Promise<GuildEmoji>;
80
81
  fetch: (emojiId: string, force?: boolean) => Promise<GuildEmoji>;
81
82
  list: (force?: boolean) => Promise<GuildEmoji[]>;
82
83
  };
84
+ bans: {
85
+ fetch: (userId: string, force?: boolean) => Promise<GuildBan>;
86
+ list: (query?: import("discord-api-types/v10").RESTGetAPIGuildBansQuery | undefined, force?: boolean) => Promise<GuildBan[]>;
87
+ create: (memberId: string, body?: import("discord-api-types/v10").RESTPutAPIGuildBanJSONBody | undefined, reason?: string | undefined) => Promise<void>;
88
+ remove: (memberId: string, reason?: string | undefined) => Promise<void>;
89
+ bulkCreate: (body: import("discord-api-types/v10").RESTPostAPIGuildBulkBanJSONBody, reason?: string | undefined) => Promise<import("discord-api-types/v10").RESTPostAPIGuildBulkBanResult>;
90
+ };
83
91
  }
84
92
  /** Maximun custom guild emojis per level */
85
93
  export type MaxEmojis = 50 | 100 | 150 | 250;
@@ -9,6 +9,7 @@ const GuildTemplate_1 = require("./GuildTemplate");
9
9
  const Sticker_1 = require("./Sticker");
10
10
  const channels_1 = require("./channels");
11
11
  const BaseGuild_1 = require("./extra/BaseGuild");
12
+ const GuildBan_1 = require("./GuildBan");
12
13
  class Guild extends BaseGuild_1.BaseGuild {
13
14
  joinedAt;
14
15
  memberCount;
@@ -62,5 +63,6 @@ class Guild extends BaseGuild_1.BaseGuild {
62
63
  roles = GuildRole_1.GuildRole.methods({ client: this.client, guildId: this.id });
63
64
  channels = channels_1.BaseChannel.allMethods({ client: this.client, guildId: this.id });
64
65
  emojis = GuildEmoji_1.GuildEmoji.methods({ client: this.client, guildId: this.id });
66
+ bans = GuildBan_1.GuildBan.methods({ client: this.client, guildId: this.id });
65
67
  }
66
68
  exports.Guild = Guild;
@@ -0,0 +1,25 @@
1
+ import type { APIBan, RESTGetAPIGuildBansQuery } from 'discord-api-types/v10';
2
+ import type { UsingClient } from '../commands';
3
+ import type { MethodContext, ObjectToLower } from '../common';
4
+ import { DiscordBase } from './extra/DiscordBase';
5
+ import type { BanShorter } from '../common/shorters/bans';
6
+ export interface GuildBan extends DiscordBase, ObjectToLower<Omit<APIBan, 'id'>> {
7
+ }
8
+ export declare class GuildBan extends DiscordBase {
9
+ readonly guildId: string;
10
+ constructor(client: UsingClient, data: APIBan, guildId: string);
11
+ create(body?: Parameters<BanShorter['create']>[2], reason?: string): Promise<void>;
12
+ remove(reason?: string): Promise<void>;
13
+ guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
14
+ fetch(force?: boolean): Promise<GuildBan>;
15
+ toString(): string;
16
+ static methods({ client, guildId }: MethodContext<{
17
+ guildId: string;
18
+ }>): {
19
+ fetch: (userId: string, force?: boolean) => Promise<GuildBan>;
20
+ list: (query?: RESTGetAPIGuildBansQuery, force?: boolean) => Promise<GuildBan[]>;
21
+ create: (memberId: string, body?: Parameters<BanShorter['create']>[2], reason?: string) => Promise<void>;
22
+ remove: (memberId: string, reason?: string) => Promise<void>;
23
+ bulkCreate: (body: Parameters<BanShorter['bulkCreate']>[1], reason?: string) => Promise<import("discord-api-types/v10").RESTPostAPIGuildBulkBanResult>;
24
+ };
25
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuildBan = void 0;
4
+ const DiscordBase_1 = require("./extra/DiscordBase");
5
+ class GuildBan extends DiscordBase_1.DiscordBase {
6
+ guildId;
7
+ constructor(client, data, guildId) {
8
+ super(client, { ...data, id: data.user.id });
9
+ this.guildId = guildId;
10
+ }
11
+ create(body, reason) {
12
+ return this.client.bans.create(this.guildId, this.id, body, reason);
13
+ }
14
+ remove(reason) {
15
+ return this.client.bans.remove(this.guildId, this.id, reason);
16
+ }
17
+ guild(force = false) {
18
+ return this.client.guilds.fetch(this.guildId, force);
19
+ }
20
+ fetch(force = false) {
21
+ return this.client.bans.fetch(this.guildId, this.id, force);
22
+ }
23
+ toString() {
24
+ return `<@${this.id}>`;
25
+ }
26
+ static methods({ client, guildId }) {
27
+ return {
28
+ fetch: (userId, force = false) => client.bans.fetch(guildId, userId, force),
29
+ list: (query, force = false) => client.bans.list(guildId, query, force),
30
+ create: (memberId, body, reason) => client.bans.create(guildId, memberId, body, reason),
31
+ remove: (memberId, reason) => client.bans.remove(guildId, memberId, reason),
32
+ bulkCreate: (body, reason) => client.bans.bulkCreate(guildId, body, reason),
33
+ };
34
+ }
35
+ }
36
+ exports.GuildBan = GuildBan;
@@ -23,7 +23,7 @@ export declare class GuildEmoji extends DiscordBase {
23
23
  guildId: string;
24
24
  }>): {
25
25
  edit: (emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string) => Promise<GuildEmoji>;
26
- create: (body: Parameters<EmojiShorter['create']>[1]) => Promise<void>;
26
+ create: (body: Parameters<EmojiShorter['create']>[1]) => Promise<GuildEmoji>;
27
27
  fetch: (emojiId: string, force?: boolean) => Promise<GuildEmoji>;
28
28
  list: (force?: boolean) => Promise<GuildEmoji[]>;
29
29
  };
@@ -80,8 +80,13 @@ export declare class GuildMember extends BaseGuildMember {
80
80
  get displayName(): string;
81
81
  dm(force?: boolean): Promise<import("./channels").DMChannel>;
82
82
  write(body: MessageCreateBodyRequest): Promise<import("./Message").Message>;
83
- avatarURL(options?: ImageOptions): string;
84
- dynamicAvatarURL(options?: ImageOptions): string;
83
+ defaultAvatarURL(): string;
84
+ avatarURL(options: ImageOptions & {
85
+ exclude: true;
86
+ }): string | null;
87
+ avatarURL(options?: ImageOptions & {
88
+ exclude?: false;
89
+ }): string;
85
90
  bannerURL(options?: ImageOptions): string | undefined;
86
91
  fetchPermissions(force?: boolean): Promise<PermissionsBitField>;
87
92
  manageable(force?: boolean): Promise<boolean>;
@@ -120,12 +120,12 @@ class GuildMember extends BaseGuildMember {
120
120
  write(body) {
121
121
  return this.user.write(body);
122
122
  }
123
- avatarURL(options) {
124
- return this.user.avatarURL(options);
123
+ defaultAvatarURL() {
124
+ return this.user.defaultAvatarURL();
125
125
  }
126
- dynamicAvatarURL(options) {
126
+ avatarURL(options) {
127
127
  if (!this.avatar) {
128
- return this.user.avatarURL(options);
128
+ return options?.exclude ? null : this.user.avatarURL();
129
129
  }
130
130
  return this.rest.cdn.guilds(this.guildId).users(this.id).avatars(this.avatar).get(options);
131
131
  }
@@ -1,4 +1,5 @@
1
1
  import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction, type APIBaseInteraction, type APIChatInputApplicationCommandInteraction, type APIChatInputApplicationCommandInteractionData, type APICommandAutocompleteInteractionResponseCallbackData, type APIInteraction, type APIInteractionResponse, type APIInteractionResponseChannelMessageWithSource, type APIInteractionResponseDeferredChannelMessageWithSource, type APIInteractionResponseDeferredMessageUpdate, type APIInteractionResponsePong, type APIInteractionResponseUpdateMessage, type APIMessageApplicationCommandInteraction, type APIMessageApplicationCommandInteractionData, type APIMessageButtonInteractionData, type APIMessageComponentInteraction, type APIMessageComponentSelectMenuInteraction, type APIMessageStringSelectInteractionData, type APIModalSubmission, type APIModalSubmitInteraction, type APIUserApplicationCommandInteraction, type APIUserApplicationCommandInteractionData, ApplicationCommandType, ComponentType, type GatewayInteractionCreateDispatchData, InteractionResponseType, InteractionType, type MessageFlags, type RESTPostAPIInteractionCallbackJSONBody } from 'discord-api-types/v10';
2
+ import type { RawFile } from '../api';
2
3
  import { OptionResolver, type UsingClient } from '../commands';
3
4
  import type { ObjectToLower, OmitInsert, ToClass, When } from '../common';
4
5
  import type { ComponentInteractionMessageUpdate, InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MessageCreateBodyRequest, MessageUpdateBodyRequest, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest } from '../common/types/write';
@@ -27,8 +28,8 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
27
28
  replied?: Promise<boolean> | boolean;
28
29
  appPermissions?: PermissionsBitField;
29
30
  constructor(client: UsingClient, interaction: Type, __reply?: __InternalReplyFunction | undefined);
30
- static transformBodyRequest(body: ReplyInteractionBody): APIInteractionResponse;
31
- static transformBody<T>(body: InteractionMessageUpdateBodyRequest | MessageUpdateBodyRequest | MessageCreateBodyRequest | MessageWebhookCreateBodyRequest): T;
31
+ static transformBodyRequest(body: ReplyInteractionBody, files: RawFile[] | undefined, self: UsingClient): APIInteractionResponse;
32
+ static transformBody<T>(body: InteractionMessageUpdateBodyRequest | MessageUpdateBodyRequest | MessageCreateBodyRequest | MessageWebhookCreateBodyRequest, files: RawFile[] | undefined, self: UsingClient): T;
32
33
  private matchReplied;
33
34
  reply(body: ReplyInteractionBody): Promise<void>;
34
35
  deferReply(flags?: MessageFlags): Promise<void>;
@@ -43,7 +44,7 @@ export declare class AutocompleteInteraction<FromGuild extends boolean = boolean
43
44
  type: InteractionType.ApplicationCommandAutocomplete;
44
45
  data: ObjectToLower<APIApplicationCommandAutocompleteInteraction['data']>;
45
46
  options: OptionResolver;
46
- constructor(client: UsingClient, interaction: APIApplicationCommandAutocompleteInteraction, __reply?: __InternalReplyFunction | undefined);
47
+ constructor(client: UsingClient, interaction: APIApplicationCommandAutocompleteInteraction, resolver?: OptionResolver, __reply?: __InternalReplyFunction | undefined);
47
48
  getInput(): string;
48
49
  respond(choices: APICommandAutocompleteInteractionResponseCallbackData['choices']): Promise<void>;
49
50
  /** @intenal */
@@ -48,7 +48,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
48
48
  }
49
49
  this.user = this.member?.user ?? new User_1.User(client, interaction.user);
50
50
  }
51
- static transformBodyRequest(body) {
51
+ static transformBodyRequest(body, files, self) {
52
52
  switch (body.type) {
53
53
  case v10_1.InteractionResponseType.ApplicationCommandAutocompleteResult:
54
54
  case v10_1.InteractionResponseType.DeferredMessageUpdate:
@@ -61,11 +61,18 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
61
61
  type: body.type,
62
62
  //@ts-ignore
63
63
  data: {
64
+ //@ts-ignore
65
+ allowed_mentions: self.options?.allowedMentions,
64
66
  ...(body.data ?? {}),
65
67
  //@ts-ignore
66
- components: body.data?.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
67
- embeds: body.data?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
68
- attachments: body.data?.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) })) ?? undefined,
68
+ components: body.data?.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)),
69
+ embeds: body.data?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)),
70
+ attachments: body.data && 'attachments' in body.data
71
+ ? body.data.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) }))
72
+ : files?.map((x, id) => ({
73
+ id,
74
+ filename: x.name,
75
+ })),
69
76
  poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
70
77
  },
71
78
  };
@@ -88,12 +95,19 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
88
95
  return body;
89
96
  }
90
97
  }
91
- static transformBody(body) {
98
+ static transformBody(body, files, self) {
92
99
  const poll = body.poll;
93
100
  return {
101
+ allowed_mentions: self.options?.allowedMentions,
102
+ attachments: 'attachments' in body
103
+ ? body.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) }))
104
+ : files?.map((x, id) => ({
105
+ id,
106
+ filename: x.name,
107
+ })),
94
108
  ...body,
95
- components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
96
- embeds: body?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
109
+ components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)),
110
+ embeds: body?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)),
97
111
  poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
98
112
  };
99
113
  }
@@ -103,9 +117,10 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
103
117
  const { files, ...rest } = body.data ?? {};
104
118
  //@ts-expect-error
105
119
  const data = body.data instanceof builders_1.Modal ? body.data : rest;
120
+ const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : undefined;
106
121
  return (this.replied = this.__reply({
107
- body: BaseInteraction.transformBodyRequest({ data, type: body.type }),
108
- files: files ? await (0, builders_1.resolveFiles)(files) : undefined,
122
+ body: BaseInteraction.transformBodyRequest({ data, type: body.type }, parsedFiles, this.client),
123
+ files: parsedFiles,
109
124
  }).then(() => (this.replied = true)));
110
125
  }
111
126
  return (this.replied = this.client.interactions.reply(this.id, this.token, body).then(() => (this.replied = true)));
@@ -131,7 +146,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
131
146
  static from(client, gateway, __reply) {
132
147
  switch (gateway.type) {
133
148
  case v10_1.InteractionType.ApplicationCommandAutocomplete:
134
- return new AutocompleteInteraction(client, gateway, __reply);
149
+ return new AutocompleteInteraction(client, gateway, undefined, __reply);
135
150
  // biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
136
151
  case v10_1.InteractionType.ApplicationCommand:
137
152
  switch (gateway.data.type) {
@@ -172,10 +187,12 @@ exports.BaseInteraction = BaseInteraction;
172
187
  class AutocompleteInteraction extends BaseInteraction {
173
188
  __reply;
174
189
  options;
175
- constructor(client, interaction, __reply) {
190
+ constructor(client, interaction, resolver, __reply) {
176
191
  super(client, interaction);
177
192
  this.__reply = __reply;
178
- this.options = new commands_1.OptionResolver(client, interaction.data.options, undefined, interaction.guild_id, interaction.data.resolved);
193
+ this.options =
194
+ resolver ??
195
+ new commands_1.OptionResolver(client, interaction.data.options, undefined, interaction.guild_id, interaction.data.resolved);
179
196
  }
180
197
  getInput() {
181
198
  return this.options.getAutocompleteValue() ?? '';