seyfert 1.2.3 → 1.3.1

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 (125) hide show
  1. package/lib/api/Routes/channels.d.ts +15 -1
  2. package/lib/api/api.js +5 -1
  3. package/lib/api/shared.d.ts +3 -1
  4. package/lib/api/utils/utils.d.ts +1 -1
  5. package/lib/api/utils/utils.js +2 -2
  6. package/lib/builders/Poll.d.ts +16 -0
  7. package/lib/builders/Poll.js +48 -0
  8. package/lib/builders/index.d.ts +1 -0
  9. package/lib/builders/index.js +1 -0
  10. package/lib/cache/adapters/index.d.ts +1 -0
  11. package/lib/cache/adapters/index.js +1 -0
  12. package/lib/cache/adapters/limited.d.ts +50 -0
  13. package/lib/cache/adapters/limited.js +188 -0
  14. package/lib/cache/index.d.ts +5 -2
  15. package/lib/cache/index.js +38 -7
  16. package/lib/cache/resources/channels.d.ts +2 -1
  17. package/lib/cache/resources/default/base.d.ts +3 -3
  18. package/lib/cache/resources/default/base.js +8 -3
  19. package/lib/cache/resources/default/guild-based.d.ts +2 -1
  20. package/lib/cache/resources/default/guild-based.js +7 -3
  21. package/lib/cache/resources/default/guild-related.d.ts +2 -1
  22. package/lib/cache/resources/default/guild-related.js +7 -3
  23. package/lib/cache/resources/emojis.d.ts +2 -0
  24. package/lib/cache/resources/emojis.js +4 -0
  25. package/lib/cache/resources/guilds.d.ts +2 -0
  26. package/lib/cache/resources/guilds.js +4 -0
  27. package/lib/cache/resources/members.d.ts +2 -0
  28. package/lib/cache/resources/members.js +5 -1
  29. package/lib/cache/resources/messages.d.ts +15 -0
  30. package/lib/cache/resources/messages.js +53 -0
  31. package/lib/cache/resources/overwrites.d.ts +2 -0
  32. package/lib/cache/resources/overwrites.js +4 -0
  33. package/lib/cache/resources/presence.d.ts +1 -0
  34. package/lib/cache/resources/presence.js +4 -0
  35. package/lib/cache/resources/roles.d.ts +2 -0
  36. package/lib/cache/resources/roles.js +4 -0
  37. package/lib/cache/resources/stage-instances.d.ts +1 -0
  38. package/lib/cache/resources/stage-instances.js +5 -1
  39. package/lib/cache/resources/stickers.d.ts +2 -0
  40. package/lib/cache/resources/stickers.js +4 -0
  41. package/lib/cache/resources/threads.d.ts +2 -0
  42. package/lib/cache/resources/threads.js +4 -0
  43. package/lib/cache/resources/users.d.ts +2 -0
  44. package/lib/cache/resources/users.js +4 -0
  45. package/lib/cache/resources/voice-states.d.ts +2 -1
  46. package/lib/cache/resources/voice-states.js +8 -4
  47. package/lib/client/base.d.ts +25 -13
  48. package/lib/client/base.js +33 -8
  49. package/lib/client/client.d.ts +6 -5
  50. package/lib/client/client.js +13 -1
  51. package/lib/client/oninteractioncreate.js +2 -2
  52. package/lib/client/onmessagecreate.js +2 -2
  53. package/lib/client/workerclient.d.ts +3 -3
  54. package/lib/client/workerclient.js +18 -3
  55. package/lib/collection.d.ts +8 -3
  56. package/lib/collection.js +22 -4
  57. package/lib/commands/applications/chat.d.ts +8 -14
  58. package/lib/commands/applications/chat.js +2 -20
  59. package/lib/commands/applications/chatcontext.d.ts +1 -1
  60. package/lib/commands/applications/menucontext.d.ts +1 -1
  61. package/lib/commands/handler.d.ts +11 -7
  62. package/lib/commands/handler.js +43 -14
  63. package/lib/common/index.d.ts +2 -0
  64. package/lib/common/index.js +2 -0
  65. package/lib/common/it/utils.d.ts +0 -1
  66. package/lib/common/it/utils.js +0 -1
  67. package/lib/common/shorters/channels.d.ts +5 -3
  68. package/lib/common/shorters/channels.js +24 -10
  69. package/lib/common/shorters/guilds.d.ts +7 -6
  70. package/lib/common/shorters/guilds.js +23 -4
  71. package/lib/common/shorters/interaction.d.ts +13 -0
  72. package/lib/common/shorters/interaction.js +61 -0
  73. package/lib/common/shorters/messages.d.ts +6 -3
  74. package/lib/common/shorters/messages.js +33 -15
  75. package/lib/common/shorters/roles.d.ts +3 -3
  76. package/lib/common/shorters/roles.js +12 -17
  77. package/lib/common/shorters/templates.d.ts +7 -6
  78. package/lib/common/shorters/templates.js +28 -6
  79. package/lib/common/shorters/threads.d.ts +39 -0
  80. package/lib/common/shorters/threads.js +76 -0
  81. package/lib/common/shorters/webhook.d.ts +1 -1
  82. package/lib/common/shorters/webhook.js +8 -2
  83. package/lib/common/types/util.d.ts +8 -2
  84. package/lib/common/types/write.d.ts +8 -5
  85. package/lib/components/ButtonComponent.js +1 -1
  86. package/lib/components/componentcontext.d.ts +1 -1
  87. package/lib/components/handler.d.ts +6 -17
  88. package/lib/components/handler.js +7 -2
  89. package/lib/events/handler.d.ts +8 -14
  90. package/lib/events/handler.js +9 -4
  91. package/lib/events/hooks/auto_moderation.d.ts +5 -1
  92. package/lib/events/hooks/guild.d.ts +692 -23
  93. package/lib/events/hooks/guild.js +2 -2
  94. package/lib/events/hooks/integration.d.ts +52 -47
  95. package/lib/events/hooks/interactions.d.ts +1 -1
  96. package/lib/events/hooks/invite.d.ts +67 -3
  97. package/lib/events/hooks/message.d.ts +96 -12
  98. package/lib/events/hooks/message.js +18 -7
  99. package/lib/events/hooks/presence.d.ts +48 -2
  100. package/lib/events/hooks/thread.d.ts +155 -18
  101. package/lib/events/hooks/typing.d.ts +13 -1
  102. package/lib/events/hooks/voice.d.ts +13 -1
  103. package/lib/langs/handler.d.ts +4 -8
  104. package/lib/langs/handler.js +7 -2
  105. package/lib/structures/AutoModerationRule.d.ts +7 -7
  106. package/lib/structures/AutoModerationRule.js +2 -1
  107. package/lib/structures/Guild.d.ts +15 -13
  108. package/lib/structures/GuildRole.d.ts +5 -5
  109. package/lib/structures/GuildTemplate.d.ts +10 -10
  110. package/lib/structures/Interaction.d.ts +4 -4
  111. package/lib/structures/Interaction.js +27 -48
  112. package/lib/structures/Message.d.ts +5 -3
  113. package/lib/structures/Message.js +5 -0
  114. package/lib/structures/Poll.d.ts +15 -0
  115. package/lib/structures/Poll.js +26 -0
  116. package/lib/structures/User.js +2 -2
  117. package/lib/structures/Webhook.d.ts +2 -2
  118. package/lib/structures/channels.d.ts +6 -3
  119. package/lib/structures/channels.js +16 -8
  120. package/lib/structures/extra/Permissions.d.ts +1 -0
  121. package/lib/structures/index.d.ts +1 -0
  122. package/lib/structures/index.js +1 -0
  123. package/lib/websocket/SharedTypes.d.ts +7 -2
  124. package/lib/websocket/discord/shard.js +1 -1
  125. package/package.json +8 -8
