seyfert 1.2.2 → 1.2.3

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 (64) hide show
  1. package/LICENSE +190 -190
  2. package/README.md +46 -46
  3. package/lib/api/Router.d.ts +9 -0
  4. package/lib/api/Router.js +16 -8
  5. package/lib/api/Routes/cdn.d.ts +26 -15
  6. package/lib/api/api.d.ts +2 -3
  7. package/lib/api/api.js +4 -9
  8. package/lib/api/index.d.ts +0 -1
  9. package/lib/api/index.js +0 -1
  10. package/lib/builders/Modal.d.ts +4 -1
  11. package/lib/builders/Modal.js +4 -1
  12. package/lib/cache/adapters/default.d.ts +1 -0
  13. package/lib/cache/adapters/default.js +4 -0
  14. package/lib/cache/adapters/redis.d.ts +2 -0
  15. package/lib/cache/adapters/redis.js +17 -0
  16. package/lib/cache/adapters/types.d.ts +1 -0
  17. package/lib/cache/adapters/workeradapter.d.ts +1 -0
  18. package/lib/cache/adapters/workeradapter.js +6 -9
  19. package/lib/cache/index.d.ts +3 -1
  20. package/lib/cache/index.js +3 -0
  21. package/lib/cache/resources/overwrites.d.ts +2 -0
  22. package/lib/client/base.d.ts +1 -1
  23. package/lib/client/base.js +8 -5
  24. package/lib/client/onmessagecreate.js +15 -12
  25. package/lib/client/workerclient.js +5 -11
  26. package/lib/commands/applications/chat.d.ts +9 -6
  27. package/lib/commands/applications/chat.js +4 -1
  28. package/lib/commands/applications/shared.d.ts +4 -0
  29. package/lib/commands/applications/shared.js +6 -0
  30. package/lib/commands/decorators.d.ts +11 -1
  31. package/lib/commands/decorators.js +24 -0
  32. package/lib/common/shorters/channels.d.ts +3 -0
  33. package/lib/common/shorters/channels.js +3 -2
  34. package/lib/common/types/options.d.ts +2 -2
  35. package/lib/structures/GuildEmoji.d.ts +2 -2
  36. package/lib/structures/GuildEmoji.js +1 -1
  37. package/lib/structures/GuildMember.js +1 -1
  38. package/lib/structures/User.d.ts +2 -3
  39. package/lib/structures/User.js +8 -3
  40. package/lib/structures/Webhook.js +1 -1
  41. package/lib/structures/channels.d.ts +5 -0
  42. package/lib/structures/extra/BaseGuild.js +3 -3
  43. package/lib/websocket/discord/worker.d.ts +1 -1
  44. package/lib/websocket/discord/workermanager.js +3 -9
  45. package/lib/websocket/structures/timeout.js +9 -12
  46. package/package.json +1 -1
  47. package/lib/api/CDN.d.ts +0 -212
  48. package/lib/api/CDN.js +0 -228
  49. package/lib/client/http/adapters/bun.d.ts +0 -14
  50. package/lib/client/http/adapters/bun.js +0 -117
  51. package/lib/client/http/adapters/index.d.ts +0 -15
  52. package/lib/client/http/adapters/index.js +0 -27
  53. package/lib/client/http/adapters/uws.d.ts +0 -17
  54. package/lib/client/http/adapters/uws.js +0 -142
  55. package/lib/client/http/httpclient.d.ts +0 -13
  56. package/lib/client/http/httpclient.js +0 -48
  57. package/lib/common/shorters/overwrites.d.ts +0 -29
  58. package/lib/common/shorters/overwrites.js +0 -63
  59. package/lib/components/listener.d.ts +0 -11
  60. package/lib/components/listener.js +0 -17
  61. package/lib/structures/extra/BaseComponent.d.ts +0 -9
  62. package/lib/structures/extra/BaseComponent.js +0 -12
  63. package/lib/structures/extra/BaseSelectMenuComponent.d.ts +0 -9
  64. package/lib/structures/extra/BaseSelectMenuComponent.js +0 -13
package/lib/api/api.js CHANGED
@@ -7,7 +7,7 @@ const promises_1 = require("node:timers/promises");
7
7
  const node_worker_threads_1 = require("node:worker_threads");
8
8
  const common_1 = require("../common");
9
9
  const functions_1 = require("../structures/extra/functions");
10
- const CDN_1 = require("./CDN");
10
+ const Router_1 = require("./Router");
11
11
  const bucket_1 = require("./bucket");
