seyfert 1.1.0 → 1.2.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 (171) hide show
  1. package/lib/api/Routes/applications.d.ts +2 -2
  2. package/lib/api/Routes/channels.d.ts +2 -2
  3. package/lib/api/Routes/gateway.d.ts +2 -2
  4. package/lib/api/Routes/guilds.d.ts +2 -1
  5. package/lib/api/Routes/interactions.d.ts +2 -2
  6. package/lib/api/Routes/invites.d.ts +2 -2
  7. package/lib/api/Routes/stage-instances.d.ts +2 -2
  8. package/lib/api/Routes/stickers.d.ts +2 -2
  9. package/lib/api/Routes/users.d.ts +2 -2
  10. package/lib/api/Routes/voice.d.ts +2 -2
  11. package/lib/api/Routes/webhooks.d.ts +2 -2
  12. package/lib/builders/ActionRow.d.ts +2 -1
  13. package/lib/builders/ActionRow.js +3 -3
  14. package/lib/builders/Base.d.ts +1 -1
  15. package/lib/builders/Button.d.ts +2 -1
  16. package/lib/builders/Button.js +2 -2
  17. package/lib/builders/Embed.d.ts +2 -1
  18. package/lib/builders/Modal.d.ts +9 -2
  19. package/lib/builders/Modal.js +12 -3
  20. package/lib/builders/SelectMenu.d.ts +18 -1
  21. package/lib/builders/SelectMenu.js +36 -12
  22. package/lib/builders/index.d.ts +1 -1
  23. package/lib/builders/index.js +9 -9
  24. package/lib/builders/types.d.ts +1 -1
  25. package/lib/cache/adapters/types.d.ts +23 -23
  26. package/lib/cache/index.d.ts +5 -5
  27. package/lib/cache/index.js +3 -3
  28. package/lib/cache/resources/default/base.d.ts +10 -10
  29. package/lib/cache/resources/default/guild-based.d.ts +7 -7
  30. package/lib/cache/resources/default/guild-based.js +2 -1
  31. package/lib/cache/resources/default/guild-related.d.ts +9 -9
  32. package/lib/cache/resources/default/guild-related.js +2 -1
  33. package/lib/cache/resources/presence.d.ts +1 -1
  34. package/lib/cache/resources/stage-instances.d.ts +1 -1
  35. package/lib/cache/resources/voice-states.d.ts +1 -1
  36. package/lib/client/base.d.ts +19 -12
  37. package/lib/client/base.js +45 -7
  38. package/lib/client/client.d.ts +7 -4
  39. package/lib/client/client.js +21 -9
  40. package/lib/client/httpclient.d.ts +2 -1
  41. package/lib/client/httpclient.js +3 -3
  42. package/lib/client/oninteractioncreate.js +18 -19
  43. package/lib/client/onmessagecreate.js +6 -4
  44. package/lib/client/workerclient.d.ts +11 -5
  45. package/lib/client/workerclient.js +18 -11
  46. package/lib/commands/applications/chat.d.ts +4 -4
  47. package/lib/commands/applications/chat.js +17 -9
  48. package/lib/commands/applications/chatcontext.d.ts +7 -10
  49. package/lib/commands/applications/chatcontext.js +6 -17
  50. package/lib/commands/applications/menu.d.ts +2 -1
  51. package/lib/commands/applications/menu.js +7 -5
  52. package/lib/commands/applications/menucontext.d.ts +5 -9
  53. package/lib/commands/applications/menucontext.js +8 -21
  54. package/lib/commands/applications/shared.d.ts +5 -4
  55. package/lib/commands/basecontex.d.ts +15 -0
  56. package/lib/commands/basecontex.js +34 -0
  57. package/lib/commands/decorators.d.ts +3 -2
  58. package/lib/commands/decorators.js +5 -5
  59. package/lib/commands/handler.d.ts +6 -0
  60. package/lib/commands/handler.js +10 -4
  61. package/lib/commands/optionresolver.d.ts +3 -3
  62. package/lib/commands/optionresolver.js +14 -14
  63. package/lib/common/index.d.ts +0 -1
  64. package/lib/common/index.js +0 -1
  65. package/lib/common/it/constants.d.ts +3 -1
  66. package/lib/common/it/constants.js +2 -0
  67. package/lib/common/it/utils.d.ts +1 -0
  68. package/lib/common/it/utils.js +2 -1
  69. package/lib/common/shorters/channels.d.ts +1 -1
  70. package/lib/common/shorters/channels.js +4 -4
  71. package/lib/common/shorters/guilds.d.ts +1 -1
  72. package/lib/common/shorters/guilds.js +6 -1
  73. package/lib/common/shorters/members.d.ts +6 -1
  74. package/lib/common/shorters/members.js +25 -2
  75. package/lib/common/shorters/messages.d.ts +1 -1
  76. package/lib/common/shorters/messages.js +1 -1
  77. package/lib/common/shorters/users.d.ts +0 -6
  78. package/lib/common/shorters/users.js +0 -34
  79. package/lib/common/shorters/webhook.d.ts +2 -2
  80. package/lib/common/types/resolvables.d.ts +2 -1
  81. package/lib/common/types/util.d.ts +4 -1
  82. package/lib/common/types/write.d.ts +1 -1
  83. package/lib/components/ActionRow.d.ts +4 -3
  84. package/lib/components/ActionRow.js +6 -3
  85. package/lib/components/BaseComponent.d.ts +18 -0
  86. package/lib/components/BaseComponent.js +21 -0
  87. package/lib/components/BaseSelectMenuComponent.d.ts +10 -0
  88. package/lib/components/BaseSelectMenuComponent.js +22 -0
  89. package/lib/components/ButtonComponent.d.ts +14 -14
  90. package/lib/components/ButtonComponent.js +36 -25
  91. package/lib/components/ChannelSelectMenuComponent.d.ts +4 -4
  92. package/lib/components/ChannelSelectMenuComponent.js +6 -5
  93. package/lib/components/MentionableSelectMenuComponent.d.ts +3 -2
  94. package/lib/components/MentionableSelectMenuComponent.js +4 -1
  95. package/lib/components/RoleSelectMenuComponent.d.ts +3 -2
  96. package/lib/components/RoleSelectMenuComponent.js +4 -1
  97. package/lib/components/StringSelectMenuComponent.d.ts +3 -4
  98. package/lib/components/StringSelectMenuComponent.js +3 -5
  99. package/lib/components/TextInputComponent.d.ts +10 -5
  100. package/lib/components/TextInputComponent.js +24 -7
  101. package/lib/components/UserSelectMenuComponent.d.ts +3 -2
  102. package/lib/components/UserSelectMenuComponent.js +4 -1
  103. package/lib/components/command.d.ts +6 -5
  104. package/lib/components/command.js +4 -0
  105. package/lib/components/componentcontext.d.ts +42 -0
  106. package/lib/components/componentcontext.js +79 -0
  107. package/lib/components/handler.d.ts +22 -6
  108. package/lib/components/handler.js +19 -12
  109. package/lib/components/index.d.ts +2 -2
  110. package/lib/components/index.js +9 -9
  111. package/lib/events/handler.d.ts +12 -3
  112. package/lib/events/handler.js +6 -8
  113. package/lib/events/hooks/application_command.d.ts +2 -2
  114. package/lib/events/hooks/auto_moderation.d.ts +4 -4
  115. package/lib/events/hooks/channel.d.ts +1 -1
  116. package/lib/events/hooks/dispatch.d.ts +1 -1
  117. package/lib/events/hooks/entitlement.d.ts +4 -4
  118. package/lib/events/hooks/guild.d.ts +42 -42
  119. package/lib/events/hooks/integration.d.ts +19 -19
  120. package/lib/events/hooks/interactions.d.ts +2 -2
  121. package/lib/events/hooks/invite.d.ts +5 -5
  122. package/lib/events/hooks/message.d.ts +6 -5
  123. package/lib/events/hooks/presence.d.ts +7 -7
  124. package/lib/events/hooks/stage.d.ts +4 -4
  125. package/lib/events/hooks/thread.d.ts +49 -49
  126. package/lib/events/hooks/typing.d.ts +2 -2
  127. package/lib/events/hooks/user.d.ts +1 -1
  128. package/lib/events/hooks/voice.d.ts +2 -2
  129. package/lib/events/hooks/webhook.d.ts +1 -1
  130. package/lib/index.d.ts +3 -6
  131. package/lib/index.js +6 -7
  132. package/lib/langs/handler.d.ts +10 -1
  133. package/lib/langs/handler.js +1 -0
  134. package/lib/structures/AutoModerationRule.d.ts +3 -2
  135. package/lib/structures/ClientUser.d.ts +1 -1
  136. package/lib/structures/Guild.d.ts +27 -27
  137. package/lib/structures/GuildEmoji.d.ts +2 -1
  138. package/lib/structures/GuildMember.d.ts +16 -6
  139. package/lib/structures/GuildMember.js +35 -6
  140. package/lib/structures/GuildPreview.d.ts +1 -1
  141. package/lib/structures/GuildRole.d.ts +2 -1
  142. package/lib/structures/GuildTemplate.d.ts +3 -2
  143. package/lib/structures/Interaction.d.ts +5 -5
  144. package/lib/structures/Interaction.js +34 -34
  145. package/lib/structures/Message.d.ts +6 -5
  146. package/lib/structures/Sticker.d.ts +2 -1
  147. package/lib/structures/User.d.ts +7 -3
  148. package/lib/structures/User.js +5 -0
  149. package/lib/structures/Webhook.d.ts +63 -4
  150. package/lib/structures/Webhook.js +53 -0
  151. package/lib/structures/channels.d.ts +4 -4
  152. package/lib/structures/extra/BaseGuild.d.ts +2 -1
  153. package/lib/structures/extra/BaseGuild.js +3 -3
  154. package/lib/structures/extra/BitField.d.ts +2 -2
  155. package/lib/structures/extra/BitField.js +2 -2
  156. package/lib/structures/extra/Permissions.d.ts +1 -1
  157. package/lib/structures/extra/functions.d.ts +2 -1
  158. package/lib/structures/extra/functions.js +2 -1
  159. package/lib/types/index.d.ts +1 -0
  160. package/lib/types/index.js +17 -0
  161. package/lib/websocket/SharedTypes.d.ts +2 -1
  162. package/lib/websocket/SharedTypes.js +1 -0
  163. package/lib/websocket/discord/shard.d.ts +2 -1
  164. package/lib/websocket/discord/shard.js +30 -41
  165. package/lib/websocket/discord/sharder.d.ts +3 -2
  166. package/lib/websocket/discord/sharder.js +7 -6
  167. package/lib/websocket/discord/shared.d.ts +2 -1
  168. package/lib/websocket/discord/worker.d.ts +1 -1
  169. package/lib/websocket/discord/workermanager.d.ts +3 -2
  170. package/lib/websocket/discord/workermanager.js +1 -1
  171. package/package.json +2 -2
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommandHandler = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
4
5
  const node_path_1 = require("node:path");
