seyfert 1.0.1 → 1.1.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 (103) hide show
  1. package/lib/api/CDN.d.ts +1 -1
  2. package/lib/api/CDN.js +0 -2
  3. package/lib/api/Router.js +2 -2
  4. package/lib/api/Routes/applications.d.ts +29 -33
  5. package/lib/api/Routes/channels.d.ts +11 -17
  6. package/lib/api/Routes/interactions.d.ts +3 -7
  7. package/lib/api/Routes/webhooks.d.ts +4 -6
  8. package/lib/builders/Attachment.d.ts +2 -3
  9. package/lib/cache/adapters/redis.js +6 -0
  10. package/lib/cache/adapters/workeradapter.d.ts +4 -4
  11. package/lib/cache/adapters/workeradapter.js +10 -5
  12. package/lib/cache/index.d.ts +4 -5
  13. package/lib/cache/index.js +4 -3
  14. package/lib/cache/resources/default/base.d.ts +2 -1
  15. package/lib/cache/resources/default/guild-based.d.ts +2 -1
  16. package/lib/cache/resources/default/guild-based.js +6 -6
  17. package/lib/cache/resources/default/guild-related.d.ts +2 -1
  18. package/lib/cache/resources/default/guild-related.js +1 -1
  19. package/lib/cache/resources/guilds.js +2 -1
  20. package/lib/cache/resources/overwrites.d.ts +1 -1
  21. package/lib/cache/resources/overwrites.js +7 -1
  22. package/lib/client/base.d.ts +18 -170
  23. package/lib/client/base.js +11 -14
  24. package/lib/client/client.d.ts +5 -0
  25. package/lib/client/client.js +4 -1
  26. package/lib/client/oninteractioncreate.js +2 -2
  27. package/lib/client/onmessagecreate.js +188 -152
  28. package/lib/client/workerclient.d.ts +1 -0
  29. package/lib/client/workerclient.js +36 -15
  30. package/lib/collection.js +2 -2
  31. package/lib/commands/applications/chat.d.ts +15 -7
  32. package/lib/commands/applications/chat.js +7 -7
  33. package/lib/commands/applications/chatcontext.d.ts +5 -3
  34. package/lib/commands/applications/chatcontext.js +6 -1
  35. package/lib/commands/applications/menu.d.ts +5 -1
  36. package/lib/commands/applications/menu.js +4 -0
  37. package/lib/commands/applications/menucontext.d.ts +4 -2
  38. package/lib/commands/applications/menucontext.js +6 -1
  39. package/lib/commands/applications/options.d.ts +1 -2
  40. package/lib/commands/decorators.d.ts +17 -5
  41. package/lib/commands/decorators.js +17 -7
  42. package/lib/commands/handler.d.ts +5 -5
  43. package/lib/commands/handler.js +40 -36
  44. package/lib/commands/optionresolver.d.ts +11 -4
  45. package/lib/commands/optionresolver.js +6 -4
  46. package/lib/common/index.d.ts +7 -0
  47. package/lib/common/index.js +7 -0
  48. package/lib/common/it/utils.js +2 -0
  49. package/lib/common/shorters/channels.d.ts +67 -129
  50. package/lib/common/shorters/channels.js +119 -135
  51. package/lib/common/shorters/emojis.d.ts +47 -0
  52. package/lib/common/shorters/emojis.js +80 -0
  53. package/lib/common/shorters/guilds.d.ts +22 -249
  54. package/lib/common/shorters/guilds.js +51 -140
  55. package/lib/common/shorters/members.d.ts +82 -108
  56. package/lib/common/shorters/members.js +151 -166
  57. package/lib/common/shorters/messages.d.ts +11 -23
  58. package/lib/common/shorters/messages.js +58 -104
  59. package/lib/common/shorters/reactions.d.ts +10 -0
  60. package/lib/common/shorters/reactions.js +45 -0
  61. package/lib/common/shorters/roles.d.ts +39 -7
  62. package/lib/common/shorters/roles.js +74 -42
  63. package/lib/common/shorters/templates.d.ts +6 -8
  64. package/lib/common/shorters/templates.js +17 -21
  65. package/lib/common/shorters/users.d.ts +4 -0
  66. package/lib/common/shorters/users.js +30 -0
  67. package/lib/common/shorters/webhook.d.ts +62 -26
  68. package/lib/common/shorters/webhook.js +113 -58
  69. package/lib/common/types/options.d.ts +2 -2
  70. package/lib/components/handler.d.ts +10 -7
  71. package/lib/components/handler.js +20 -5
  72. package/lib/index.d.ts +4 -2
  73. package/lib/langs/handler.js +7 -2
  74. package/lib/structures/AutoModerationRule.d.ts +2 -2
  75. package/lib/structures/ClientUser.d.ts +2 -2
  76. package/lib/structures/Guild.d.ts +2 -2
  77. package/lib/structures/GuildEmoji.d.ts +4 -4
  78. package/lib/structures/GuildEmoji.js +7 -7
  79. package/lib/structures/GuildMember.d.ts +6 -6
  80. package/lib/structures/GuildMember.js +2 -2
  81. package/lib/structures/GuildPreview.d.ts +2 -2
  82. package/lib/structures/GuildRole.d.ts +2 -2
  83. package/lib/structures/GuildTemplate.d.ts +2 -2
  84. package/lib/structures/Interaction.d.ts +7 -8
  85. package/lib/structures/Interaction.js +1 -1
  86. package/lib/structures/Message.d.ts +7 -6
  87. package/lib/structures/Message.js +7 -4
  88. package/lib/structures/Sticker.d.ts +2 -2
  89. package/lib/structures/Webhook.d.ts +2 -2
  90. package/lib/structures/Webhook.js +3 -3
  91. package/lib/structures/channels.d.ts +19 -20
  92. package/lib/structures/channels.js +13 -25
  93. package/lib/structures/extra/Base.d.ts +1 -2
  94. package/lib/structures/extra/DiscordBase.d.ts +2 -2
  95. package/lib/websocket/constants/index.js +1 -0
  96. package/lib/websocket/discord/shard.js +4 -2
  97. package/lib/websocket/discord/sharder.d.ts +3 -0
  98. package/lib/websocket/discord/sharder.js +12 -5
  99. package/lib/websocket/discord/shared.d.ts +1 -0
  100. package/lib/websocket/discord/worker.d.ts +2 -1
  101. package/lib/websocket/discord/workermanager.d.ts +8 -3
  102. package/lib/websocket/discord/workermanager.js +78 -30
  103. package/package.json +8 -6