12
12
  const shared_1 = require("./shared");
13
13
  const utils_1 = require("./utils/utils");
@@ -16,7 +16,7 @@ class ApiHandler {
16
16
  globalBlock = false;
17
17
  ratelimits = new Map();
18
18
  readyQueue = [];
19
- cdn = new CDN_1.CDN();
19
+ cdn = Router_1.CDNRouter.createProxy();
20
20
  debugger;
21
21
  workerPromises;
22
22
  constructor(options) {
@@ -62,14 +62,9 @@ class ApiHandler {
62
62
  }, request.files
63
63
  ?.filter(x => !['string', 'boolean', 'number'].includes(typeof x.data))
64
64
  .map(x => x.data));
65
- let resolve = (_value) => { };
66
- let reject = () => { };
67
- const promise = new Promise((res, rej) => {
68
- resolve = res;
69
- reject = rej;
65
+ return new Promise((res, rej) => {
66
+ this.workerPromises.set(nonce, { reject: rej, resolve: res });
70
67
  });
71
- this.workerPromises.set(nonce, { reject, resolve });
72
- return promise;
73
68
  }
74
69
  const route = request.route || this.routefy(url, method);
75
70
  let attempts = 0;
@@ -1,4 +1,3 @@
1
- export * from './CDN';
2
1
  export * from './Router';
3
2
  export * from './Routes';
4
3
  export * from './api';
package/lib/api/index.js CHANGED
@@ -14,7 +14,6 @@ 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
- __exportStar(require("./CDN"), exports);
18
17
  __exportStar(require("./Router"), exports);
19
18
  __exportStar(require("./Routes"), exports);
20
19
  __exportStar(require("./api"), exports);
@@ -9,7 +9,10 @@ import type { ModalBuilderComponents, ModalSubmitCallback } from './types';
9
9
  * @example
10
10
  * const modal = new Modal();
11
11
  * modal.setTitle("Sample Modal");
12
- * modal.addComponents(new TextInput().setLabel("Enter text"));
12
+ * modal.addComponents(
13
+ * new ActionRow<TextInput>()
14
+ * .addComponents(new TextInput().setLabel("Enter text"))
15
+ * ));
13
16
  * modal.run((interaction) => {
14
17
  * // Handle modal submission
15
18
  * });
@@ -10,7 +10,10 @@ const index_1 = require("./index");
10
10
  * @example
11
11
  * const modal = new Modal();
12
12
  * modal.setTitle("Sample Modal");
13
- * modal.addComponents(new TextInput().setLabel("Enter text"));
13
+ * modal.addComponents(
14
+ * new ActionRow<TextInput>()
15
+ * .addComponents(new TextInput().setLabel("Enter text"))
16
+ * ));
14
17
  * modal.run((interaction) => {
15
18
  * // Handle modal submission
16
19
  * });
@@ -16,6 +16,7 @@ export declare class MemoryAdapter implements Adapter {
16
16
  count(to: string): number;
17
17
  remove(keys: string): void;
18
18
  remove(keys: string[]): void;
19
+ flush(): void;
19
20
  contains(to: string, keys: string): boolean;
20
21
  getToRelationship(to: string): string[];
21
22
  bulkAddToRelationShip(data: Record<string, string[]>): void;
@@ -77,6 +77,10 @@ class MemoryAdapter {
77
77
  this.storage.delete(i);
78
78
  }
79
79
  }
80
+ flush() {
81
+ this.storage.clear();
82
+ this.relationships.clear();
83
+ }
80
84
  contains(to, keys) {
81
85
  return this.getToRelationship(to).includes(keys);
82
86
  }
@@ -12,6 +12,7 @@ export declare class RedisAdapter implements Adapter {
12
12
  } | {
13
13
  redisOptions: RedisOptions;
14
14
  }) & RedisAdapterOptions);
15
+ private __scanSets;
15
16
  scan(query: string, returnKeys?: false): Promise<any[]>;
16
17
  scan(query: string, returnKeys: true): Promise<string[]>;
17
18
  get(keys: string[]): Promise<any[]>;
