seyfert 4.5.0 → 5.0.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 (230) hide show
  1. package/lib/api/Routes/cdn.d.ts +2 -2
  2. package/lib/api/Routes/guilds.d.ts +2 -2
  3. package/lib/api/Routes/invites.d.ts +2 -2
  4. package/lib/api/api.d.ts +20 -8
  5. package/lib/api/api.js +198 -44
  6. package/lib/api/shared.d.ts +30 -1
  7. package/lib/api/utils/constants.d.ts +1 -1
  8. package/lib/api/utils/constants.js +1 -1
  9. package/lib/api/utils/utils.d.ts +2 -1
  10. package/lib/api/utils/utils.js +1 -1
  11. package/lib/builders/Attachment.d.ts +1 -1
  12. package/lib/builders/Attachment.js +30 -8
  13. package/lib/builders/MediaGallery.d.ts +2 -2
  14. package/lib/builders/MediaGallery.js +10 -0
  15. package/lib/builders/Modal.d.ts +18 -8
  16. package/lib/builders/Modal.js +36 -7
  17. package/lib/builders/Poll.js +18 -0
  18. package/lib/builders/RadioGroup.d.ts +4 -3
  19. package/lib/builders/RadioGroup.js +24 -3
  20. package/lib/builders/SelectMenu.d.ts +8 -6
  21. package/lib/builders/SelectMenu.js +24 -3
  22. package/lib/builders/types.d.ts +3 -2
  23. package/lib/cache/adapters/default.d.ts +1 -1
  24. package/lib/cache/adapters/default.js +23 -26
  25. package/lib/cache/adapters/limited.d.ts +1 -0
  26. package/lib/cache/adapters/limited.js +47 -33
  27. package/lib/cache/index.d.ts +19 -25
  28. package/lib/cache/index.js +58 -6
  29. package/lib/cache/resources/bans.d.ts +1 -1
  30. package/lib/cache/resources/bans.js +4 -4
  31. package/lib/cache/resources/channels.d.ts +1 -1
  32. package/lib/cache/resources/channels.js +4 -4
  33. package/lib/cache/resources/default/base.d.ts +1 -1
  34. package/lib/cache/resources/default/base.js +8 -8
  35. package/lib/cache/resources/default/guild-based.d.ts +5 -5
  36. package/lib/cache/resources/default/guild-based.js +29 -16
  37. package/lib/cache/resources/default/guild-related.d.ts +5 -5
  38. package/lib/cache/resources/default/guild-related.js +14 -14
  39. package/lib/cache/resources/emojis.d.ts +1 -1
  40. package/lib/cache/resources/emojis.js +4 -4
  41. package/lib/cache/resources/guilds.js +28 -15
  42. package/lib/cache/resources/members.d.ts +1 -1
  43. package/lib/cache/resources/members.js +6 -6
  44. package/lib/cache/resources/messages.d.ts +7 -2
  45. package/lib/cache/resources/messages.js +43 -20
  46. package/lib/cache/resources/overwrites.d.ts +1 -1
  47. package/lib/cache/resources/overwrites.js +5 -8
  48. package/lib/cache/resources/roles.d.ts +1 -1
  49. package/lib/cache/resources/roles.js +4 -4
  50. package/lib/cache/resources/stickers.d.ts +1 -1
  51. package/lib/cache/resources/stickers.js +4 -4
  52. package/lib/cache/resources/users.js +4 -4
  53. package/lib/cache/resources/voice-states.d.ts +1 -1
  54. package/lib/cache/resources/voice-states.js +4 -4
  55. package/lib/client/base.d.ts +83 -24
  56. package/lib/client/base.js +594 -39
  57. package/lib/client/client.d.ts +28 -3
  58. package/lib/client/client.js +33 -9
  59. package/lib/client/collectors.d.ts +9 -8
  60. package/lib/client/collectors.js +19 -52
  61. package/lib/client/httpclient.d.ts +3 -0
  62. package/lib/client/index.d.ts +3 -1
  63. package/lib/client/index.js +4 -0
  64. package/lib/client/intents.d.ts +3 -0
  65. package/lib/client/intents.js +9 -0
  66. package/lib/client/plugins/api.d.ts +4 -0
  67. package/lib/client/plugins/api.js +550 -0
  68. package/lib/client/plugins/errors.d.ts +25 -0
  69. package/lib/client/plugins/errors.js +79 -0
  70. package/lib/client/plugins/order.d.ts +10 -0
  71. package/lib/client/plugins/order.js +32 -0
  72. package/lib/client/plugins/registry.d.ts +273 -0
  73. package/lib/client/plugins/registry.js +868 -0
  74. package/lib/client/plugins/shared.d.ts +23 -0
  75. package/lib/client/plugins/shared.js +193 -0
  76. package/lib/client/plugins/types.d.ts +398 -0
  77. package/lib/client/plugins/types.js +8 -0
  78. package/lib/client/plugins.d.ts +78 -0
  79. package/lib/client/plugins.js +558 -0
  80. package/lib/client/transformers.d.ts +33 -33
  81. package/lib/client/workerclient.d.ts +10 -1
  82. package/lib/client/workerclient.js +27 -17
  83. package/lib/collection.d.ts +10 -8
  84. package/lib/collection.js +19 -25
  85. package/lib/commands/applications/chat.d.ts +20 -18
  86. package/lib/commands/applications/chat.js +39 -14
  87. package/lib/commands/applications/chatcontext.d.ts +23 -15
  88. package/lib/commands/applications/chatcontext.js +23 -2
  89. package/lib/commands/applications/entryPoint.d.ts +4 -3
  90. package/lib/commands/applications/entryPoint.js +1 -1
  91. package/lib/commands/applications/entrycontext.d.ts +7 -9
  92. package/lib/commands/applications/entrycontext.js +3 -1
  93. package/lib/commands/applications/menu.d.ts +4 -3
  94. package/lib/commands/applications/menucontext.d.ts +7 -9
  95. package/lib/commands/applications/menucontext.js +3 -1
  96. package/lib/commands/applications/options.d.ts +23 -23
  97. package/lib/commands/applications/shared.d.ts +39 -17
  98. package/lib/commands/decorators.d.ts +50 -38
  99. package/lib/commands/decorators.js +15 -5
  100. package/lib/commands/handle.d.ts +19 -8
  101. package/lib/commands/handle.js +224 -143
  102. package/lib/commands/handler.d.ts +21 -8
  103. package/lib/commands/handler.js +157 -69
  104. package/lib/commands/index.d.ts +1 -0
  105. package/lib/commands/optionresolver.d.ts +2 -2
  106. package/lib/common/it/colors.js +12 -2
  107. package/lib/common/it/error.d.ts +9 -0
  108. package/lib/common/it/error.js +8 -0
  109. package/lib/common/it/fake-promise.d.ts +4 -0
  110. package/lib/common/it/fake-promise.js +10 -0
  111. package/lib/common/it/formatter.d.ts +14 -11
  112. package/lib/common/it/formatter.js +4 -3
  113. package/lib/common/it/logger.d.ts +7 -1
  114. package/lib/common/it/logger.js +24 -6
  115. package/lib/common/it/utils.d.ts +6 -8
  116. package/lib/common/it/utils.js +44 -42
  117. package/lib/common/shorters/application.d.ts +3 -3
  118. package/lib/common/shorters/application.js +3 -2
  119. package/lib/common/shorters/bans.d.ts +8 -4
  120. package/lib/common/shorters/bans.js +13 -5
  121. package/lib/common/shorters/channels.d.ts +4 -4
  122. package/lib/common/shorters/channels.js +4 -4
  123. package/lib/common/shorters/emojis.js +1 -0
  124. package/lib/common/shorters/guilds.d.ts +8 -8
  125. package/lib/common/shorters/guilds.js +14 -31
  126. package/lib/common/shorters/interaction.d.ts +1 -1
  127. package/lib/common/shorters/invites.d.ts +201 -201
  128. package/lib/common/shorters/members.d.ts +7 -7
  129. package/lib/common/shorters/members.js +13 -14
  130. package/lib/common/shorters/messages.d.ts +2 -2
  131. package/lib/common/shorters/soundboard.d.ts +5 -5
  132. package/lib/common/shorters/users.d.ts +1 -1
  133. package/lib/common/shorters/webhook.d.ts +3 -2
  134. package/lib/common/shorters/webhook.js +0 -7
  135. package/lib/common/types/options.d.ts +4 -0
  136. package/lib/common/types/util.d.ts +8 -0
  137. package/lib/common/types/write.d.ts +2 -1
  138. package/lib/components/BaseSelectMenuComponent.d.ts +1 -1
  139. package/lib/components/BaseSelectMenuComponent.js +1 -1
  140. package/lib/components/ButtonComponent.d.ts +3 -3
  141. package/lib/components/ChannelSelectMenuComponent.d.ts +2 -2
  142. package/lib/components/File.d.ts +1 -1
  143. package/lib/components/MediaGallery.d.ts +1 -1
  144. package/lib/components/MentionableSelectMenuComponent.d.ts +1 -1
  145. package/lib/components/RoleSelectMenuComponent.d.ts +1 -1
  146. package/lib/components/Separator.d.ts +1 -1
  147. package/lib/components/StringSelectMenuComponent.d.ts +1 -1
  148. package/lib/components/TextInputComponent.d.ts +1 -1
  149. package/lib/components/Thumbnail.d.ts +1 -1
  150. package/lib/components/UserSelectMenuComponent.d.ts +1 -1
  151. package/lib/components/componentcommand.d.ts +8 -7
  152. package/lib/components/componentcontext.d.ts +24 -36
  153. package/lib/components/componentcontext.js +7 -17
  154. package/lib/components/handler.d.ts +17 -7
  155. package/lib/components/handler.js +108 -49
  156. package/lib/components/index.d.ts +1 -0
  157. package/lib/components/index.js +1 -0
  158. package/lib/components/interactioncontext.d.ts +45 -0
  159. package/lib/components/interactioncontext.js +93 -0
  160. package/lib/components/modalcommand.d.ts +5 -4
  161. package/lib/components/modalcontext.d.ts +39 -20
  162. package/lib/components/modalcontext.js +59 -6
  163. package/lib/events/event.d.ts +9 -3
  164. package/lib/events/handler.d.ts +51 -6
  165. package/lib/events/handler.js +165 -36
  166. package/lib/events/hooks/application_command.d.ts +1 -1
  167. package/lib/events/hooks/auto_moderation.d.ts +2 -2
  168. package/lib/events/hooks/guild.d.ts +150 -150
  169. package/lib/events/hooks/interactions.d.ts +1 -1
  170. package/lib/events/hooks/invite.d.ts +20 -20
  171. package/lib/events/hooks/message.d.ts +27 -27
  172. package/lib/events/hooks/presence.d.ts +11 -11
  173. package/lib/events/hooks/soundboard.d.ts +6 -6
  174. package/lib/events/hooks/stage.d.ts +2 -2
  175. package/lib/events/hooks/subscriptions.d.ts +3 -3
  176. package/lib/events/hooks/thread.d.ts +30 -30
  177. package/lib/events/hooks/voice.d.ts +3 -4
  178. package/lib/events/hooks/voice.js +2 -1
  179. package/lib/events/utils.d.ts +4 -0
  180. package/lib/events/utils.js +59 -0
  181. package/lib/index.d.ts +9 -4
  182. package/lib/index.js +13 -8
  183. package/lib/langs/handler.d.ts +14 -11
  184. package/lib/langs/handler.js +46 -9
  185. package/lib/langs/router.d.ts +10 -3
  186. package/lib/structures/Application.d.ts +1 -1
  187. package/lib/structures/Emoji.d.ts +3 -3
  188. package/lib/structures/Emoji.js +2 -2
  189. package/lib/structures/Guild.d.ts +154 -154
  190. package/lib/structures/GuildBan.d.ts +4 -4
  191. package/lib/structures/GuildBan.js +3 -3
  192. package/lib/structures/GuildMember.d.ts +7 -7
  193. package/lib/structures/GuildMember.js +28 -7
  194. package/lib/structures/GuildRole.d.ts +1 -1
  195. package/lib/structures/GuildRole.js +2 -2
  196. package/lib/structures/Interaction.d.ts +11 -9
  197. package/lib/structures/Interaction.js +33 -12
  198. package/lib/structures/Message.d.ts +21 -14
  199. package/lib/structures/Message.js +29 -14
  200. package/lib/structures/User.d.ts +1 -1
  201. package/lib/structures/VoiceState.d.ts +4 -0
  202. package/lib/structures/VoiceState.js +13 -1
  203. package/lib/structures/Webhook.d.ts +9 -1
  204. package/lib/structures/Webhook.js +4 -1
  205. package/lib/structures/channels.d.ts +148 -134
  206. package/lib/structures/channels.js +27 -26
  207. package/lib/structures/extra/BitField.d.ts +4 -4
  208. package/lib/structures/extra/BitField.js +20 -4
  209. package/lib/structures/extra/DiscordBase.js +1 -1
  210. package/lib/structures/extra/Permissions.d.ts +2 -4
  211. package/lib/structures/extra/Permissions.js +1 -17
  212. package/lib/types/payloads/_interactions/responses.d.ts +2 -2
  213. package/lib/types/payloads/components.d.ts +4 -4
  214. package/lib/websocket/SharedTypes.d.ts +4 -4
  215. package/lib/websocket/constants/index.d.ts +1 -1
  216. package/lib/websocket/constants/index.js +3 -2
  217. package/lib/websocket/discord/events/memberUpdate.js +2 -2
  218. package/lib/websocket/discord/heartbeater.d.ts +1 -0
  219. package/lib/websocket/discord/heartbeater.js +7 -0
  220. package/lib/websocket/discord/shard.d.ts +2 -2
  221. package/lib/websocket/discord/shard.js +15 -13
  222. package/lib/websocket/discord/sharder.d.ts +8 -7
  223. package/lib/websocket/discord/sharder.js +25 -5
  224. package/lib/websocket/discord/shared.d.ts +19 -6
  225. package/lib/websocket/discord/socket/custom.js +5 -0
  226. package/lib/websocket/discord/worker.d.ts +1 -0
  227. package/lib/websocket/discord/worker.js +2 -0
  228. package/lib/websocket/discord/workermanager.d.ts +25 -11
  229. package/lib/websocket/discord/workermanager.js +41 -10
  230. package/package.json +12 -16