@@ -55,19 +55,21 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
55
55
  case v10_1.InteractionResponseType.DeferredChannelMessageWithSource:
56
56
  return body;
57
57
  case v10_1.InteractionResponseType.ChannelMessageWithSource:
58
- case v10_1.InteractionResponseType.UpdateMessage:
58
+ case v10_1.InteractionResponseType.UpdateMessage: {
59
+ const poll = body.poll;
59
60
  return {
60
61
  type: body.type,
61
- // @ts-ignore
62
+ //@ts-ignore
62
63
  data: {
63
- // @ts-ignore
64
64
  ...(body.data ?? {}),
65
- // @ts-ignore
65
+ //@ts-ignore
66
66
  components: body.data?.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
67
67
  embeds: body.data?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
68
68
  attachments: body.data?.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) })) ?? undefined,
69
+ poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
69
70
  },
70
71
  };
72
+ }
71
73
  case v10_1.InteractionResponseType.Modal:
72
74
  return {
73
75
  type: body.type,
@@ -87,38 +89,34 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
87
89
  }
88
90
  }
89
91
  static transformBody(body) {
92
+ const poll = body.poll;
90
93
  return {
91
94
  ...body,
92
95
  components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
93
96
  embeds: body?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
94
- // attachments: body.attachments?.map((x, i) => ({ id: i, ...resolveAttachment(x) })) ?? undefined,
97
+ poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
95
98
  };
96
99
  }