@@ -24,6 +25,7 @@ export declare class RedisAdapter implements Adapter {
24
25
  keys(to: string): Promise<string[]>;
25
26
  count(to: string): Promise<number>;
26
27
  remove(keys: string | string[]): Promise<void>;
28
+ flush(): Promise<void>;
27
29
  contains(to: string, keys: string): Promise<boolean>;
28
30
  getToRelationship(to: string): Promise<string[]>;
29
31
  bulkAddToRelationShip(data: Record<string, string[]>): Promise<void>;
@@ -19,6 +19,20 @@ class RedisAdapter {
19
19
  this.client = 'client' in data ? data.client : new Redis(data.redisOptions);
20
20
  this.namespace = data.namespace ?? 'seyfert';
21
21
  }
22
+ __scanSets(query, returnKeys = false) {
23
+ const match = this.buildKey(query);
24
+ return new Promise((r, j) => {
25
+ const stream = this.client.scanStream({
26
+ match,
27
+ type: 'set',
28
+ });
29
+ const keys = [];
30
+ stream
31
+ .on('data', resultKeys => keys.push(...resultKeys))
32
+ .on('end', () => (returnKeys ? r(keys.map(x => this.buildKey(x))) : r(this.get(keys))))
33
+ .on('error', err => j(err));
34
+ });
35
+ }
22
36
  scan(query, returnKeys = false) {
23
37
  const match = this.buildKey(query);
24
38
  return new Promise((r, j) => {
@@ -107,6 +121,9 @@ class RedisAdapter {
107
121
  }
108
122
  await this.client.del(...keys.map(x => this.buildKey(x)));
109
123
  }
124
+ async flush() {
125
+ await this.remove(await Promise.all([this.scan(this.buildKey('*'), true), this.__scanSets(this.buildKey('*'), true)]).then(x => x.flat()));
126
+ }
110
127
  async contains(to, keys) {
111
128
  return (await this.client.sismember(`${this.buildKey(to)}:set`, keys)) === 1;
112
129
  }
@@ -17,6 +17,7 @@ export interface Adapter {
17
17
  keys(to: string): Awaitable<string[]>;
18
18
  count(to: string): Awaitable<number>;
19
19
  remove(keys: string | string[]): Awaitable<void>;
20
+ flush(): Awaitable<void>;
20
21
  contains(to: string, keys: string): Awaitable<boolean>;
21
22
  getToRelationship(to: string): Awaitable<string[]>;
22
23
  bulkAddToRelationShip(data: Record<string, string[]>): Awaitable<void>;
@@ -24,6 +24,7 @@ export declare class WorkerAdapter implements Adapter {
24
24
  keys(...rest: any[]): Promise<any>;
25
25
  count(...rest: any[]): Promise<any>;
26
26
  remove(...rest: any[]): Promise<any>;
27
+ flush(): Promise<any>;
27
28
  contains(...rest: any[]): Promise<any>;
28
29
  getToRelationship(...rest: any[]): Promise<any>;
29
30
  bulkAddToRelationShip(...rest: any[]): Promise<any>;
@@ -26,19 +26,13 @@ class WorkerAdapter {
26
26
  method,
27
27
  workerId: this.workerData.workerId,
28
28
  });
29
- let resolve = (_) => {
30
- /**/
31
- };
32
- let timeout = -1;
33
- const promise = new Promise((res, rej) => {
34
- resolve = res;
35
- timeout = setTimeout(() => {
29
+ return new Promise((res, rej) => {
30
+ const timeout = setTimeout(() => {
36
31
  this.promises.delete(nonce);
37
32
  rej(new Error('Timeout cache request'));
38
33
  }, 60e3);
34
+ this.promises.set(nonce, { resolve: res, timeout });
39
35
  });
40
- this.promises.set(nonce, { resolve, timeout });
41
- return promise;
42
36
  }
43
37
  scan(...rest) {
44
38
  return this.send('scan', ...rest);
@@ -64,6 +58,9 @@ class WorkerAdapter {
64
58
  remove(...rest) {
65
59
  return this.send('remove', ...rest);
66
60
  }
61
+ flush() {
62
+ return this.send('flush');
63
+ }
67
64
  contains(...rest) {
68
65
  return this.send('contains', ...rest);
69
66
  }
@@ -11,7 +11,7 @@ import { StageInstances } from './resources/stage-instances';
11
11
  import { Stickers } from './resources/stickers';
12
12
  import { Threads } from './resources/threads';
13
13
  import { VoiceStates } from './resources/voice-states';
14
- import { type GatewayDispatchPayload, GatewayIntentBits } from 'discord-api-types/v10';
14
+ import { GatewayIntentBits, type GatewayDispatchPayload } from 'discord-api-types/v10';
15
15
  import type { InternalOptions, UsingClient } from '../commands';
16
16
  import { Overwrites } from './resources/overwrites';
17
17
  export type InferAsyncCache = InternalOptions extends {
@@ -40,6 +40,7 @@ export declare class Cache {
40
40
  presences?: Presences;
41
41
  stageInstances?: StageInstances;
42
42
  constructor(intents: number, adapter: Adapter, disabledCache?: (NonGuildBased | GuildBased | GuildRelated)[], client?: UsingClient);
43
+ flush(): ReturnCache<void>;
43
44
  hasIntent(intent: keyof typeof GatewayIntentBits): boolean;
44
45
  get hasGuildsIntent(): boolean;
45
46
  get hasRolesIntent(): boolean;
@@ -79,6 +80,7 @@ export declare class Cache {
79
80
  id: string;
80
81
  deny: import("../structures/extra/Permissions").PermissionsBitField;
81
82
  allow: import("../structures/extra/Permissions").PermissionsBitField;
83
+ guildId: string;
82
84
  }[][];
83
85
  }>>;
84
86
  bulkPatch(keys: (readonly [
@@ -107,6 +107,9 @@ class Cache {
107
107
  this.threads?.__setClient(client);
108
108
  this.stageInstances?.__setClient(client);
109
109
  }
110
+ flush() {
111
+ return this.adapter.flush();
112
+ }
110
113
  // internal use ./structures
111
114
  hasIntent(intent) {
112
115
  return (this.intents & v10_1.GatewayIntentBits[intent]) === v10_1.GatewayIntentBits[intent];
@@ -9,12 +9,14 @@ export declare class Overwrites extends GuildRelatedResource {
9
9
  id: string;
10
10
  deny: PermissionsBitField;
11
11
  allow: PermissionsBitField;
12
+ guildId: string;
12
13
  }[] | undefined>;
13
14
  values(guild: string): ReturnCache<{
14
15
  type: number;
15
16
  id: string;
16
17
  deny: PermissionsBitField;
17
18
  allow: PermissionsBitField;
19
+ guildId: string;
18
20
  }[][]>;
19
21
  bulk(ids: string[]): ReturnCache<{
20
22
  type: number;
@@ -2,7 +2,7 @@ import { ApiHandler } from '../api';
2
2
  import type { Adapter } from '../cache';
3
3
  import { Cache } from '../cache';
4
4
  import type { Command, ContextMenuCommand, RegisteredMiddlewares } from '../commands';
5
- import type { InferWithPrefix, MiddlewareContext } from '../commands/applications/shared';
5
+ import { type InferWithPrefix, type MiddlewareContext } from '../commands/applications/shared';
6
6
  import { type CommandHandlerLike } from '../commands/handler';
7
7
  import { ChannelShorter, EmojiShorter, GuildShorter, Logger, MemberShorter, MessageShorter, ReactionShorter, RoleShorter, TemplateShorter, UsersShorter, WebhookShorter, type MakeRequired } from '../common';
8
8
  import type { LocaleString } from 'discord-api-types/rest/v10';
@@ -4,6 +4,7 @@ exports.BaseClient = void 0;
4
4
  const node_path_1 = require("node:path");
5
5
  const api_1 = require("../api");
6
6
  const cache_1 = require("../cache");
7
+ const shared_1 = require("../commands/applications/shared");
7
8
  const handler_1 = require("../commands/handler");
8
9
  const common_1 = require("../common");
9
10
  const handler_2 = require("../components/handler");
@@ -155,14 +156,14 @@ class BaseClient {
155
156
  async uploadCommands(applicationId) {
156
157
  applicationId ??= await this.getRC().then(x => x.applicationId ?? this.applicationId);
157
158
  BaseClient.assertString(applicationId, 'applicationId is not a string');
158
- const commands = this.commands.values.map(x => x.toJSON());
159
- const filter = (0, common_1.filterSplit)(commands, command => !command.guild_id);
159
+ const commands = this.commands.values;
160
+ const filter = (0, common_1.filterSplit)(commands, command => !command.guildId);
160
161
  await this.proxy.applications(applicationId).commands.put({
161
- body: filter.expect,
162
+ body: filter.expect.filter(cmd => !('ignore' in cmd) || cmd.ignore !== shared_1.IgnoreCommand.Slash).map(x => x.toJSON()),
162
163
  });
163
164
  const guilds = new Set();
164
165
  for (const command of filter.never) {
165
- for (const guild_id of command.guild_id) {
166
+ for (const guild_id of command.guildId) {
166
167
  guilds.add(guild_id);
167
168
  }
168
169
  }
@@ -171,7 +172,9 @@ class BaseClient {
171
172
  .applications(applicationId)
172
173
  .guilds(guild)
173
174
  .commands.put({
174
- body: filter.never.filter(x => x.guild_id?.includes(guild)),
175
+ body: filter.never
176
+ .filter(cmd => cmd.guildId?.includes(guild) && (!('ignore' in cmd) || cmd.ignore !== shared_1.IgnoreCommand.Slash))
177
+ .map(x => x.toJSON()),
175
178
  });
176
179
  }
177
180
  }
@@ -5,18 +5,21 @@ const v10_1 = require("discord-api-types/v10");
5
5
  const __1 = require("..");
6
6
  const structures_1 = require("../structures");
7
7
  function getCommandFromContent(commandRaw, self) {
8
- const parentName = commandRaw[0];
9
- const groupName = commandRaw.length === 3 ? commandRaw[1] : undefined;
10
- const subcommandName = groupName ? commandRaw[2] : commandRaw[1];
11
- const parent = self.commands.values.find(x => x.name === parentName);
12
- const fullCommandName = `${parentName}${groupName ? ` ${groupName} ${subcommandName}` : `${subcommandName ? ` ${subcommandName}` : ''}`}`;
8
+ const rawParentName = commandRaw[0];
9
+ const rawGroupName = commandRaw.length === 3 ? commandRaw[1] : undefined;
10
+ const rawSubcommandName = rawGroupName ? commandRaw[2] : commandRaw[1];
11
+ const parent = self.commands.values.find(x => (!('ignore' in x) || x.ignore !== __1.IgnoreCommand.Message) &&
12
+ (x.name === rawParentName || ('aliases' in x ? x.aliases?.includes(rawParentName) : false)));
13
+ const fullCommandName = `${rawParentName}${rawGroupName ? ` ${rawGroupName} ${rawSubcommandName}` : `${rawSubcommandName ? ` ${rawSubcommandName}` : ''}`}`;
13
14
  if (!(parent instanceof __1.Command))
14
15
  return { fullCommandName };
15
- if (groupName && !parent.groups?.[groupName])
16
- return getCommandFromContent([parentName, groupName], self);
17
- if (subcommandName && !parent.options?.some(x => x instanceof __1.SubCommand && x.name === subcommandName))
18
- return getCommandFromContent([parentName], self);
19
- const command = groupName || subcommandName
16
+ if (rawGroupName && !parent.groups?.[rawGroupName] && !parent.groupsAliases?.[rawGroupName])
17
+ return getCommandFromContent([rawParentName, rawGroupName], self);
18
+ if (rawSubcommandName &&
19
+ !parent.options?.some(x => x instanceof __1.SubCommand && (x.name === rawSubcommandName || x.aliases?.includes(rawSubcommandName))))
20
+ return getCommandFromContent([rawParentName], self);
21
+ const groupName = rawGroupName ? parent.groupsAliases?.[rawGroupName] || rawGroupName : undefined;
22
+ const command = groupName || rawSubcommandName
20
23
  ? parent.options?.find(opt => {
21
24
  if (opt instanceof __1.SubCommand) {
22
25
  if (groupName) {
@@ -25,7 +28,7 @@ function getCommandFromContent(commandRaw, self) {
25
28
  }
26
29
  if (opt.group && !groupName)
27
30
  return false;
28
- return subcommandName === opt.name;
31
+ return rawSubcommandName === opt.name || opt.aliases?.includes(rawSubcommandName);
29
32
  }
30
33
  return false;
31
34
  })
@@ -40,7 +43,7 @@ async function onMessageCreate(self, rawMessage, shardId) {
40
43
  if (!self.options?.commands)
41
44
  return;
42
45
  const message = new structures_1.Message(self, rawMessage);
43
- const prefixes = ((await self.options.commands.prefix?.(message)) ?? []).sort((a, b) => b.length - a.length);
46
+ const prefixes = (await self.options.commands.prefix(message)).sort((a, b) => b.length - a.length);
44
47
  const prefix = prefixes.find(x => message.content.startsWith(x));
45
48
  if (!prefix || !message.content.startsWith(prefix))
46
49
  return;
@@ -216,8 +216,8 @@ class WorkerClient extends base_1.BaseClient {
216
216
  let result;
217
217
  try {
218
218
  // biome-ignore lint/security/noGlobalEval: yes
219
- result = await eval(`
220
- (${data.func})(this)
219
+ result = await eval(`
220
+ (${data.func})(this)
221
221
  `);
222
222
  }
223
223
  catch (e) {
@@ -251,19 +251,13 @@ class WorkerClient extends base_1.BaseClient {
251
251
  return nonce;
252
252
  }
253
253
  generateSendPromise(nonce, message = 'Timeout') {
254
- let resolve = (_) => {
255
- /**/
256
- };
257
- let timeout = -1;
258
- const promise = new Promise((res, rej) => {
259
- resolve = res;
260
- timeout = setTimeout(() => {
254
+ return new Promise((res, rej) => {
255
+ const timeout = setTimeout(() => {
261
256
  this.promises.delete(nonce);
262
257
  rej(new Error(message));
263
258
  }, 60e3);
259
+ this.promises.set(nonce, { resolve: res, timeout });
264
260
  });
265
- this.promises.set(nonce, { resolve, timeout });
266
- return promise;
267
261
  }
268
262
  tellWorker(workerId, func) {
269
263
  const nonce = this.generateNonce();
@@ -5,7 +5,7 @@ import { type FlatObjectKeys } from '../../common';
5
5
  import type { AllChannels, AutocompleteInteraction, GuildRole, InteractionGuildMember, User } from '../../structures';
6
6
  import type { Groups, IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
7
7
  import type { CommandContext } from './chatcontext';
8
- import type { DefaultLocale, OKFunction, OnOptionsReturnObject, StopFunction, UsingClient } from './shared';
8
+ import type { DefaultLocale, IgnoreCommand, OKFunction, OnOptionsReturnObject, StopFunction, UsingClient } from './shared';
9
9
  export interface ReturnOptionsTypes {
10
10
  1: never;
11
11
  2: never;
@@ -72,11 +72,6 @@ declare class BaseCommand {
72
72
  description: string | undefined;
73
73
  };
74
74
  __autoload?: true;
75
- __tGroups?: Record<string, {
76
- name: string | undefined;
77
- description: string | undefined;
78
- defaultDescription: string;
79
- }>;
80
75
  guildId?: string[];
81
76
  name: string;
82
77
  type: number;
@@ -89,6 +84,8 @@ declare class BaseCommand {
89
84
  name_localizations?: Partial<Record<LocaleString, string>>;
90
85
  description_localizations?: Partial<Record<LocaleString, string>>;
91
86
  options?: CommandOption[] | SubCommand[];
87
+ ignore?: IgnoreCommand;
88
+ aliases?: string[];
92
89
  toJSON(): {
93
90
  name: BaseCommand['name'];
94
91
  type: BaseCommand['type'];
@@ -114,6 +111,12 @@ declare class BaseCommand {
114
111
  export declare class Command extends BaseCommand {
115
112
  type: ApplicationCommandType;
116
113
  groups?: Parameters<typeof Groups>[0];
114
+ groupsAliases?: Record<string, string>;
115
+ __tGroups?: Record<string, {
116
+ name: string | undefined;
117
+ description: string | undefined;
118
+ defaultDescription: string;
119
+ }>;
117
120
  toJSON(): {
118
121
  options: APIApplicationCommandOption[];
119
122
  name: string;
@@ -8,7 +8,6 @@ class BaseCommand {
8
8
  __filePath;
9
9
  __t;
10
10
  __autoload;
11
- __tGroups;
12
11
  guildId;
13
12
  name;
14
13
  type; // ApplicationCommandType.ChatInput | ApplicationCommandOptionType.Subcommand
@@ -21,6 +20,8 @@ class BaseCommand {
21
20
  name_localizations;
22
21
  description_localizations;
23
22
  options;
23
+ ignore;
24
+ aliases;
24
25
  /** @internal */
25
26
  async __runOptions(ctx, resolver) {
26
27
  if (!this?.options?.length) {
@@ -139,6 +140,8 @@ class BaseCommand {
139
140
  class Command extends BaseCommand {
140
141
  type = v10_1.ApplicationCommandType.ChatInput;
141
142
  groups;
143
+ groupsAliases;
144
+ __tGroups;
142
145
  toJSON() {
143
146
  const options = [];
144
147
  for (const i of this.options ?? []) {
@@ -39,3 +39,7 @@ export type OnOptionsReturnObject = Record<string, {
39
39
  failed: true;
40
40
  value: string;
41
41
  }>;
42
+ export declare enum IgnoreCommand {
43
+ Slash = 0,
44
+ Message = 1
45
+ }
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IgnoreCommand = void 0;
4
+ var IgnoreCommand;
5
+ (function (IgnoreCommand) {
6
+ IgnoreCommand[IgnoreCommand["Slash"] = 0] = "Slash";
7
+ IgnoreCommand[IgnoreCommand["Message"] = 1] = "Message";
8
+ })(IgnoreCommand || (exports.IgnoreCommand = IgnoreCommand = {}));
@@ -1,7 +1,7 @@
1
1
  import { ApplicationCommandType, type LocaleString } from 'discord-api-types/v10';
2
2
  import type { FlatObjectKeys, PermissionStrings } from '../common';
3
3
  import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
4
- import type { DefaultLocale, MiddlewareContext } from './applications/shared';
4
+ import type { DefaultLocale, IgnoreCommand, MiddlewareContext } from './applications/shared';
5
5
  export interface RegisteredMiddlewares {
6
6
  }
7
7
  export declare enum IntegrationTypes {
@@ -22,6 +22,8 @@ type DeclareOptions = {
22
22
  nsfw?: boolean;
23
23
  integrationTypes?: (keyof typeof IntegrationTypes)[];
24
24
  contexts?: (keyof typeof InteractionContextTypes)[];
25
+ ignore?: IgnoreCommand;
26
+ aliases?: string[];
25
27
  } | (Omit<{
26
28
  name: string;
27
29
  description: string;
@@ -59,26 +61,32 @@ export declare function GroupsT(groups: Record<string, {
59
61
  name?: FlatObjectKeys<DefaultLocale>;
60
62
  description?: FlatObjectKeys<DefaultLocale>;
61
63
  defaultDescription: string;
64
+ aliases?: string[];
62
65
  }>): <T extends new (...args: any[]) => {}>(target: T) => {
63
66
  new (...args: any[]): {
64
67
  __tGroups: Record<string, {
65
68
  name?: undefined;
66
69
  description?: undefined;
67
70
  defaultDescription: string;
71
+ aliases?: string[] | undefined;
68
72
  }>;
73
+ groupsAliases: Record<string, string>;
69
74
  };
70
75
  } & T;
71
76
  export declare function Groups(groups: Record<string, {
72
77
  name?: [language: LocaleString, value: string][];
73
78
  description?: [language: LocaleString, value: string][];
74
79
  defaultDescription: string;
80
+ aliases?: string[];
75
81
  }>): <T extends new (...args: any[]) => {}>(target: T) => {
76
82
  new (...args: any[]): {
77
83
  groups: Record<string, {
78
84
  name?: [language: "id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", value: string][] | undefined;
79
85
  description?: [language: "id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", value: string][] | undefined;
80
86
  defaultDescription: string;
87
+ aliases?: string[] | undefined;
81
88
  }>;
89
+ groupsAliases: Record<string, string>;
82
90
  };
83
91
  } & T;
84
92
  export declare function Group(groupName: string): <T extends new (...args: any[]) => {}>(target: T) => {
@@ -115,6 +123,8 @@ export declare function Declare(declare: DeclareOptions): <T extends new (...arg
115
123
  description: string;
116
124
  type: ApplicationCommandType;
117
125
  guildId?: string[] | undefined;
126
+ ignore?: IgnoreCommand | undefined;
127
+ aliases?: string[] | undefined;
118
128
  };
119
129
  } & T;
120
130
  export {};
@@ -29,12 +29,30 @@ exports.LocalesT = LocalesT;
29
29
  function GroupsT(groups) {
30
30
  return (target) => class extends target {
31
31
  __tGroups = groups;
32
+ groupsAliases = {};
33
+ constructor(...args) {
34
+ super(...args);
35
+ for (const i in groups) {
36
+ for (const j of groups[i].aliases ?? []) {
37
+ this.groupsAliases[j] = i;
38
+ }
39
+ }
40
+ }
32
41
  };
33
42
  }
34
43
  exports.GroupsT = GroupsT;
35
44
  function Groups(groups) {
36
45
  return (target) => class extends target {
37
46
  groups = groups;
47
+ groupsAliases = {};
48
+ constructor(...args) {
49
+ super(...args);
50
+ for (const i in groups) {
51
+ for (const j of groups[i].aliases ?? []) {
52
+ this.groupsAliases[j] = i;
53
+ }
54
+ }
55
+ }
38
56
  };
39
57
  }
40
58
  exports.Groups = Groups;
@@ -84,6 +102,8 @@ function Declare(declare) {
84
102
  description = '';
85
103
  type = v10_1.ApplicationCommandType.ChatInput;
86
104
  guildId;
105
+ ignore;
106
+ aliases;
87
107
  constructor(...args) {
88
108
  super(...args);
89
109
  if ('description' in declare)
@@ -92,6 +112,10 @@ function Declare(declare) {
92
112
  this.type = declare.type;
93
113
  if ('guildId' in declare)
94
114
  this.guildId = declare.guildId;
115
+ if ('ignore' in declare)
116
+ this.ignore = declare.ignore;
117
+ if ('aliases' in declare)
118
+ this.aliases = declare.aliases;
95
119
  // check if all properties are valid
96
120
  }
97
121
  };
@@ -63,18 +63,21 @@ export declare class ChannelShorter extends BaseShorter {
63
63
  id: string;
64
64
  deny: PermissionsBitField;
65
65
  allow: PermissionsBitField;
66
+ guildId: string;
66
67
  } | undefined;
67
68
  roles: {
68
69
  type: number;
69
70
  id: string;
70
71
  deny: PermissionsBitField;
71
72
  allow: PermissionsBitField;
73
+ guildId: string;
72
74
  }[];
73
75
  member: {
74
76
  type: number;
75
77
  id: string;
76
78
  deny: PermissionsBitField;
77
79
  allow: PermissionsBitField;
80
+ guildId: string;
78
81
  } | undefined;
79
82
  }>;
80
83
  rolePermissions(channelId: string, role: GuildRole, checkAdmin?: boolean): Promise<PermissionsBitField>;
@@ -98,11 +98,12 @@ class ChannelShorter extends base_1.BaseShorter {
98
98
  .then(thread => (0, channels_1.default)(thread, this.client)));
99
99
  }
100
100
  async memberPermissions(channelId, member, checkAdmin = true) {
101
- const permissions = await member.fetchPermissions();
102
- if (checkAdmin && permissions.has(v10_1.PermissionFlagsBits.Administrator)) {
101
+ const memberPermissions = await member.fetchPermissions();
102
+ if (checkAdmin && memberPermissions.has(v10_1.PermissionFlagsBits.Administrator)) {
103
103
  return new Permissions_1.PermissionsBitField(Permissions_1.PermissionsBitField.All);
104
104
  }
105
105
  const overwrites = await this.overwritesFor(channelId, member);
106
+ const permissions = new Permissions_1.PermissionsBitField(memberPermissions.bits);
106
107
  permissions.remove(overwrites.everyone?.deny.bits ?? 0n);
107
108
  permissions.add(overwrites.everyone?.allow.bits ?? 0n);
108
109
  permissions.remove(overwrites.roles.length > 0 ? overwrites.roles.map(role => role.deny.bits) : 0n);
@@ -1,7 +1,7 @@
1
1
  import type { Identify } from '..';
2
- import type { ImageURLOptions } from '../../api';
2
+ import type { CDNUrlOptions } from '../../api';
3
3
  import type { UsingClient } from '../../commands';
4
- export type ImageOptions = ImageURLOptions;
4
+ export type ImageOptions = CDNUrlOptions;
5
5
  export type MethodContext<T = {}> = Identify<{
6
6
  client: UsingClient;
7
7
  } & T>;
@@ -1,5 +1,5 @@
1
1
  import type { APIEmoji, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildEmojiJSONBody } from 'discord-api-types/v10';
2
- import type { BaseImageURLOptions } from '../api';
2
+ import type { BaseCDNUrlOptions } from '../api';
3
3
  import type { UsingClient } from '../commands';
4
4
  import type { EmojiShorter, MethodContext, ObjectToLower } from '../common';
5
5
  import { DiscordBase } from './extra/DiscordBase';
@@ -12,7 +12,7 @@ export declare class GuildEmoji extends DiscordBase {
12
12
  edit(body: RESTPatchAPIChannelJSONBody, reason?: string): Promise<GuildEmoji>;
13
13
  delete(reason?: string): Promise<void>;
14
14
  fetch(force?: boolean): Promise<GuildEmoji>;
15
- url(options?: BaseImageURLOptions): string;
15
+ url(options?: BaseCDNUrlOptions): string;
16
16
  toString(): string;
17
17
  toJSON(): {
18
18
  id: string;