@@ -1,9 +1,14 @@
1
+ import type { RegisteredPluginMiddlewares, SeyfertRegistry } from '../client/plugins';
1
2
  import type { FlatObjectKeys, PermissionStrings } from '../common';
2
3
  import { ApplicationCommandType, ApplicationIntegrationType, type EntryPointCommandHandlerType, InteractionContextType, type LocaleString } from '../types';
3
4
  import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
4
- import type { DefaultLocale, ExtraProps, IgnoreCommand, MiddlewareContext } from './applications/shared';
5
- export interface RegisteredMiddlewares {
6
- }
5
+ import type { AnyMiddlewareContext, DefaultLocale, ExtraProps, IgnoreCommand } from './applications/shared';
6
+ export type RegisteredMiddlewares = SeyfertRegistry extends {
7
+ middlewares: infer M extends Record<string, AnyMiddlewareContext>;
8
+ } ? M : {};
9
+ export type ResolvedRegisteredMiddlewares = RegisteredMiddlewares & RegisteredPluginMiddlewares;
10
+ type MiddlewareKey = keyof ResolvedRegisteredMiddlewares;
11
+ export type InferMiddlewares<T extends readonly MiddlewareKey[]> = T[number];
7
12
  export type CommandDeclareOptions = DecoratorDeclareOptions | (Omit<DecoratorDeclareOptions, 'description'> & {
8
13
  type: ApplicationCommandType.User | ApplicationCommandType.Message;
9
14
  }) | (Omit<DecoratorDeclareOptions, 'ignore' | 'aliases' | 'guildId'> & {
@@ -15,12 +20,12 @@ export interface DecoratorDeclareOptions {
15
20
  description: string;
16
21
  botPermissions?: PermissionStrings;
17
22
  defaultMemberPermissions?: PermissionStrings;
18
- guildId?: string[];
23
+ guildId?: readonly string[];
19
24
  nsfw?: boolean;
20
25
  integrationTypes?: (keyof typeof ApplicationIntegrationType)[] | ApplicationIntegrationType[];
21
26
  contexts?: (keyof typeof InteractionContextType)[] | InteractionContextType[];
22
27
  ignore?: IgnoreCommand;
23
- aliases?: string[];
28
+ aliases?: readonly string[];
24
29
  props?: ExtraProps;
25
30
  }
26
31
  export declare function Locales({ name: names, description: descriptions, }: {
@@ -48,56 +53,64 @@ export declare function LocalesT(name?: FlatObjectKeys<DefaultLocale>, descripti
48
53
  };
49
54
  };
50
55
  } & T;
51
- export declare function GroupsT(groups: Record<string, {
56
+ export type TranslatedGroupDefinition = {
52
57
  name?: FlatObjectKeys<DefaultLocale>;
53
58
  description?: FlatObjectKeys<DefaultLocale>;
54
59
  defaultDescription: string;
55
60
  aliases?: string[];
56
- }>): <T extends {
57
- new (...args: any[]): object;
58
- }>(target: T) => {
59
- new (...args: any[]): {
60
- __tGroups: Record<string, {
61
- name?: FlatObjectKeys<DefaultLocale>;
62
- description?: FlatObjectKeys<DefaultLocale>;
63
- defaultDescription: string;
64
- aliases?: string[];
65
- }>;
66
- groupsAliases: Record<string, string>;
67
- };
68
- } & T;
69
- export declare function Groups(groups: Record<string, {
61
+ };
62
+ export type LocalizedGroupDefinition = {
70
63
  name?: [language: LocaleString, value: string][];
71
64
  description?: [language: LocaleString, value: string][];
72
65
  defaultDescription: string;
73
66
  aliases?: string[];
74
- }>): <T extends {
67
+ };
68
+ export type GroupDefinition = TranslatedGroupDefinition | LocalizedGroupDefinition;
69
+ export type GroupDefinitions = Record<string, LocalizedGroupDefinition> | Record<string, TranslatedGroupDefinition>;
70
+ export declare function defineGroups<const T extends Record<string, LocalizedGroupDefinition>>(groups: T): T;
71
+ export declare function defineGroups<const T extends Record<string, TranslatedGroupDefinition>>(groups: T): T;
72
+ export declare function GroupsT<const T extends Record<string, TranslatedGroupDefinition>>(groups: T): <T_1 extends {
75
73
  new (...args: any[]): object;
76
- }>(target: T) => {
74
+ }>(target: T_1) => {
77
75
  new (...args: any[]): {
78
- groups: Record<string, {
79
- name?: [language: LocaleString, value: string][];
80
- description?: [language: LocaleString, value: string][];
81
- defaultDescription: string;
82
- aliases?: string[];
83
- }>;
76
+ __tGroups: T;
84
77
  groupsAliases: Record<string, string>;
85
78
  };
86
- } & T;
87
- export declare function Group(groupName: string): <T extends {
79
+ } & T_1;
80
+ export declare function Groups<const T extends Record<string, LocalizedGroupDefinition>>(groups: T): <T_1 extends {
81
+ new (...args: any[]): object;
82
+ }>(target: T_1) => {
83
+ new (...args: any[]): {
84
+ groups: T;
85
+ groupsAliases: Record<string, string>;
86
+ };
87
+ } & T_1;
88
+ type GroupDecorator = <T extends {
88
89
  new (...args: any[]): object;
89
90
  }>(target: T) => {
90
91
  new (...args: any[]): {
91
92
  group: string;
92
93
  };
93
94
  } & T;
94
- export declare function Options(options: (new () => SubCommand)[] | OptionsRecord): <T extends {
95
+ type OptionsDecorator = <T extends {
95
96
  new (...args: any[]): object;
96
97
  }>(target: T) => {
97
98
  new (...args: any[]): {
98
99
  options: SubCommand[] | CommandOption[];
99
100
  };
100
101
  } & T;
102
+ type LowercaseOptionsRecord<T extends OptionsRecord> = T & {
103
+ [K in keyof T as K extends string ? (K extends Lowercase<K> ? never : K) : never]: never;
104
+ };
105
+ type LowercaseDeclareName<T extends CommandDeclareOptions> = {
106
+ [K in keyof T]: K extends 'name' ? T extends {
107
+ type: ApplicationCommandType.User | ApplicationCommandType.Message;
108
+ } ? T[K] : string extends T[K] ? T[K] : T[K] extends Lowercase<T[K] & string> ? T[K] : Lowercase<T[K] & string> : T[K];
109
+ };
110
+ export declare function Group(groupName: string): GroupDecorator;
111
+ export declare function Group<const T extends GroupDefinitions>(_groupsDef: T, groupName: keyof T & string): GroupDecorator;
112
+ export declare function Options(options: (new () => SubCommand)[]): OptionsDecorator;
113
+ export declare function Options<const T extends OptionsRecord>(options: LowercaseOptionsRecord<T>): OptionsDecorator;
101
114
  export declare function AutoLoad(): <T extends {
102
115
  new (...args: any[]): object;
103
116
  }>(target: T) => {
@@ -105,19 +118,17 @@ export declare function AutoLoad(): <T extends {
105
118
  __autoload: boolean;
106
119
  };
107
120
  } & T;
108
- export type ParseMiddlewares<T extends Record<string, MiddlewareContext>> = {
109
- [k in keyof T]: T[k];
110
- };
111
- export declare function Middlewares(cbs: readonly (keyof RegisteredMiddlewares)[]): <T extends {
121
+ export declare function middlewares<const T extends readonly MiddlewareKey[]>(...cbs: T): T;
122
+ export declare function Middlewares(cbs: readonly MiddlewareKey[]): <T extends {
112
123
  new (...args: any[]): object;
113
124
  }>(target: T) => {
114
125
  new (...args: any[]): {
115
126
  middlewares: readonly never[];
116
127
  };
117
128
  } & T;
118
- export declare function Declare(declare: CommandDeclareOptions): <T extends {
129
+ export declare function Declare<const T extends CommandDeclareOptions>(input: LowercaseDeclareName<T>): <C extends {
119
130
  new (...args: any[]): object;
120
- }>(target: T) => {
131
+ }>(target: C) => {
121
132
  new (...args: any[]): {
122
133
  name: string;
123
134
  nsfw: boolean | undefined;
@@ -133,4 +144,5 @@ export declare function Declare(declare: CommandDeclareOptions): <T extends {
133
144
  aliases?: string[];
134
145
  handler?: EntryPointCommandHandlerType;
135
146
  };
136
- } & T;
147
+ } & C;
148
+ export {};
@@ -2,11 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Locales = Locales;
4
4
  exports.LocalesT = LocalesT;
5
+ exports.defineGroups = defineGroups;
5
6
  exports.GroupsT = GroupsT;
6
7
  exports.Groups = Groups;
7
8
  exports.Group = Group;
8
9
  exports.Options = Options;
9
10
  exports.AutoLoad = AutoLoad;
11
+ exports.middlewares = middlewares;
10
12
  exports.Middlewares = Middlewares;
11
13
  exports.Declare = Declare;
12
14
  const Permissions_1 = require("../structures/extra/Permissions");
@@ -22,6 +24,9 @@ function LocalesT(name, description) {
22
24
  __t = { name, description };
23
25
  };
24
26
  }
27
+ function defineGroups(groups) {
28
+ return groups;
29
+ }
25
30
  function GroupsT(groups) {
26
31
  return (target) => class extends target {
27
32
  __tGroups = groups;
@@ -50,9 +55,10 @@ function Groups(groups) {
50
55
  }
51
56
  };
52
57
  }
53
- function Group(groupName) {
58
+ function Group(groupsDefOrGroupName, groupName) {
59
+ const resolvedGroupName = typeof groupsDefOrGroupName === 'string' ? groupsDefOrGroupName : groupName;
54
60
  return (target) => class extends target {
55
- group = groupName;
61
+ group = resolvedGroupName;
56
62
  };
57
63
  }
58
64
  function Options(options) {
@@ -72,12 +78,16 @@ function AutoLoad() {
72
78
  __autoload = true;
73
79
  };
74
80
  }
81
+ function middlewares(...cbs) {
82
+ return cbs;
83
+ }
75
84
  function Middlewares(cbs) {
76
85
  return (target) => class extends target {
77
86
  middlewares = cbs;
78
87
  };
79
88
  }
80
- function Declare(declare) {
89
+ function Declare(input) {
90
+ const declare = input;
81
91
  return (target) => class extends target {
82
92
  name = declare.name;
83
93
  nsfw = declare.nsfw;
@@ -104,11 +114,11 @@ function Declare(declare) {
104
114
  if ('type' in declare)
105
115
  this.type = declare.type;
106
116
  if ('guildId' in declare)
107
- this.guildId = declare.guildId;
117
+ this.guildId = declare.guildId?.slice();
108
118
  if ('ignore' in declare)
109
119
  this.ignore = declare.ignore;
110
120
  if ('aliases' in declare)
111
- this.aliases = declare.aliases;
121
+ this.aliases = declare.aliases?.slice();
112
122
  if ('handler' in declare)
113
123
  this.handler = declare.handler;
114
124
  // check if all properties are valid
@@ -2,7 +2,7 @@ import { type MessageStructure, type OptionResolverStructure, Transformers } fro
2
2
  import type { MakeRequired } from '../common';
3
3
  import { type __InternalReplyFunction, AutocompleteInteraction, type ChatInputCommandInteraction, type ComponentInteraction, type EntryPointInteraction, type MessageCommandInteraction, type ModalSubmitInteraction, type UserCommandInteraction } from '../structures';
4
4
  import type { PermissionsBitField } from '../structures/extra/Permissions';
5
- import { type APIApplicationCommandInteraction, type APIApplicationCommandInteractionDataOption, type APIInteraction, ApplicationCommandOptionType, type GatewayMessageCreateDispatchData } from '../types';
5
+ import { type APIApplicationCommandInteraction, type APIApplicationCommandInteractionDataBasicOption, type APIInteraction, ApplicationCommandOptionType, type GatewayMessageCreateDispatchData } from '../types';
6
6
  import { Command, type CommandAutocompleteOption, CommandContext, type CommandOption, type ContextMenuCommand, type ContextOptionsResolved, type EntryPointCommand, EntryPointContext, MenuCommandContext, type MessageCommandOptionErrors, SubCommand, type UsingClient } from '.';
7
7
  export type CommandOptionWithType = CommandOption & {
8
8
  type: ApplicationCommandOptionType;
@@ -16,6 +16,7 @@ export declare class HandleCommand {
16
16
  client: UsingClient;
17
17
  constructor(client: UsingClient);
18
18
  autocomplete(interaction: AutocompleteInteraction, optionsResolver: OptionResolverStructure, command?: CommandAutocompleteOption): Promise<void>;
19
+ private runAutocomplete;
19
20
  contextMenu(command: ContextMenuCommand, interaction: MessageCommandInteraction | UserCommandInteraction, context: MenuCommandContext<MessageCommandInteraction | UserCommandInteraction>): Promise<any>;
20
21
  contextMenuMessage(command: ContextMenuCommand, interaction: MessageCommandInteraction, context: MenuCommandContext<MessageCommandInteraction>): Promise<any>;
21
22
  contextMenuUser(command: ContextMenuCommand, interaction: UserCommandInteraction, context: MenuCommandContext<UserCommandInteraction>): Promise<any>;
@@ -29,24 +30,34 @@ export declare class HandleCommand {
29
30
  resolveCommandFromContent(content: string, _prefix: string, _message: GatewayMessageCreateDispatchData): CommandFromContent & {
30
31
  argsContent?: string;
31
32
  };
32
- getCommandFromContent(commandRaw: string[]): CommandFromContent;
33
+ getCommandFromContent(commandRaw: string[], guildId?: string): CommandFromContent;
34
+ /**
35
+ * Resolves a message command by its full name.
36
+ *
37
+ * Guild-scoped commands require a matching `guildId`; without one, they intentionally resolve to `undefined`.
38
+ */
39
+ resolveByName(fullName: string, guildId?: string): CommandFromContent | undefined;
40
+ private resolveCommandFromNameParts;
33
41
  makeResolver(...args: Parameters<(typeof Transformers)['OptionResolver']>): OptionResolverStructure;
34
- getParentMessageCommand(rawParentName: string): Command | ContextMenuCommand | undefined;
42
+ getParentMessageCommand(rawParentName: string, guildId?: string): Command | ContextMenuCommand | undefined;
43
+ private commandCanRunInGuild;
35
44
  getCommand<T extends Command | ContextMenuCommand | EntryPointCommand>(data: {
36
45
  guild_id?: string;
37
46
  name: string;
38
47
  }): T | undefined;
39
48
  checkPermissions(app: PermissionsBitField, bot: bigint): ("CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTTSMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "ViewGuildInsights" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVAD" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageGuildExpressions" | "UseApplicationCommands" | "RequestToSpeak" | "ManageEvents" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "UseEmbeddedActivities" | "ModerateMembers" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SetVoiceChannelStatus" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[] | undefined;
40
- fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("../types").APIChannel> | null;
41
- fetchUser(_option: CommandOptionWithType, query: string): Promise<import("../types").APIUser> | null;
42
- fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("../types").APIGuildMember> | null;
43
- fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("../types").APIRole> | null;
49
+ fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("..").APIChannel> | null;
50
+ fetchUser(_option: CommandOptionWithType, query: string): Promise<import("..").APIUser> | null;
51
+ fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("..").APIGuildMember> | null;
52
+ fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("..").APIRole> | null;
44
53
  runGlobalMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
45
54
  error?: string;
55
+ metadata?: import("..").PluginMiddlewareDenialMetadata;
46
56
  pass?: boolean;
47
57
  }>;
48
58
  runMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
49
59
  error?: string;
60
+ metadata?: import("..").PluginMiddlewareDenialMetadata;
50
61
  pass?: boolean;
51
62
  }>;
52
63
  makeMenuCommand(body: APIApplicationCommandInteraction, shardId: number, __reply?: __InternalReplyFunction): void | {
@@ -61,6 +72,6 @@ export declare class HandleCommand {
61
72
  error: string;
62
73
  fullError: MessageCommandOptionErrors;
63
74
  }[];
64
- options: APIApplicationCommandInteractionDataOption[];
75
+ options: APIApplicationCommandInteractionDataBasicOption[];
65
76
  }>;
66
77
  }