97
- matchReplied(data, type, filesParsed) {
98
- this.replied = (this.__reply ?? this.api.interactions(this.id)(this.token).callback.post)({
99
- // @ts-expect-error
100
- body: BaseInteraction.transformBodyRequest({ data, type }),
101
- files: filesParsed,
102
- }).then(() => (this.replied = true));
100
+ async matchReplied(body) {
101
+ if (this.__reply) {
102
+ //@ts-expect-error
103
+ const { files, ...data } = body.data ?? {};
104
+ return (this.replied = this.__reply({
105
+ body: BaseInteraction.transformBodyRequest({ data, type: body.type }),
106
+ files: files ? await (0, builders_1.resolveFiles)(files) : undefined,
107
+ }).then(() => (this.replied = true)));
108
+ }
109
+ return (this.replied = this.client.interactions.reply(this.id, this.token, body).then(() => (this.replied = true)));
103
110
  }
104
111
  async reply(body) {
105
112
  if (this.replied) {
106
113
  throw new Error('Interaction already replied');
107
114
  }
115
+ await this.matchReplied(body);
108
116
  // @ts-expect-error
109
- if (body.data?.files) {
110
- // @ts-expect-error
111
- const { files, ...rest } = body.data;
112
- this.matchReplied(rest, body.type, await (0, builders_1.resolveFiles)(files));
113
- // @ts-expect-error
114
- }
115
- else
116
- this.matchReplied(body.data, body.type);
117
- // @ts-expect-error
118
- if (body.data instanceof builders_1.Modal)
117
+ if (body.data instanceof builders_1.Modal && body.data.__exec)
119
118
  // @ts-expect-error
120
119
  this.client.components.modals.set(this.user.id, body.data.__exec);
121
- await this.replied;
122
120
  }
123
121
  deferReply(flags) {
124
122
  return this.reply({
@@ -191,7 +189,7 @@ class AutocompleteInteraction extends BaseInteraction {
191
189
  exports.AutocompleteInteraction = AutocompleteInteraction;
192
190
  class Interaction extends BaseInteraction {
193
191
  fetchMessage(messageId) {
194
- return this.client.webhooks.fetchMessage(this.applicationId, this.token, messageId);
192
+ return this.client.interactions.fetchResponse(this.token, messageId);
195
193
  }
196
194
  fetchResponse() {
197
195
  return this.fetchMessage('@original');
@@ -218,16 +216,8 @@ class Interaction extends BaseInteraction {
218
216
  }
219
217
  return this.write(body, fetchReply);
220
218
  }
221
- async editMessage(messageId, body) {
222
- const { files, ...data } = body;
223
- const apiMessage = await this.api
224
- .webhooks(this.applicationId)(this.token)
225
- .messages(messageId)
226
- .patch({
227
- body: BaseInteraction.transformBody(data),
228
- files: files ? await (0, builders_1.resolveFiles)(files) : undefined,
229
- });
230
- return new Message_1.Message(this.client, apiMessage);
219
+ editMessage(messageId, body) {
220
+ return this.client.interactions.editMessage(this.token, messageId, body);
231
221
  }
232
222
  editResponse(body) {
233
223
  return this.editMessage('@original', body);
@@ -236,21 +226,10 @@ class Interaction extends BaseInteraction {
236
226
  return this.deleteMessage('@original');
237
227
  }
238
228
  deleteMessage(messageId) {
239
- return this.api
240
- .webhooks(this.applicationId)(this.token)
241
- .messages(messageId)
242
- .delete()
243
- .then(() => this.client.components?.onMessageDelete(messageId === '@original' ? this.id : messageId));
244
- }
245
- async createResponse({ files, ...body }) {
246
- files ??= files ? await (0, builders_1.resolveFiles)(files) : undefined;
247
- const apiMessage = await this.api
248
- .webhooks(this.applicationId)(this.token)
249
- .post({
250
- body: BaseInteraction.transformBody(body),
251
- files: files,
252
- });
253
- return new Message_1.Message(this.client, apiMessage);
229
+ return this.client.interactions.deleteResponse(this.id, this.token, messageId);
230
+ }
231
+ async followup(body) {
232
+ return this.client.interactions.followup(this.token, body);
254
233
  }
255
234
  }
256
235
  exports.Interaction = Interaction;
@@ -10,8 +10,9 @@ import { GuildMember } from './GuildMember';
10
10
  import { User } from './User';
11
11
  import type { MessageWebhookMethodEditParams, MessageWebhookMethodWriteParams } from './Webhook';
12
12
  import { DiscordBase } from './extra/DiscordBase';
13
+ import { Poll } from '..';
13
14
  export type MessageData = APIMessage | GatewayMessageCreateDispatchData;
14
- export interface BaseMessage extends DiscordBase, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components'>> {
15
+ export interface BaseMessage extends DiscordBase, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll'>> {
15
16
  }
16
17
  export declare class BaseMessage extends DiscordBase {
17
18
  guildId: string | undefined;
@@ -19,6 +20,7 @@ export declare class BaseMessage extends DiscordBase {
19
20
  author: User;
20
21
  member?: GuildMember;
21
22
  components: MessageActionRowComponent<ActionRowMessageComponents>[];
23
+ poll?: Poll;
22
24
  mentions: {
23
25
  roles: string[];
24
26
  channels: APIChannelMention[];
@@ -27,7 +29,7 @@ export declare class BaseMessage extends DiscordBase {
27
29
  constructor(client: UsingClient, data: MessageData);
28
30
  get user(): User;
29
31
  createComponentCollector(options?: ListenerOptions): {
30
- run<T extends import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction> = import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction>>(customId: string | RegExp | string[], callback: import("../builders").ComponentCallback<T>): any;
32
+ run<T extends import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction> = import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction>>(customId: string | RegExp | string[], callback: import("..").ComponentCallback<T>): any;
31
33
  stop(reason?: string | undefined): any;
32
34
  };
33
35
  get url(): string;
@@ -36,7 +38,7 @@ export declare class BaseMessage extends DiscordBase {
36
38
  react(emoji: EmojiResolvable): Promise<void>;
37
39
  private patch;
38
40
  }
39
- export interface Message extends BaseMessage, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components'>> {
41
+ export interface Message extends BaseMessage, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll'>> {
40
42
  }
41
43
  export declare class Message extends BaseMessage {
42
44
  constructor(client: UsingClient, data: MessageData);
@@ -6,12 +6,14 @@ const GuildMember_1 = require("./GuildMember");
6
6
  const User_1 = require("./User");
7
7
  const DiscordBase_1 = require("./extra/DiscordBase");
8
8
  const functions_1 = require("./extra/functions");
9
+ const __1 = require("..");
9
10
  class BaseMessage extends DiscordBase_1.DiscordBase {
10
11
  guildId;
11
12
  timestamp;
12
13
  author;
13
14
  member;
14
15
  components;
16
+ poll;
15
17
  mentions;
16
18
  constructor(client, data) {
17
19
  super(client, data);
@@ -70,6 +72,9 @@ class BaseMessage extends DiscordBase_1.DiscordBase {
70
72
  }, m, this.guildId))
71
73
  : data.mentions.map(u => new User_1.User(this.client, u));
72
74
  }
75
+ if (data.poll) {
76
+ this.poll = new __1.Poll(this.client, data.poll, this.channelId, this.id);
77
+ }
73
78
  }
74
79
  }
75
80
  exports.BaseMessage = BaseMessage;
@@ -0,0 +1,15 @@
1
+ import type { APIPoll } from 'discord-api-types/v10';
2
+ import { type ObjectToLower } from '../common';
3
+ import { Base } from './extra/Base';
4
+ import type { UsingClient } from '../commands';
5
+ import type { ValidAnswerId } from '../api/Routes/channels';
6
+ export interface Poll extends ObjectToLower<Omit<APIPoll, 'expiry'>> {
7
+ }
8
+ export declare class Poll extends Base {
9
+ readonly channelId: string;
10
+ readonly messageId: string;
11
+ expiry: number;
12
+ constructor(client: UsingClient, data: APIPoll, channelId: string, messageId: string);
13
+ end(): Promise<import("./Message").Message>;
14
+ getAnswerVoters(id: ValidAnswerId): Promise<import("./User").User[]>;
15
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Poll = void 0;
4
+ const common_1 = require("../common");
5
+ const Base_1 = require("./extra/Base");
6
+ class Poll extends Base_1.Base {
7
+ channelId;
8
+ messageId;
9
+ expiry;
10
+ constructor(client, data, channelId, messageId) {
11
+ super(client);
12
+ this.channelId = channelId;
13
+ this.messageId = messageId;
14
+ this.expiry = Date.parse(data.expiry);
15
+ Object.assign(this, (0, common_1.toCamelCase)(data));
16
+ }
17
+ end() {
18
+ return this.client.messages.endPoll(this.channelId, this.messageId);
19
+ }
20
+ getAnswerVoters(id) {
21
+ if (!this.answers.find(x => x.answerId === id))
22
+ throw new Error('Invalid answer id');
23
+ return this.client.messages.getAnswerVoters(this.channelId, this.messageId, id);
24
+ }
25
+ }
26
+ exports.Poll = Poll;
@@ -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,8 +27,7 @@ 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.embed.avatars.get(avatarIndex);
30
+ return this.rest.cdn.embed.avatars.get((0, api_1.calculateUserDefaultAvatarIndex)(this.id, this.discriminator));
31
31
  }
32
32
  return this.rest.cdn.avatars(this.id).get(this.avatar, options);
33
33
  }
@@ -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
  };
@@ -115,7 +115,7 @@ export declare class MessagesMethods extends DiscordBase {
115
115
  crosspost: (messageId: string, reason?: string) => Promise<import("./Message").Message>;
116
116
  delete: (messageId: string, reason?: string) => Promise<void>;
117
117
  fetch: (messageId: string) => Promise<import("./Message").Message>;
118
- purge: (messages: string[], reason?: string) => Promise<never>;
118
+ purge: (messages: string[], reason?: string) => Promise<void | undefined>;
119
119
  };
120
120
  pins: {
121
121
  fetch: () => Promise<import("./Message").Message[]>;
@@ -136,7 +136,7 @@ export declare class MessagesMethods extends DiscordBase {
136
136
  crosspost: (messageId: string, reason?: string) => Promise<import("./Message").Message>;
137
137
  delete: (messageId: string, reason?: string) => Promise<void>;
138
138
  fetch: (messageId: string) => Promise<import("./Message").Message>;
139
- purge: (messages: string[], reason?: string) => Promise<never>;
139
+ purge: (messages: string[], reason?: string) => Promise<void | undefined>;
140
140
  };
141
141
  static reactions(ctx: MethodContext<{
142
142
  channelId: string;
@@ -183,6 +183,7 @@ export declare class VoiceChannelMethods extends DiscordBase {
183
183
  setUserLimit(user_limit: number | null, reason?: string): Promise<AllChannels>;
184
184
  setRTC(rtc_region: string | null, reason?: string): Promise<AllChannels>;
185
185
  setVideoQuality(quality: keyof typeof VideoQualityMode, reason?: string): Promise<AllChannels>;
186
+ setVoiceState(status?: string | null): Promise<never>;
186
187
  states(): Promise<import("./VoiceState").VoiceState[]>;
187
188
  }
188
189
  export declare class WebhookGuildMethods extends DiscordBase {
@@ -248,6 +249,8 @@ export declare class ThreadChannel extends BaseChannel<ChannelType.PublicThread
248
249
  list: () => Promise<import("./Webhook").Webhook[]>;
249
250
  create: (body: RESTPostAPIChannelWebhookJSONBody) => Promise<import("./Webhook").Webhook>;
250
251
  };
252
+ join(): Promise<this>;
253
+ leave(): Promise<this>;
251
254
  setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<AllChannels>;
252
255
  pin(reason?: string): Promise<AllChannels>;
253
256
  unpin(reason?: string): Promise<AllChannels>;
@@ -267,7 +270,7 @@ export interface NewsChannel extends ObjectToLower<APINewsChannel>, WebhookChann
267
270
  }
268
271
  export declare class NewsChannel extends BaseChannel<ChannelType.GuildAnnouncement> {
269
272
  type: ChannelType.GuildAnnouncement;
270
- 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>;
271
274
  }
272
275
  export declare class DirectoryChannel extends BaseChannel<ChannelType.GuildDirectory> {
273
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;
@@ -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 = {
@@ -74,7 +74,7 @@ class Shard {
74
74
  async send(force, message) {
75
75
  this.debugger?.info(`[Shard #${this.id}] Sending: ${v10_1.GatewayOpcodes[message.op]} ${JSON.stringify(message.d, (_, value) => {
76
76
  if (typeof value === 'string')
77
- return value.replace(this.options.token, v => {
77
+ return value.replaceAll(this.options.token, v => {
78
78
  const split = v.split('.');
79
79
  return `${split[0]}.${'*'.repeat(split[1].length)}.${'*'.repeat(split[2].length)}`;
80
80
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "1.2.3",
3
+ "version": "1.3.1",
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
+ }