5
6
  const common_1 = require("../common");
6
7
  const chat_1 = require("./applications/chat");
@@ -39,6 +40,7 @@ class CommandHandler extends common_1.BaseHandler {
39
40
  for (const command of result) {
40
41
  let commandInstance;
41
42
  try {
43
+ //@ts-expect-error abstract class
42
44
  commandInstance = new command.file();
43
45
  }
44
46
  catch (e) {
@@ -55,6 +57,7 @@ class CommandHandler extends common_1.BaseHandler {
55
57
  if (commandInstance instanceof menu_1.ContextMenuCommand) {
56
58
  this.values.push(commandInstance);
57
59
  commandInstance.__filePath = command.path;
60
+ await this.__callback?.(commandInstance);
58
61
  continue;
59
62
  }
60
63
  if (!(commandInstance instanceof chat_1.Command)) {
@@ -62,7 +65,7 @@ class CommandHandler extends common_1.BaseHandler {
62
65
  }
63
66
  commandInstance.__filePath = command.path;
64
67
  commandInstance.options ??= [];
65
- if (commandInstance.__d) {
68
+ if (commandInstance.__autoload) {
66
69
  //@AutoLoad
67
70
  const options = await this.getFiles((0, node_path_1.dirname)(command.path));
68
71
  for (const option of options) {
@@ -70,8 +73,10 @@ class CommandHandler extends common_1.BaseHandler {
70
73
  continue;
71
74
  }
72
75
  try {
76
+ //@ts-expect-error abstract class
73
77
  const subCommand = new (result.find(x => x.path === option).file)();
74
78
  if (subCommand instanceof chat_1.SubCommand) {
79
+ subCommand.__filePath = option;
75
80
  commandInstance.options.push(subCommand);
76
81
  }
77
82
  }
@@ -102,6 +107,7 @@ class CommandHandler extends common_1.BaseHandler {
102
107
  this.__parseCommandLocales(i, client);
103
108
  }
104
109
  }
110
+ await this.__callback?.(commandInstance);
105
111
  }
106
112
  return this.values;
107
113
  }
@@ -111,7 +117,7 @@ class CommandHandler extends common_1.BaseHandler {
111
117
  command.description_localizations = {};
112
118
  for (const locale of Object.keys(client.langs.values)) {
113
119
  const locales = this.client.langs.aliases.find(x => x[0] === locale)?.[1] ?? [];
114
- if (Object.values(common_1.Locale).includes(locale))
120
+ if (Object.values(v10_1.Locale).includes(locale))
115
121
  locales.push(locale);
116
122
  if (command.__t.name) {
117
123
  for (const i of locales) {
@@ -136,7 +142,7 @@ class CommandHandler extends common_1.BaseHandler {
136
142
  options.description_localizations = {};
137
143
  for (const locale of Object.keys(client.langs.values)) {
138
144
  const locales = this.client.langs.aliases.find(x => x[0] === locale)?.[1] ?? [];
139
- if (Object.values(common_1.Locale).includes(locale))
145
+ if (Object.values(v10_1.Locale).includes(locale))
140
146
  locales.push(locale);
141
147
  if (options.locales.name) {
142
148
  for (const i of locales) {
@@ -158,7 +164,7 @@ class CommandHandler extends common_1.BaseHandler {
158
164
  command.groups = {};
159
165
  for (const locale of Object.keys(client.langs.values)) {
160
166
  const locales = this.client.langs.aliases.find(x => x[0] === locale)?.[1] ?? [];
161
- if (Object.values(common_1.Locale).includes(locale))
167
+ if (Object.values(v10_1.Locale).includes(locale))
162
168
  locales.push(locale);
163
169
  for (const group in command.__tGroups) {
164
170
  command.groups[group] ??= {
@@ -1,6 +1,6 @@
1
+ import { type APIApplicationCommandInteractionDataOption, type APIAttachment, type APIGuildMember, type APIInteractionDataResolvedChannel, type APIInteractionGuildMember, type APIRole, type APIUser, ApplicationCommandOptionType } from 'discord-api-types/v10';
1
2
  import { Attachment, GuildMember } from '..';
2
- import type { APIApplicationCommandInteractionDataOption, APIAttachment, APIGuildMember, APIInteractionDataResolvedChannel, APIInteractionGuildMember, APIRole, APIUser, MakeRequired } from '../common';
3
- import { ApplicationCommandOptionType } from '../common';
3
+ import type { MakeRequired } from '../common';
4
4
  import type { AllChannels } from '../structures';
5
5
  import { GuildRole, InteractionGuildMember, User } from '../structures';
6
6
  import type { Command, CommandAutocompleteOption, SubCommand } from './applications/chat';
@@ -31,7 +31,7 @@ export declare class OptionResolver {
31
31
  getGroup(): string | null;
32
32
  get(name: string): OptionResolved | undefined;
33
33
  getHoisted(name: string): OptionResolved | undefined;
34
- getValue(name: string): string | number | boolean | Attachment | GuildRole | GuildMember | User | import("..").BaseChannel<import("discord-api-types/payloads/v10/channel").ChannelType> | import("..").DMChannel | import("..").CategoryChannel | InteractionGuildMember | undefined;
34
+ getValue(name: string): string | number | boolean | Attachment | GuildRole | GuildMember | User | import("..").BaseChannel<import("discord-api-types/v10").ChannelType> | import("..").DMChannel | import("..").CategoryChannel | InteractionGuildMember | undefined;
35
35
  private getTypedOption;
36
36
  getChannel(name: string, required?: true): AllChannels;
37
37
  getString(name: string, required?: true): string;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.OptionResolver = void 0;
7
+ const v10_1 = require("discord-api-types/v10");
7
8
  const __1 = require("..");
8
- const common_1 = require("../common");
9
9
  const structures_1 = require("../structures");
10
10
  const channels_1 = __importDefault(require("../structures/channels"));
11
11
  class OptionResolver {
@@ -23,11 +23,11 @@ class OptionResolver {
23
23
  this.guildId = guildId;
24
24
  this.resolved = resolved;
25
25
  this.hoistedOptions = this.options = options.map(option => this.transformOption(option, resolved));
26
- if (this.hoistedOptions[0]?.type === common_1.ApplicationCommandOptionType.Subcommand) {
26
+ if (this.hoistedOptions[0]?.type === v10_1.ApplicationCommandOptionType.Subcommand) {
27
27
  this.subCommand = this.hoistedOptions[0].name;
28
28
  this.hoistedOptions = this.hoistedOptions[0].options ?? [];
29
29
  }
30
- if (this.hoistedOptions[0]?.type === common_1.ApplicationCommandOptionType.SubcommandGroup) {
30
+ if (this.hoistedOptions[0]?.type === v10_1.ApplicationCommandOptionType.SubcommandGroup) {
31
31
  this.group = this.hoistedOptions[0].name;
32
32
  this.subCommand = this.hoistedOptions[0].options[0].name;
33
33
  this.hoistedOptions = this.hoistedOptions[0].options[0].options ?? [];
@@ -69,22 +69,22 @@ class OptionResolver {
69
69
  return;
70
70
  }
71
71
  switch (option.type) {
72
- case common_1.ApplicationCommandOptionType.Attachment:
72
+ case v10_1.ApplicationCommandOptionType.Attachment:
73
73
  return option.attachment;
74
- case common_1.ApplicationCommandOptionType.Boolean:
74
+ case v10_1.ApplicationCommandOptionType.Boolean:
75
75
  return option.value;
76
- case common_1.ApplicationCommandOptionType.Channel:
76
+ case v10_1.ApplicationCommandOptionType.Channel:
77
77
  return option.channel;
78
- case common_1.ApplicationCommandOptionType.Integer:
79
- case common_1.ApplicationCommandOptionType.Number:
78
+ case v10_1.ApplicationCommandOptionType.Integer:
79
+ case v10_1.ApplicationCommandOptionType.Number:
80
80
  return option.value;
81
- case common_1.ApplicationCommandOptionType.Role:
81
+ case v10_1.ApplicationCommandOptionType.Role:
82
82
  return option.role;
83
- case common_1.ApplicationCommandOptionType.String:
83
+ case v10_1.ApplicationCommandOptionType.String:
84
84
  return option.value;
85
- case common_1.ApplicationCommandOptionType.User:
85
+ case v10_1.ApplicationCommandOptionType.User:
86
86
  return option.member ?? option.user;
87
- case common_1.ApplicationCommandOptionType.Mentionable:
87
+ case v10_1.ApplicationCommandOptionType.Mentionable:
88
88
  return option.member ?? option.user ?? option.role;
89
89
  default:
90
90
  return;
@@ -101,11 +101,11 @@ class OptionResolver {
101
101
  return option;
102
102
  }
103
103
  getChannel(name) {
104
- const option = this.getTypedOption(name, [common_1.ApplicationCommandOptionType.Channel]);
104
+ const option = this.getTypedOption(name, [v10_1.ApplicationCommandOptionType.Channel]);
105
105
  return option.channel;
106
106
  }
107
107
  getString(name) {
108
- const option = this.getTypedOption(name, [common_1.ApplicationCommandOptionType.String]);
108
+ const option = this.getTypedOption(name, [v10_1.ApplicationCommandOptionType.String]);
109
109
  return option.value;
110
110
  }
111
111
  transformOption(option, resolved) {
@@ -1,6 +1,5 @@
1
1
  export * from './it/constants';
2
2
  export * from './it/utils';
3
- export * from 'discord-api-types/v10';
4
3
  export * from './it/colors';
5
4
  export * from './it/logger';
6
5
  export * from './shorters/channels';
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./it/constants"), exports);
18
18
  __exportStar(require("./it/utils"), exports);
19
19
  //
20
- __exportStar(require("discord-api-types/v10"), exports);
21
20
  __exportStar(require("./it/colors"), exports);
22
21
  __exportStar(require("./it/logger"), exports);
23
22
  __exportStar(require("./shorters/channels"), exports);
@@ -28,7 +28,9 @@ export declare enum EmbedColors {
28
28
  Blurple = 5793266,
29
29
  Greyple = 10070709,
30
30
  DarkButNotBlack = 2895667,
31
- NotQuiteBlack = 2303786
31
+ NotQuiteBlack = 2303786,
32
+ DiscordDark = 3224376,
33
+ DiscordLight = 16382457
32
34
  }
33
35
  export declare const DiscordEpoch = 1420070400000n;
34
36
  export declare const BASE_HOST = "https://discord.com";
@@ -33,6 +33,8 @@ var EmbedColors;
33
33
  EmbedColors[EmbedColors["Greyple"] = 10070709] = "Greyple";
34
34
  EmbedColors[EmbedColors["DarkButNotBlack"] = 2895667] = "DarkButNotBlack";
35
35
  EmbedColors[EmbedColors["NotQuiteBlack"] = 2303786] = "NotQuiteBlack";
36
+ EmbedColors[EmbedColors["DiscordDark"] = 3224376] = "DiscordDark";
37
+ EmbedColors[EmbedColors["DiscordLight"] = 16382457] = "DiscordLight";
36
38
  })(EmbedColors || (exports.EmbedColors = EmbedColors = {}));
37
39
  exports.DiscordEpoch = 1420070400000n;
38
40
  exports.BASE_HOST = 'https://discord.com';
@@ -40,6 +40,7 @@ export declare function filterSplit<Element, Predicate extends (value: Element)
40
40
  */
41
41
  export declare class BaseHandler {
42
42
  protected logger: Logger;
43
+ __callback?: (...args: any[]) => any;
43
44
  /**
44
45
  * Initializes a new instance of the BaseHandler class.
45
46
  * @param logger The logger instance.
@@ -95,6 +95,7 @@ exports.filterSplit = filterSplit;
95
95
  */
96
96
  class BaseHandler {
97
97
  logger;
98
+ __callback;
98
99
  /**
99
100
  * Initializes a new instance of the BaseHandler class.
100
101
  * @param logger The logger instance.
@@ -241,7 +242,7 @@ async function magicImport(path) {
241
242
  }
242
243
  catch {
243
244
  // biome-ignore lint/security/noGlobalEval: modules import broke
244
- return eval('((path) => import(`file:///${path}`))')(path.split('\\').join('\\\\'));
245
+ return eval('((path) => import(`file:///${path}?update=${Date.now()}`))')(path.split('\\').join('\\\\'));
245
246
  }
246
247
  }
247
248
  exports.magicImport = magicImport;
@@ -1,4 +1,4 @@
1
- import { type RESTPatchAPIChannelJSONBody } from '..';
1
+ import { type RESTPatchAPIChannelJSONBody } from 'discord-api-types/v10';
2
2
  import { Message, type GuildMember, type GuildRole } from '../../structures';
3
3
  import { type AllChannels } from '../../structures/channels';
4
4
  import { PermissionsBitField } from '../../structures/extra/Permissions';
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ChannelShorter = void 0;
7
- const __1 = require("..");
7
+ const v10_1 = require("discord-api-types/v10");
8
8
  const structures_1 = require("../../structures");
9
9
  const channels_1 = __importDefault(require("../../structures/channels"));
10
10
  const Permissions_1 = require("../../structures/extra/Permissions");
@@ -86,7 +86,7 @@ class ChannelShorter extends base_1.BaseShorter {
86
86
  }
87
87
  async memberPermissions(channelId, member, checkAdmin = true) {
88
88
  const permissions = await member.fetchPermissions();
89
- if (checkAdmin && permissions.has(__1.PermissionFlagsBits.Administrator)) {
89
+ if (checkAdmin && permissions.has(v10_1.PermissionFlagsBits.Administrator)) {
90
90
  return new Permissions_1.PermissionsBitField(Permissions_1.PermissionsBitField.All);
91
91
  }
92
92
  const overwrites = await this.overwritesFor(channelId, member);
@@ -107,7 +107,7 @@ class ChannelShorter extends base_1.BaseShorter {
107
107
  if (overwrite.id === member.guildId) {
108
108
  everyoneOverwrites = overwrite;
109
109
  }
110
- else if (member.roles.values.includes(overwrite.id)) {
110
+ else if (member.roles.keys.includes(overwrite.id)) {
111
111
  roleOverwrites.push(overwrite);
112
112
  }
113
113
  else if (overwrite.id === member.id) {
@@ -121,7 +121,7 @@ class ChannelShorter extends base_1.BaseShorter {
121
121
  };
122
122
  }
123
123
  async rolePermissions(channelId, role, checkAdmin = true) {
124
- if (checkAdmin && role.permissions.has(__1.PermissionFlagsBits.Administrator)) {
124
+ if (checkAdmin && role.permissions.has(v10_1.PermissionFlagsBits.Administrator)) {
125
125
  return new Permissions_1.PermissionsBitField(Permissions_1.PermissionsBitField.All);
126
126
  }
127
127
  const channelOverwrites = (await this.client.cache.overwrites?.get(channelId)) ?? [];
@@ -24,7 +24,7 @@ export declare class GuildShorter extends BaseShorter {
24
24
  */
25
25
  widgetURL(id: string, style?: GuildWidgetStyle): Promise<import("discord-api-types/v10").APIGuildWidgetSettings>;
26
26
  list(query?: RESTGetAPICurrentUserGuildsQuery): Promise<AnonymousGuild[]>;
27
- fetchSelf(id: string): Promise<GuildMember>;
27
+ fetchSelf(id: string, force?: boolean): Promise<GuildMember>;
28
28
  leave(id: string): Promise<void | undefined>;
29
29
  /**
30
30
  * Provides access to channel-related functionality in a guild.
@@ -54,7 +54,12 @@ class GuildShorter extends base_1.BaseShorter {
54
54
  .guilds.get({ query })
55
55
  .then(guilds => guilds.map(guild => new structures_1.AnonymousGuild(this.client, { ...guild, splash: null })));
56
56
  }
57
- async fetchSelf(id) {
57
+ async fetchSelf(id, force = false) {
58
+ if (!force) {
59
+ const self = await this.client.cache.members?.get(this.client.botId, id);
60
+ if (self)
61
+ return self;
62
+ }
58
63
  const self = await this.client.proxy.guilds(id).members(this.client.botId).get();
59
64
  await this.client.cache.members?.patch(self.user.id, id, self);
60
65
  return new structures_1.GuildMember(this.client, self, self.user, id);
@@ -1,5 +1,7 @@
1
- import { type GuildMemberResolvable, type RESTGetAPIGuildMembersQuery, type RESTGetAPIGuildMembersSearchQuery, type RESTPatchAPIGuildMemberJSONBody, type RESTPutAPIGuildBanJSONBody, type RESTPutAPIGuildMemberJSONBody } from '..';
1
+ import type { RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersSearchQuery, RESTPatchAPIGuildMemberJSONBody, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildMemberJSONBody } from 'discord-api-types/v10';
2
2
  import { GuildMember } from '../../structures';
3
+ import { PermissionsBitField } from '../../structures/extra/Permissions';
4
+ import type { GuildMemberResolvable } from '../types/resolvables';
3
5
  import { BaseShorter } from './base';
4
6
  export declare class MemberShorter extends BaseShorter {
5
7
  /**
@@ -86,4 +88,7 @@ export declare class MemberShorter extends BaseShorter {
86
88
  * @param id The ID of the role to remove.
87
89
  */
88
90
  removeRole(guildId: string, memberId: string, id: string): Promise<never>;
91
+ listRoles(guildId: string, memberId: string, force?: boolean): Promise<import("../../structures").GuildRole[]>;
92
+ sortRoles(guildId: string, memberId: string, force?: boolean): Promise<import("../../structures").GuildRole[]>;
93
+ permissions(guildId: string, memberId: string, force?: boolean): Promise<PermissionsBitField>;
89
94
  }
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemberShorter = void 0;
4
- const __1 = require("..");
4
+ const globals_1 = require("discord-api-types/globals");
5
5
  const structures_1 = require("../../structures");
6
+ const Permissions_1 = require("../../structures/extra/Permissions");
6
7
  const base_1 = require("./base");
7
8
  class MemberShorter extends base_1.BaseShorter {
8
9
  /**
@@ -13,7 +14,7 @@ class MemberShorter extends base_1.BaseShorter {
13
14
  */
14
15
  async resolve(guildId, resolve) {
15
16
  if (typeof resolve === 'string') {
16
- const match = resolve.match(__1.FormattingPatterns.User)?.groups;
17
+ const match = resolve.match(globals_1.FormattingPatterns.User)?.groups;
17
18
  if (match?.id) {
18
19
  return this.fetch(guildId, match.id);
19
20
  }
@@ -160,5 +161,27 @@ class MemberShorter extends base_1.BaseShorter {
160
161
  removeRole(guildId, memberId, id) {
161
162
  return this.client.proxy.guilds(guildId).members(memberId).roles(id).delete();
162
163
  }
164
+ async listRoles(guildId, memberId, force = false) {
165
+ if (!force) {
166
+ const member = await this.client.cache.members?.get(memberId, guildId);
167
+ if (member) {
168
+ const roles = (await this.client.cache.roles?.bulk(member.roles.keys)) ?? [];
169
+ if (roles.length)
170
+ return roles;
171
+ }
172
+ }
173
+ const member = await this.client.members.fetch(guildId, memberId, force);
174
+ const allRoles = await this.client.roles.list(guildId, force);
175
+ const rolesId = member.roles.keys.concat(guildId);
176
+ return allRoles.filter(role => rolesId.includes(role.id));
177
+ }
178
+ async sortRoles(guildId, memberId, force = false) {
179
+ const roles = await this.listRoles(guildId, memberId, force);
180
+ return roles.sort((a, b) => b.position - a.position);
181
+ }
182
+ async permissions(guildId, memberId, force = false) {
183
+ const roles = await this.listRoles(guildId, memberId, force);
184
+ return new Permissions_1.PermissionsBitField(roles.map(x => BigInt(x.permissions.bits)));
185
+ }
163
186
  }
164
187
  exports.MemberShorter = MemberShorter;
@@ -6,7 +6,7 @@ export declare class MessageShorter extends BaseShorter {
6
6
  write(channelId: string, { files, ...body }: MessageCreateBodyRequest): Promise<Message>;
7
7
  edit(messageId: string, channelId: string, { files, ...body }: MessageUpdateBodyRequest): Promise<Message>;
8
8
  crosspost(messageId: string, channelId: string, reason?: string): Promise<Message>;
9
- delete(messageId: string, channelId: string, reason?: string): Promise<void>;
9
+ delete(messageId: string, channelId: string, reason?: string): Promise<void | undefined>;
10
10
  fetch(messageId: string, channelId: string): Promise<Message>;
11
11
  purge(messages: string[], channelId: string, reason?: string): Promise<never>;
12
12
  thread(channelId: string, messageId: string, options: RESTPostAPIChannelMessagesThreadsJSONBody & {
@@ -44,7 +44,7 @@ class MessageShorter extends base_1.BaseShorter {
44
44
  .messages(messageId)
45
45
  .delete({ reason })
46
46
  .then(() => {
47
- return this.client.components.onMessageDelete(messageId);
47
+ return this.client.components?.onMessageDelete(messageId);
48
48
  });
49
49
  }
50
50
  fetch(messageId, channelId) {
@@ -6,10 +6,4 @@ export declare class UsersShorter extends BaseShorter {
6
6
  deleteDM(userId: string, reason?: string): Promise<DMChannel>;
7
7
  fetch(userId: string, force?: boolean): Promise<User>;
8
8
  write(userId: string, body: MessageCreateBodyRequest): Promise<import("../../structures").Message>;
9
- get users(): {
10
- createDM: (userId: string, force?: boolean) => Promise<DMChannel>;
11
- deleteDM: (userId: string, reason?: string) => Promise<DMChannel>;
12
- fetch: (userId: string, force?: boolean) => Promise<User>;
13
- write: (userId: string, body: MessageCreateBodyRequest) => Promise<import("../../structures").Message>;
14
- };
15
9
  }
@@ -34,39 +34,5 @@ class UsersShorter extends base_1.BaseShorter {
34
34
  async write(userId, body) {
35
35
  return (await this.client.users.createDM(userId)).messages.write(body);
36
36
  }
37
- get users() {
38
- return {
39
- createDM: async (userId, force = false) => {
40
- if (!force) {
41
- const dm = await this.client.cache.channels?.get(userId);
42
- if (dm)
43
- return dm;
44
- }
45
- const data = await this.client.proxy.users('@me').channels.post({
46
- body: { recipient_id: userId },
47
- });
48
- await this.client.cache.channels?.set(userId, '@me', data);
49
- return new structures_1.DMChannel(this.client, data);
50
- },
51
- deleteDM: async (userId, reason) => {
52
- const res = await this.client.proxy.channels(userId).delete({ reason });
53
- await this.client.cache.channels?.removeIfNI(structures_1.BaseChannel.__intent__('@me'), res.id, '@me');
54
- return new structures_1.DMChannel(this.client, res);
55
- },
56
- fetch: async (userId, force = false) => {
57
- if (!force) {
58
- const user = await this.client.cache.users?.get(userId);
59
- if (user)
60
- return user;
61
- }
62
- const data = await this.client.proxy.users(userId).get();
63
- await this.client.cache.users?.patch(userId, data);
64
- return new structures_1.User(this.client, data);
65
- },
66
- write: async (userId, body) => {
67
- return (await this.client.users.createDM(userId)).messages.write(body);
68
- },
69
- };
70
- }
71
37
  }
72
38
  exports.UsersShorter = UsersShorter;
@@ -1,4 +1,4 @@
1
- import type { RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIChannelWebhookJSONBody } from '..';
1
+ import type { RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIChannelWebhookJSONBody } from 'discord-api-types/v10';
2
2
  import { Webhook, WebhookMessage, type MessageWebhookMethodEditParams, type MessageWebhookMethodWriteParams } from '../../structures';
3
3
  import { BaseShorter } from './base';
4
4
  export declare class WebhookShorter extends BaseShorter {
@@ -17,7 +17,7 @@ export declare class WebhookShorter extends BaseShorter {
17
17
  * @param options The optional parameters including token and reason.
18
18
  * @returns A Promise that resolves when the webhook is edited.
19
19
  */
20
- edit(webhookId: string, body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, options: WebhookShorterOptionalParams): Promise<import("discord-api-types/rest/v10/webhook").RESTGetAPIWebhookWithTokenResult>;
20
+ edit(webhookId: string, body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, options: WebhookShorterOptionalParams): Promise<import("discord-api-types/v10").RESTGetAPIWebhookWithTokenResult>;
21
21
  /**
22
22
  * Fetches a webhook.
23
23
  * @param webhookId The ID of the webhook.
@@ -1,4 +1,5 @@
1
- import type { APIPartialEmoji, EmbedColors } from '..';
1
+ import type { APIPartialEmoji } from 'discord-api-types/v10';
2
+ import type { EmbedColors } from '..';
2
3
  import type { Attachment, AttachmentDataType, AttachmentResolvable } from '../../builders';
3
4
  import type { GuildMember } from '../../structures';
4
5
  export type EmojiResolvable = string | Partial<APIPartialEmoji> | `<${string | undefined}:${string}:${string}>`;
@@ -1,4 +1,4 @@
1
- import type { GatewayIntentBits, PermissionFlagsBits } from '..';
1
+ import type { GatewayIntentBits, PermissionFlagsBits } from 'discord-api-types/v10';
2
2
  export type ToClass<T, This> = new (...args: any[]) => {
3
3
  [K in keyof T]: T[K] extends (...args: any[]) => any ? ReturnType<T[K]> extends Promise<T> ? (...args: Parameters<T[K]>) => Promise<This> : ReturnType<T[K]> extends T ? (...args: Parameters<T[K]>) => This : T[K] : T[K];
4
4
  };
@@ -34,6 +34,8 @@ export type Identify<T> = T extends infer U ? {
34
34
  } : never;
35
35
  export type TypeArray<T> = T | T[];
36
36
  export type When<T extends boolean, A, B = never> = T extends true ? A : B;
37
+ export type AuxIsStrictlyUndefined<T> = T extends undefined | null | never | void ? true : false;
38
+ export type IsStrictlyUndefined<T> = AuxIsStrictlyUndefined<T> extends true ? true : AuxIsStrictlyUndefined<T> extends false ? false : false;
37
39
  export type If<T extends boolean, A, B = null> = T extends true ? A : B extends null ? A | null : B;
38
40
  export type PickPartial<T, K extends keyof T> = {
39
41
  [P in keyof T]?: T[P] | undefined;
@@ -88,4 +90,5 @@ export type AtLeastOne<T, U = {
88
90
  [K in keyof T]: Pick<T, K>;
89
91
  }> = Partial<T> & U[keyof U];
90
92
  export type FlatObjectKeys<T extends Record<string, any>, Key = keyof T> = Key extends string ? T[Key] extends Record<string, unknown> ? `${Key}.${FlatObjectKeys<T[Key]>}` : T[Key] extends string ? `${Key}` : never : never;
93
+ export type Awaitable<V> = Promise<V> | V;
91
94
  export {};
@@ -1,4 +1,4 @@
1
- import type { APIActionRowComponent, APIEmbed, APIInteractionResponseCallbackData, APIInteractionResponseChannelMessageWithSource, APIMessageActionRowComponent, APIModalInteractionResponse, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPostAPIChannelMessageJSONBody, RESTPostAPIWebhookWithTokenJSONBody } from '..';
1
+ import type { APIActionRowComponent, APIEmbed, APIInteractionResponseCallbackData, APIInteractionResponseChannelMessageWithSource, APIMessageActionRowComponent, APIModalInteractionResponse, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPostAPIChannelMessageJSONBody, RESTPostAPIWebhookWithTokenJSONBody } from 'discord-api-types/v10';
2
2
  import type { RawFile } from '../../api';
3
3
  import type { ActionRow, Attachment, AttachmentBuilder, BuilderComponents, Embed, Modal } from '../../builders';
4
4
  import type { OmitInsert } from './util';
@@ -1,10 +1,11 @@
1
- import type { APIMessageActionRowComponent, ComponentType } from '../common';
2
- import { BaseComponent } from '../structures/extra/BaseComponent';
1
+ import type { APIMessageActionRowComponent, ComponentType } from 'discord-api-types/v10';
2
+ import { BaseComponent } from './BaseComponent';
3
3
  import type { ActionRowMessageComponents } from './index';
4
4
  export declare class MessageActionRowComponent<T extends ActionRowMessageComponents> extends BaseComponent<ComponentType.ActionRow> {
5
+ private ComponentsFactory;
5
6
  constructor(data: {
6
7
  type: ComponentType.ActionRow;
7
8
  components: APIMessageActionRowComponent[];
8
9
  });
9
- components: T[];
10
+ get components(): T[];
10
11
  }
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageActionRowComponent = void 0;
4
- const BaseComponent_1 = require("../structures/extra/BaseComponent");
4
+ const BaseComponent_1 = require("./BaseComponent");
5
5
  const index_1 = require("./index");
6
6
  class MessageActionRowComponent extends BaseComponent_1.BaseComponent {
7
+ ComponentsFactory;
7
8
  constructor(data) {
8
9
  super(data);
9
- this.components = data.components.map(index_1.componentFactory);
10
+ this.ComponentsFactory = data.components.map(index_1.componentFactory);
11
+ }
12
+ get components() {
13
+ return this.ComponentsFactory;
10
14
  }
11
- components;
12
15
  }
13
16
  exports.MessageActionRowComponent = MessageActionRowComponent;
@@ -0,0 +1,18 @@
1
+ import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIButtonComponent, type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APIStringSelectComponent, type APITextInputComponent, type APIUserSelectComponent, ComponentType } from 'discord-api-types/v10';
2
+ export declare class BaseComponent<T extends ComponentType> {
3
+ data: APIComponentsMap[T];
4
+ constructor(data: APIComponentsMap[T]);
5
+ get type(): ComponentType;
6
+ toJSON(): APIComponentsMap[T];
7
+ toBuilder(): import("../builders").BuilderComponents | import("../builders").ActionRow<import("../builders").BuilderComponents>;
8
+ }
9
+ export interface APIComponentsMap {
10
+ [ComponentType.ActionRow]: APIActionRowComponent<APIActionRowComponentTypes>;
11
+ [ComponentType.Button]: APIButtonComponent;
12
+ [ComponentType.ChannelSelect]: APIChannelSelectComponent;
13
+ [ComponentType.MentionableSelect]: APIMentionableSelectComponent;
14
+ [ComponentType.RoleSelect]: APIRoleSelectComponent;
15
+ [ComponentType.StringSelect]: APIStringSelectComponent;
16
+ [ComponentType.UserSelect]: APIUserSelectComponent;
17
+ [ComponentType.TextInput]: APITextInputComponent;
18
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseComponent = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
5
+ const builders_1 = require("../builders");
6
+ class BaseComponent {
7
+ data;
8
+ constructor(data) {
9
+ this.data = data;
10
+ }
11
+ get type() {
12
+ return this.data.type;
13
+ }
14
+ toJSON() {
15
+ return this.data;
16
+ }
17
+ toBuilder() {
18
+ return (0, builders_1.fromComponent)(this.data);
19
+ }
20
+ }
21
+ exports.BaseComponent = BaseComponent;
@@ -0,0 +1,10 @@
1
+ import type { ComponentType } from 'discord-api-types/v10';
2
+ import { BaseComponent } from './BaseComponent';
3
+ export type APISelectMenuComponentTypes = ComponentType.ChannelSelect | ComponentType.MentionableSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect;
4
+ export declare class BaseSelectMenuComponent<T extends APISelectMenuComponentTypes> extends BaseComponent<T> {
5
+ get customId(): string;
6
+ get disabed(): boolean | undefined;
7
+ get max(): number | undefined;
8
+ get min(): number | undefined;
9
+ get placeholder(): string | undefined;
10
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseSelectMenuComponent = void 0;
4
+ const BaseComponent_1 = require("./BaseComponent");
5
+ class BaseSelectMenuComponent extends BaseComponent_1.BaseComponent {
6
+ get customId() {
7
+ return this.data.custom_id;
8
+ }
9
+ get disabed() {
10
+ return this.data.disabled;
11
+ }
12
+ get max() {
13
+ return this.data.max_values;
14
+ }
15
+ get min() {
16
+ return this.data.min_values;
17
+ }
18
+ get placeholder() {
19
+ return this.data.placeholder;
20
+ }
21
+ }
22
+ exports.BaseSelectMenuComponent = BaseSelectMenuComponent;