@@ -5,65 +5,120 @@ const builders_1 = require("../../builders");
5
5
  const structures_1 = require("../../structures");
6
6
  const base_1 = require("./base");
7
7
  class WebhookShorter extends base_1.BaseShorter {
8
- get webhooks() {
9
- return {
10
- delete: (webhookId, { token, reason }) => {
11
- if (token) {
12
- return this.client.proxy.webhooks(webhookId)(token).delete({ reason, auth: false });
13
- }
14
- return this.client.proxy.webhooks(webhookId).delete({ reason });
15
- },
16
- edit: (webhookId, body, { token, reason }) => {
17
- if (token) {
18
- return this.client.proxy.webhooks(webhookId)(token).patch({ body, reason, auth: false });
19
- }
20
- return this.client.proxy.webhooks(webhookId).patch({ body, reason });
21
- },
22
- fetch: async (webhookId, token) => {
23
- let webhook;
24
- if (token) {
25
- webhook = await this.client.proxy.webhooks(webhookId)(token).get({ auth: false });
26
- }
27
- else {
28
- webhook = await this.client.proxy.webhooks(webhookId).get();
29
- }
30
- return new structures_1.Webhook(this.client, webhook);
31
- },
32
- messages: this.messages,
33
- };
8
+ async create(channelId, body) {
9
+ const webhook = await this.client.proxy.channels(channelId).webhooks.post({
10
+ body,
11
+ });
12
+ return new structures_1.Webhook(this.client, webhook);
34
13
  }
35
- get messages() {
36
- return {
37
- write: async (webhookId, token, { body: data, ...payload }) => {
38
- const { files, ...body } = data;
39
- const transformedBody = structures_1.MessagesMethods.transformMessageBody(body);
40
- const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : [];
41
- return this.client.proxy
42
- .webhooks(webhookId)(token)
43
- .post({ ...payload, files: parsedFiles, body: transformedBody })
44
- .then(m => (m?.id ? new structures_1.WebhookMessage(this.client, m, webhookId, token) : null));
45
- },
46
- edit: async (webhookId, token, { messageId, body: data, ...json }) => {
47
- const { files, ...body } = data;
48
- const transformedBody = structures_1.MessagesMethods.transformMessageBody(body);
49
- const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : [];
50
- return this.client.proxy
51
- .webhooks(webhookId)(token)
52
- .messages(messageId)
53
- .patch({ ...json, auth: false, files: parsedFiles, body: transformedBody })
54
- .then(m => new structures_1.WebhookMessage(this.client, m, webhookId, token));
55
- },
56
- delete: async (webhookId, token, messageId, reason) => {
57
- return this.client.proxy.webhooks(webhookId)(token).messages(messageId).delete({ reason });
58
- },
59
- fetch: async (webhookId, token, messageId, threadId) => {
60
- const message = await this.client.proxy
61
- .webhooks(webhookId)(token)
62
- .messages(messageId)
63
- .get({ auth: false, query: { threadId } });
64
- return message ? new structures_1.WebhookMessage(this.client, message, webhookId, token) : undefined;
65
- },
66
- };
14
+ /**
15
+ * Deletes a webhook.
16
+ * @param webhookId The ID of the webhook.
17
+ * @param options The optional parameters including token and reason.
18
+ * @returns A Promise that resolves when the webhook is deleted.
19
+ */
20
+ delete(webhookId, options) {
21
+ if (options.token) {
22
+ return this.client.proxy.webhooks(webhookId)(options.token).delete({ reason: options.reason, auth: false });
23
+ }
24
+ return this.client.proxy.webhooks(webhookId).delete({ reason: options.reason });
25
+ }
26
+ /**
27
+ * Edits a webhook.
28
+ * @param webhookId The ID of the webhook.
29
+ * @param body The data to update the webhook with.
30
+ * @param options The optional parameters including token and reason.
31
+ * @returns A Promise that resolves when the webhook is edited.
32
+ */
33
+ edit(webhookId, body, options) {
34
+ if (options.token) {
35
+ return this.client.proxy.webhooks(webhookId)(options.token).patch({ body, reason: options.reason, auth: false });
36
+ }
37
+ return this.client.proxy.webhooks(webhookId).patch({ body, reason: options.reason });
38
+ }
39
+ /**
40
+ * Fetches a webhook.
41
+ * @param webhookId The ID of the webhook.
42
+ * @param token The token of the webhook (optional).
43
+ * @returns A Promise that resolves to the fetched webhook.
44
+ */
45
+ async fetch(webhookId, token) {
46
+ let webhook;
47
+ if (token) {
48
+ webhook = await this.client.proxy.webhooks(webhookId)(token).get({ auth: false });
49
+ }
50
+ else {
51
+ webhook = await this.client.proxy.webhooks(webhookId).get();
52
+ }
53
+ return new structures_1.Webhook(this.client, webhook);
54
+ }
55
+ /**
56
+ * Writes a message using the webhook.
57
+ * @param webhookId The ID of the webhook.
58
+ * @param token The token of the webhook.
59
+ * @param data The data for writing the message.
60
+ * @returns A Promise that resolves to the written message.
61
+ */
62
+ async writeMessage(webhookId, token, { body: data, ...payload }) {
63
+ const { files, ...body } = data;
64
+ const transformedBody = structures_1.MessagesMethods.transformMessageBody(body);
65
+ const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : [];
66
+ return this.client.proxy
67
+ .webhooks(webhookId)(token)
68
+ .post({ ...payload, files: parsedFiles, body: transformedBody })
69
+ .then(m => (m?.id ? new structures_1.WebhookMessage(this.client, m, webhookId, token) : null));
70
+ }
71
+ /**
72
+ * Edits a message sent by the webhook.
73
+ * @param webhookId The ID of the webhook.
74
+ * @param token The token of the webhook.
75
+ * @param messageId The ID of the message to edit.
76
+ * @param data The data for editing the message.
77
+ * @returns A Promise that resolves to the edited message.
78
+ */
79
+ async editMessage(webhookId, token, { messageId, body: data, ...json }) {
80
+ const { files, ...body } = data;
81
+ const transformedBody = structures_1.MessagesMethods.transformMessageBody(body);
82
+ const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : [];
83
+ return this.client.proxy
84
+ .webhooks(webhookId)(token)
85
+ .messages(messageId)
86
+ .patch({ ...json, auth: false, files: parsedFiles, body: transformedBody })
87
+ .then(m => new structures_1.WebhookMessage(this.client, m, webhookId, token));
88
+ }
89
+ /**
90
+ * Deletes a message sent by the webhook.
91
+ * @param webhookId The ID of the webhook.
92
+ * @param token The token of the webhook.
93
+ * @param messageId The ID of the message to delete.
94
+ * @param reason The reason for deleting the message.
95
+ * @returns A Promise that resolves when the message is deleted.
96
+ */
97
+ deleteMessage(webhookId, token, messageId, reason) {
98
+ return this.client.proxy.webhooks(webhookId)(token).messages(messageId).delete({ reason });
99
+ }
100
+ /**
101
+ * Fetches a message sent by the webhook.
102
+ * @param webhookId The ID of the webhook.
103
+ * @param token The token of the webhook.
104
+ * @param messageId The ID of the message to fetch.
105
+ * @param threadId The ID of the thread the message belongs to.
106
+ * @returns A Promise that resolves to the fetched message, or undefined if not found.
107
+ */
108
+ async fetchMessage(webhookId, token, messageId, threadId) {
109
+ const message = await this.client.proxy
110
+ .webhooks(webhookId)(token)
111
+ .messages(messageId)
112
+ .get({ auth: false, query: { threadId } });
113
+ return message ? new structures_1.WebhookMessage(this.client, message, webhookId, token) : undefined;
114
+ }
115
+ async listFromGuild(guildId) {
116
+ const webhooks = await this.client.proxy.guilds(guildId).webhooks.get();
117
+ return webhooks.map(webhook => new structures_1.Webhook(this.client, webhook));
118
+ }
119
+ async listFromChannel(channelId) {
120
+ const webhooks = await this.client.proxy.channels(channelId).webhooks.get();
121
+ return webhooks.map(webhook => new structures_1.Webhook(this.client, webhook));
67
122
  }
68
123
  }
69
124
  exports.WebhookShorter = WebhookShorter;
@@ -1,9 +1,9 @@
1
1
  import type { Identify } from '..';
2
2
  import type { ImageURLOptions } from '../../api';
3
- import type { BaseClient } from '../../client/base';
3
+ import type { UsingClient } from '../../commands';
4
4
  export type ImageOptions = ImageURLOptions;
5
5
  export type MethodContext<T = {}> = Identify<{
6
- client: BaseClient;
6
+ client: UsingClient;
7
7
  } & T>;
8
8
  export type MessageWebhookPayload<Body, Extra = {}> = Identify<{
9
9
  body: Body;
@@ -1,33 +1,36 @@
1
1
  /// <reference types="node" />
2
2
  import type { ComponentCallback, ListenerOptions, ModalSubmitCallback } from '../builders/types';
3
- import type { BaseClient } from '../client/base';
4
3
  import { LimitedCollection } from '../collection';
4
+ import type { UsingClient } from '../commands';
5
5
  import { BaseHandler, type Logger, type OnFailCallback } from '../common';
6
6
  import type { ComponentInteraction, ModalSubmitInteraction } from '../structures';
7
7
  import { ComponentCommand, ModalCommand } from './command';
8
8
  type COMPONENTS = {
9
- components: Partial<Record<string, ComponentCallback>>;
9
+ components: {
10
+ match: string | string[] | RegExp;
11
+ callback: ComponentCallback;
12
+ }[];
10
13
  options?: ListenerOptions;
11
14
  messageId?: string;
12
15
  idle?: NodeJS.Timeout;
13
16
  timeout?: NodeJS.Timeout;
14
- __run: (customId: string, callback: ComponentCallback) => any;
17
+ __run: (customId: string | string[] | RegExp, callback: ComponentCallback) => any;
15
18
  };
16
19
  export declare class ComponentHandler extends BaseHandler {
17
- protected client: BaseClient;
20
+ protected client: UsingClient;
18
21
  protected onFail?: OnFailCallback;
19
22
  readonly values: Map<string, COMPONENTS>;
20
23
  readonly modals: LimitedCollection<string, ModalSubmitCallback>;
21
24
  readonly commands: (ComponentCommand | ModalCommand)[];
22
25
  protected filter: (path: string) => boolean;
23
- constructor(logger: Logger, client: BaseClient);
26
+ constructor(logger: Logger, client: UsingClient);
24
27
  set OnFail(cb: OnFailCallback);
25
28
  createComponentCollector(messageId: string, options?: ListenerOptions): {
26
- run: (customId: string, callback: ComponentCallback) => any;
29
+ run: (customId: string | RegExp | string[], callback: ComponentCallback) => any;
27
30
  stop: (reason?: string) => void;
28
31
  };
29
32
  onComponent(id: string, interaction: ComponentInteraction): Promise<void>;
30
- hasComponent(id: string, customId: string): ComponentCallback | undefined;
33
+ hasComponent(id: string, customId: string): boolean | undefined;
31
34
  resetTimeouts(id: string): void;
32
35
  hasModal(interaction: ModalSubmitInteraction): boolean;
33
36
  onModalSubmit(interaction: ModalSubmitInteraction): any;
@@ -21,7 +21,7 @@ class ComponentHandler extends common_1.BaseHandler {
21
21
  }
22
22
  createComponentCollector(messageId, options = {}) {
23
23
  this.values.set(messageId, {
24
- components: {},
24
+ components: [],
25
25
  options,
26
26
  idle: options.idle
27
27
  ? setTimeout(() => {
@@ -41,7 +41,10 @@ class ComponentHandler extends common_1.BaseHandler {
41
41
  : undefined,
42
42
  __run: (customId, callback) => {
43
43
  if (this.values.has(messageId)) {
44
- this.values.get(messageId).components[customId] = callback;
44
+ this.values.get(messageId).components.push({
45
+ callback,
46
+ match: customId,
47
+ });
45
48
  }
46
49
  },
47
50
  });
@@ -57,7 +60,13 @@ class ComponentHandler extends common_1.BaseHandler {
57
60
  }
58
61
  async onComponent(id, interaction) {
59
62
  const row = this.values.get(id);
60
- const component = row?.components?.[interaction.customId];
63
+ const component = row?.components?.find(x => {
64
+ if (typeof x.match === 'string')
65
+ return x.match === interaction.customId;
66
+ if (Array.isArray(x.match))
67
+ return x.match.includes(interaction.customId);
68
+ return interaction.customId.match(x.match);
69
+ });
61
70
  if (!component)
62
71
  return;
63
72
  if (row.options?.filter) {
@@ -65,7 +74,7 @@ class ComponentHandler extends common_1.BaseHandler {
65
74
  return;
66
75
  }
67
76
  row.idle?.refresh();
68
- await component(interaction, reason => {
77
+ await component.callback(interaction, reason => {
69
78
  row.options?.onStop?.(reason ?? 'stop');
70
79
  this.deleteValue(id);
71
80
  }, () => {
@@ -73,7 +82,13 @@ class ComponentHandler extends common_1.BaseHandler {
73
82
  });
74
83
  }
75
84
  hasComponent(id, customId) {
76
- return this.values.get(id)?.components?.[customId];
85
+ return this.values.get(id)?.components?.some(x => {
86
+ if (typeof x.match === 'string')
87
+ return x.match === customId;
88
+ if (Array.isArray(x.match))
89
+ return x.match.includes(customId);
90
+ return customId.match(x.match);
91
+ });
77
92
  }
78
93
  resetTimeouts(id) {
79
94
  const listener = this.values.get(id);
package/lib/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { InternalRuntimeConfig, InternalRuntimeConfigHTTP, RuntimeConfig, RuntimeConfigHTTP } from './client/base';
2
+ import type { InferWithPrefix } from './commands';
3
+ import { type When } from './common';
2
4
  import type { ClientNameEvents, EventContext } from './events';
3
- import type { ChatInputCommandInteraction, MessageCommandInteraction, UserCommandInteraction } from './structures';
5
+ import type { ChatInputCommandInteraction, Message, MessageCommandInteraction, UserCommandInteraction } from './structures';
4
6
  export { Logger, PermissionFlagsBits, PermissionStrings, Watcher } from './common';
5
7
  export { Collection, LimitedCollection } from './collection';
6
8
  export * from './api';
@@ -79,4 +81,4 @@ export declare const config: {
79
81
  * };
80
82
  * });
81
83
  */
82
- export declare function extendContext<T extends {}>(cb: (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction) => T): (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction) => T;
84
+ export declare function extendContext<T extends {}>(cb: (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | When<InferWithPrefix, Message, never>) => T): (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | When<InferWithPrefix, Message, never>) => T;
@@ -13,8 +13,13 @@ class LangsHandler extends common_1.BaseHandler {
13
13
  }
14
14
  getKey(lang, message) {
15
15
  let value = this.values[lang];
16
- for (const i of message.split('.')) {
17
- value = value[i];
16
+ try {
17
+ for (const i of message.split('.')) {
18
+ value = value[i];
19
+ }
20
+ }
21
+ catch {
22
+ return;
18
23
  }
19
24
  if (typeof value !== 'string') {
20
25
  return;
@@ -1,10 +1,10 @@
1
- import type { BaseClient } from '../client/base';
1
+ import type { UsingClient } from '../commands';
2
2
  import type { APIAutoModerationRule, MethodContext, ObjectToLower, RESTPatchAPIAutoModerationRuleJSONBody, RESTPostAPIAutoModerationRuleJSONBody } from '../common';
3
3
  import { DiscordBase } from './extra/DiscordBase';
4
4
  export interface AutoModerationRule extends ObjectToLower<APIAutoModerationRule> {
5
5
  }
6
6
  export declare class AutoModerationRule extends DiscordBase<APIAutoModerationRule> {
7
- constructor(client: BaseClient, data: APIAutoModerationRule);
7
+ constructor(client: UsingClient, data: APIAutoModerationRule);
8
8
  fetchCreator(force?: boolean): Promise<import("./GuildMember").GuildMember>;
9
9
  guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
10
10
  fetch(): Promise<APIAutoModerationRule>;
@@ -1,10 +1,10 @@
1
- import type { BaseClient } from '../client/base';
1
+ import type { UsingClient } from '../commands';
2
2
  import type { GatewayReadyDispatchData, RESTPatchAPICurrentUserJSONBody } from '../common';
3
3
  import { User } from './User';
4
4
  export declare class ClientUser extends User {
5
5
  application: GatewayReadyDispatchData['application'];
6
6
  bot: boolean;
7
- constructor(client: BaseClient, data: GatewayReadyDispatchData['user'], application: GatewayReadyDispatchData['application']);
7
+ constructor(client: UsingClient, data: GatewayReadyDispatchData['user'], application: GatewayReadyDispatchData['application']);
8
8
  fetch(): Promise<ClientUser>;
9
9
  edit(body: RESTPatchAPICurrentUserJSONBody): Promise<ClientUser>;
10
10
  }
@@ -1,4 +1,4 @@
1
- import type { BaseClient } from '../client/base';
1
+ import type { UsingClient } from '../commands';
2
2
  import type { APIGuild, GatewayGuildCreateDispatchData, ObjectToLower } from '../common';
3
3
  import type { StructPropState, StructStates, ToClass } from '../common/types/util';
4
4
  import { GuildEmoji } from './GuildEmoji';
@@ -15,7 +15,7 @@ export declare class Guild<State extends StructStates = 'api'> extends Guild_bas
15
15
  memberCount: StructPropState<number, State, 'create'>;
16
16
  large: StructPropState<boolean, State, 'create'>;
17
17
  unavailable?: StructPropState<boolean, State, 'create'>;
18
- constructor(client: BaseClient, data: APIGuild | GatewayGuildCreateDispatchData);
18
+ constructor(client: UsingClient, data: APIGuild | GatewayGuildCreateDispatchData);
19
19
  webhooks: {
20
20
  list: () => Promise<import("./Webhook").Webhook[]>;
21
21
  };
@@ -1,12 +1,12 @@
1
1
  import type { BaseImageURLOptions } from '../api';
2
- import type { BaseClient } from '../client/base';
3
- import type { APIEmoji, GuildShorter, MethodContext, ObjectToLower, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildEmojiJSONBody } from '../common';
2
+ import type { UsingClient } from '../commands';
3
+ import type { APIEmoji, EmojiShorter, MethodContext, ObjectToLower, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildEmojiJSONBody } from '../common';
4
4
  import { DiscordBase } from './extra/DiscordBase';
5
5
  export interface GuildEmoji extends DiscordBase, ObjectToLower<Omit<APIEmoji, 'id'>> {
6
6
  }
7
7
  export declare class GuildEmoji extends DiscordBase {
8
8
  readonly guildId: string;
9
- constructor(client: BaseClient, data: APIEmoji, guildId: string);
9
+ constructor(client: UsingClient, data: APIEmoji, guildId: string);
10
10
  guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">> | undefined;
11
11
  edit(body: RESTPatchAPIChannelJSONBody, reason?: string): Promise<GuildEmoji>;
12
12
  delete(reason?: string): Promise<void>;
@@ -22,7 +22,7 @@ export declare class GuildEmoji extends DiscordBase {
22
22
  guildId: string;
23
23
  }>): {
24
24
  edit: (emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string) => Promise<GuildEmoji>;
25
- create: (body: Parameters<GuildShorter['emojis']['create']>[1]) => Promise<void>;
25
+ create: (body: Parameters<EmojiShorter['create']>[1]) => Promise<void>;
26
26
  fetch: (emojiId: string, force?: boolean) => Promise<GuildEmoji>;
27
27
  list: (force?: boolean) => Promise<GuildEmoji[]>;
28
28
  };
@@ -14,13 +14,13 @@ class GuildEmoji extends DiscordBase_1.DiscordBase {
14
14
  return this.client.guilds.fetch(this.guildId, force);
15
15
  }
16
16
  edit(body, reason) {
17
- return this.client.guilds.emojis.edit(this.guildId, this.id, body, reason);
17
+ return this.client.emojis.edit(this.guildId, this.id, body, reason);
18
18
  }
19
19
  delete(reason) {
20
- return this.client.guilds.emojis.delete(this.guildId, this.id, reason);
20
+ return this.client.emojis.delete(this.guildId, this.id, reason);
21
21
  }
22
22
  fetch(force = false) {
23
- return this.client.guilds.emojis.fetch(this.guildId, this.id, force);
23
+ return this.client.emojis.fetch(this.guildId, this.id, force);
24
24
  }
25
25
  url(options) {
26
26
  return this.rest.cdn.emoji(this.id, options);
@@ -37,10 +37,10 @@ class GuildEmoji extends DiscordBase_1.DiscordBase {
37
37
  }
38
38
  static methods({ client, guildId }) {
39
39
  return {
40
- edit: (emojiId, body, reason) => client.guilds.emojis.edit(guildId, emojiId, body, reason),
41
- create: (body) => client.guilds.emojis.create(guildId, body),
42
- fetch: (emojiId, force = false) => client.guilds.emojis.fetch(guildId, emojiId, force),
43
- list: (force = false) => client.guilds.emojis.list(guildId, force),
40
+ edit: (emojiId, body, reason) => client.emojis.edit(guildId, emojiId, body, reason),
41
+ create: (body) => client.emojis.create(guildId, body),
42
+ fetch: (emojiId, force = false) => client.emojis.fetch(guildId, emojiId, force),
43
+ list: (force = false) => client.emojis.list(guildId, force),
44
44
  };
45
45
  }
46
46
  }
@@ -1,7 +1,7 @@
1
1
  import type { APIGuildMember, APIInteractionDataResolvedGuildMember, APIUser, GatewayGuildMemberAddDispatchData, GatewayGuildMemberUpdateDispatchData, MakeRequired, MessageCreateBodyRequest, ObjectToLower, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersSearchQuery, RESTPatchAPIGuildMemberJSONBody, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildMemberJSONBody, ToClass } from '../common';
2
2
  import { DiscordBase } from './extra/DiscordBase';
3
3
  export type GuildMemberData = APIGuildMember | GatewayGuildMemberUpdateDispatchData | GatewayGuildMemberAddDispatchData | APIInteractionDataResolvedGuildMember;
4
- import type { BaseClient } from '../client/base';
4
+ import type { UsingClient } from '../commands';
5
5
  import type { ImageOptions, MethodContext } from '../common/types/options';
6
6
  import type { GuildMemberResolvable } from '../common/types/resolvables';
7
7
  import { User } from './User';
@@ -17,7 +17,7 @@ export declare class BaseGuildMember extends DiscordBase {
17
17
  private _roles;
18
18
  joinedTimestamp?: number;
19
19
  communicationDisabledUntilTimestamp?: number | null;
20
- constructor(client: BaseClient, data: GuildMemberData, id: string,
20
+ constructor(client: UsingClient, data: GuildMemberData, id: string,
21
21
  /** the choosen guild id */
22
22
  guildId: string);
23
23
  guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
@@ -39,8 +39,8 @@ export declare class BaseGuildMember extends DiscordBase {
39
39
  private patch;
40
40
  get roles(): {
41
41
  values: readonly string[];
42
- add: (id: string) => Promise<void>;
43
- remove: (id: string) => Promise<void>;
42
+ add: (id: string) => void;
43
+ remove: (id: string) => Promise<never>;
44
44
  permissions: () => Promise<PermissionsBitField>;
45
45
  };
46
46
  static methods({ client, guildId }: MethodContext<{
@@ -67,7 +67,7 @@ export declare class GuildMember extends BaseGuildMember {
67
67
  /** the choosen guild id */
68
68
  readonly guildId: string;
69
69
  user: User;
70
- constructor(client: BaseClient, data: GuildMemberData, user: APIUser | User,
70
+ constructor(client: UsingClient, data: GuildMemberData, user: APIUser | User,
71
71
  /** the choosen guild id */
72
72
  guildId: string);
73
73
  get tag(): string;
@@ -97,7 +97,7 @@ declare const InteractionGuildMember_base: ToClass<Omit<GuildMember, "deaf" | "m
97
97
  */
98
98
  export declare class InteractionGuildMember extends InteractionGuildMember_base {
99
99
  permissions: PermissionsBitField;
100
- constructor(client: BaseClient, data: APIInteractionDataResolvedGuildMember, user: APIUser | User,
100
+ constructor(client: UsingClient, data: APIInteractionDataResolvedGuildMember, user: APIUser | User,
101
101
  /** the choosen guild id */
102
102
  guildId: string);
103
103
  }
@@ -55,8 +55,8 @@ class BaseGuildMember extends DiscordBase_1.DiscordBase {
55
55
  get roles() {
56
56
  return {
57
57
  values: Object.freeze(this._roles),
58
- add: (id) => this.client.members.roles.add(this.guildId, this.id, id),
59
- remove: (id) => this.client.members.roles.remove(this.guildId, this.id, id),
58
+ add: (id) => this.client.members.addRole(this.guildId, this.id, id),
59
+ remove: (id) => this.client.members.removeRole(this.guildId, this.id, id),
60
60
  permissions: async () => new Permissions_1.PermissionsBitField(((await this.cache.roles?.bulk(this.roles.values)) ?? [])
61
61
  .filter(x => x)
62
62
  .map(x => BigInt(x.permissions.bits))),
@@ -1,4 +1,4 @@
1
- import type { BaseClient } from '../client/base';
1
+ import type { UsingClient } from '../commands';
2
2
  import type { APIGuildPreview } from '../common';
3
3
  import { AnonymousGuild } from './AnonymousGuild';
4
4
  /**
@@ -6,5 +6,5 @@ import { AnonymousGuild } from './AnonymousGuild';
6
6
  * @link https://discord.com/developers/docs/resources/guild#guild-preview-object
7
7
  */
8
8
  export declare class GuildPreview extends AnonymousGuild {
9
- constructor(client: BaseClient, data: APIGuildPreview);
9
+ constructor(client: UsingClient, data: APIGuildPreview);
10
10
  }
@@ -1,4 +1,4 @@
1
- import type { BaseClient } from '../client/base';
1
+ import type { UsingClient } from '../commands';
2
2
  import type { APIRole, MethodContext, ObjectToLower, RESTPatchAPIGuildRoleJSONBody, RESTPatchAPIGuildRolePositionsJSONBody, RESTPostAPIGuildRoleJSONBody } from '../common';
3
3
  import { DiscordBase } from './extra/DiscordBase';
4
4
  import { PermissionsBitField } from './extra/Permissions';
@@ -7,7 +7,7 @@ export interface GuildRole extends DiscordBase, ObjectToLower<Omit<APIRole, 'per
7
7
  export declare class GuildRole extends DiscordBase {
8
8
  readonly guildId: string;
9
9
  permissions: PermissionsBitField;
10
- constructor(client: BaseClient, data: APIRole, guildId: string);
10
+ constructor(client: UsingClient, data: APIRole, guildId: string);
11
11
  guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">> | undefined;
12
12
  edit(body: RESTPatchAPIGuildRoleJSONBody, reason?: string): Promise<any>;
13
13
  delete(reason?: string): Promise<void | undefined>;
@@ -1,10 +1,10 @@
1
- import type { BaseClient } from '../client/base';
1
+ import type { UsingClient } from '../commands';
2
2
  import type { APITemplate, MethodContext, ObjectToLower, RESTPatchAPIGuildTemplateJSONBody, RESTPostAPIGuildTemplatesJSONBody } from '../common';
3
3
  import { Base } from './extra/Base';
4
4
  export interface GuildTemplate extends Base, ObjectToLower<APITemplate> {
5
5
  }
6
6
  export declare class GuildTemplate extends Base {
7
- constructor(client: BaseClient, data: APITemplate);
7
+ constructor(client: UsingClient, data: APITemplate);
8
8
  guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
9
9
  fetch(): Promise<APITemplate>;
10
10
  sync(): Promise<APITemplate>;
@@ -1,4 +1,3 @@
1
- import type { BaseClient } from '../client/base';
2
1
  import { OptionResolver, type UsingClient } from '../commands';
3
2
  import type { APIApplicationCommandAutocompleteInteraction, APIApplicationCommandInteraction, APIBaseInteraction, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteractionData, APICommandAutocompleteInteractionResponseCallbackData, APIInteraction, APIInteractionResponse, APIInteractionResponseChannelMessageWithSource, APIInteractionResponseDeferredChannelMessageWithSource, APIInteractionResponseDeferredMessageUpdate, APIInteractionResponsePong, APIInteractionResponseUpdateMessage, APIMessageApplicationCommandInteraction, APIMessageApplicationCommandInteractionData, APIMessageButtonInteractionData, APIMessageComponentInteraction, APIMessageComponentSelectMenuInteraction, APIMessageStringSelectInteractionData, APIModalSubmission, APIModalSubmitInteraction, APIUserApplicationCommandInteraction, APIUserApplicationCommandInteractionData, GatewayInteractionCreateDispatchData, MessageFlags, ObjectToLower, OmitInsert, RESTPostAPIInteractionCallbackJSONBody, ToClass, When } from '../common';
4
3
  import { ApplicationCommandType, ComponentType, InteractionResponseType, InteractionType } from '../common';
@@ -33,7 +32,7 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
33
32
  private matchReplied;
34
33
  reply(body: ReplyInteractionBody): Promise<void>;
35
34
  deferReply(flags?: MessageFlags): Promise<void>;
36
- static from(client: BaseClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): StringSelectMenuInteraction<string[]> | AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("discord-api-types/payloads/v10/_interactions/ping").APIPingInteraction>;
35
+ static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): StringSelectMenuInteraction<string[]> | AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("discord-api-types/payloads/v10/_interactions/ping").APIPingInteraction>;
37
36
  fetchGuild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">> | undefined;
38
37
  }
39
38
  export type AllInteractions = AutocompleteInteraction | ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction | SelectMenuInteraction | ModalSubmitInteraction | BaseInteraction;
@@ -44,7 +43,7 @@ export declare class AutocompleteInteraction<FromGuild extends boolean = boolean
44
43
  type: InteractionType.ApplicationCommandAutocomplete;
45
44
  data: ObjectToLower<APIApplicationCommandAutocompleteInteraction['data']>;
46
45
  options: OptionResolver;
47
- constructor(client: BaseClient, interaction: APIApplicationCommandAutocompleteInteraction, __reply?: __InternalReplyFunction | undefined);
46
+ constructor(client: UsingClient, interaction: APIApplicationCommandAutocompleteInteraction, __reply?: __InternalReplyFunction | undefined);
48
47
  getInput(): string;
49
48
  respond(choices: APICommandAutocompleteInteractionResponseCallbackData['choices']): Promise<void>;
50
49
  /** @intenal */
@@ -91,7 +90,7 @@ export declare class ButtonInteraction extends ComponentInteraction {
91
90
  export declare class SelectMenuInteraction extends ComponentInteraction {
92
91
  protected __reply?: __InternalReplyFunction | undefined;
93
92
  data: ObjectToLower<APIMessageComponentSelectMenuInteraction['data']>;
94
- constructor(client: BaseClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
93
+ constructor(client: UsingClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
95
94
  get values(): string[];
96
95
  }
97
96
  declare const StringSelectMenuInteraction_base: ToClass<Omit<SelectMenuInteraction, "data">, StringSelectMenuInteraction<string[]>>;
@@ -104,25 +103,25 @@ export declare class StringSelectMenuInteraction<T extends any[] = string[]> ext
104
103
  export declare class ChannelSelectMenuInteraction extends SelectMenuInteraction {
105
104
  protected __reply?: __InternalReplyFunction | undefined;
106
105
  channels: AllChannels[];
107
- constructor(client: BaseClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
106
+ constructor(client: UsingClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
108
107
  }
109
108
  export declare class MentionableSelectMenuInteraction extends SelectMenuInteraction {
110
109
  protected __reply?: __InternalReplyFunction | undefined;
111
110
  roles: GuildRole[];
112
111
  members: InteractionGuildMember[];
113
112
  users: User[];
114
- constructor(client: BaseClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
113
+ constructor(client: UsingClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
115
114
  }
116
115
  export declare class RoleSelectMenuInteraction extends SelectMenuInteraction {
117
116
  protected __reply?: __InternalReplyFunction | undefined;
118
117
  roles: GuildRole[];
119
- constructor(client: BaseClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
118
+ constructor(client: UsingClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
120
119
  }
121
120
  export declare class UserSelectMenuInteraction extends SelectMenuInteraction {
122
121
  protected __reply?: __InternalReplyFunction | undefined;
123
122
  members: InteractionGuildMember[];
124
123
  users: User[];
125
- constructor(client: BaseClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
124
+ constructor(client: UsingClient, interaction: APIMessageComponentSelectMenuInteraction, __reply?: __InternalReplyFunction | undefined);
126
125
  }
127
126
  export declare class ChatInputCommandInteraction<FromGuild extends boolean = boolean> extends ApplicationCommandInteraction<FromGuild, APIChatInputApplicationCommandInteraction> {
128
127
  data: ObjectToLower<APIChatInputApplicationCommandInteractionData>;
@@ -191,7 +191,7 @@ class AutocompleteInteraction extends BaseInteraction {
191
191
  exports.AutocompleteInteraction = AutocompleteInteraction;
192
192
  class Interaction extends BaseInteraction {
193
193
  fetchMessage(messageId) {
194
- return this.client.webhooks.messages.fetch(this.applicationId, this.token, messageId);
194
+ return this.client.webhooks.fetchMessage(this.applicationId, this.token, messageId);
195
195
  }
196
196
  fetchResponse() {
197
197
  return this.fetchMessage('@original');