bakit 1.0.0-beta.2 → 1.0.0-beta.4

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.
@@ -33,13 +33,13 @@ type Context<Cached extends boolean = boolean, InGuild extends boolean = boolean
33
33
  type CommandConstructor = new (...args: unknown[]) => object;
34
34
  declare function use(command: RootCommandEntry): (target: CommandConstructor) => void;
35
35
  declare function getRoot(constructor: CommandConstructor): RootCommandEntry | undefined;
36
- declare function CommandFactory(options: CreateOptions<BaseCommandEntryOptions> | string): RootCommandEntry;
36
+ declare function CommandFactory(options: CreateCommandOptions<BaseCommandEntryOptions> | string): RootCommandEntry;
37
37
  declare const Command: typeof CommandFactory & {
38
38
  use: typeof use;
39
39
  getRoot: typeof getRoot;
40
40
  };
41
41
 
42
- declare enum HookExecutionState {
42
+ declare enum CommandHookExecutionState {
43
43
  Main = "main",
44
44
  Pre = "pre",
45
45
  Post = "post",
@@ -47,7 +47,7 @@ declare enum HookExecutionState {
47
47
  }
48
48
  type CommandHookMethod = (ctx: Context, ...args: any[]) => Awaitable<void>;
49
49
  interface CommandHook {
50
- state: HookExecutionState;
50
+ state: CommandHookExecutionState;
51
51
  method: CommandHookMethod;
52
52
  entry: CommandEntry;
53
53
  }
@@ -56,7 +56,7 @@ interface BaseCommandEntryOptions {
56
56
  description: string;
57
57
  nsfw?: boolean;
58
58
  }
59
- type CreateOptions<T extends BaseCommandEntryOptions> = SetOptional<T, "description"> | string;
59
+ type CreateCommandOptions<T extends BaseCommandEntryOptions> = SetOptional<T, "description"> | string;
60
60
  declare const HOOKS_KEY: unique symbol;
61
61
  declare abstract class BaseCommandEntry {
62
62
  options: BaseCommandEntryOptions;
@@ -74,7 +74,7 @@ declare abstract class BaseCommandEntry {
74
74
  }
75
75
  declare abstract class BaseCommandGroupEntry extends BaseCommandEntry {
76
76
  children: Collection<string, CommandGroupEntry | SubcommandEntry>;
77
- subcommand(options: CreateOptions<BaseCommandEntryOptions>): SubcommandEntry;
77
+ subcommand(options: CreateCommandOptions<BaseCommandEntryOptions>): SubcommandEntry;
78
78
  }
79
79
  declare class CommandGroupEntry extends BaseCommandGroupEntry {
80
80
  options: BaseCommandEntryOptions;
@@ -85,7 +85,7 @@ declare class CommandGroupEntry extends BaseCommandGroupEntry {
85
85
  declare class RootCommandEntry extends BaseCommandGroupEntry {
86
86
  options: BaseCommandEntryOptions;
87
87
  constructor(options: BaseCommandEntryOptions);
88
- group(options: CreateOptions<BaseCommandEntryOptions>): CommandGroupEntry;
88
+ group(options: CreateCommandOptions<BaseCommandEntryOptions>): CommandGroupEntry;
89
89
  }
90
90
  declare class SubcommandEntry extends BaseCommandEntry {
91
91
  options: BaseCommandEntryOptions;
@@ -201,4 +201,4 @@ declare class BakitClient<Ready extends boolean = boolean> extends Client<Ready>
201
201
  private createHookRecord;
202
202
  }
203
203
 
204
- export { Arg as A, type BakitClientOptions as B, type CommandHookMethod as C, CommandSyntaxErrorType as D, type CommandSyntaxErrorOptions as E, CommandSyntaxError as F, type GetSyntaxErrorMessageFunction as G, HookExecutionState as H, type IntegerArgumentOptions as I, type MemberArgumentOptions as M, type NumberArgumentOptions as N, RootCommandEntry as R, type StringArgumentOptions as S, type UserArgumentOptions as U, BakitClient as a, ArgumentType as b, type BaseArgumentOptions as c, type ArgumentOptions as d, type CommandHook as e, type BaseCommandEntryOptions as f, type CreateOptions as g, HOOKS_KEY as h, BaseCommandEntry as i, BaseCommandGroupEntry as j, CommandGroupEntry as k, SubcommandEntry as l, type CommandEntry as m, type CommandConstructor as n, getRoot as o, CommandFactory as p, Command as q, CommandRegistry as r, type ChatInputContextSendOptions as s, type MessageContextSendOptions as t, use as u, type ContextSendOptions as v, BaseContext as w, ChatInputContext as x, MessageContext as y, type Context as z };
204
+ export { Arg as A, BakitClient as B, CommandHookExecutionState as C, CommandSyntaxError as D, type GetSyntaxErrorMessageFunction as G, HOOKS_KEY as H, type IntegerArgumentOptions as I, type MemberArgumentOptions as M, type NumberArgumentOptions as N, RootCommandEntry as R, type StringArgumentOptions as S, type UserArgumentOptions as U, type BakitClientOptions as a, ArgumentType as b, type BaseArgumentOptions as c, type ArgumentOptions as d, type CommandHookMethod as e, type CommandHook as f, type BaseCommandEntryOptions as g, type CreateCommandOptions as h, BaseCommandEntry as i, BaseCommandGroupEntry as j, CommandGroupEntry as k, SubcommandEntry as l, type CommandEntry as m, type CommandConstructor as n, CommandFactory as o, Command as p, CommandRegistry as q, type ChatInputContextSendOptions as r, type MessageContextSendOptions as s, type ContextSendOptions as t, BaseContext as u, ChatInputContext as v, MessageContext as w, type Context as x, CommandSyntaxErrorType as y, type CommandSyntaxErrorOptions as z };
@@ -1,3 +1,3 @@
1
- export { A as Arg, d as ArgumentOptions, b as ArgumentType, c as BaseArgumentOptions, i as BaseCommandEntry, f as BaseCommandEntryOptions, j as BaseCommandGroupEntry, w as BaseContext, x as ChatInputContext, s as ChatInputContextSendOptions, q as Command, n as CommandConstructor, m as CommandEntry, p as CommandFactory, k as CommandGroupEntry, e as CommandHook, C as CommandHookMethod, r as CommandRegistry, z as Context, v as ContextSendOptions, g as CreateOptions, h as HOOKS_KEY, H as HookExecutionState, I as IntegerArgumentOptions, M as MemberArgumentOptions, y as MessageContext, t as MessageContextSendOptions, N as NumberArgumentOptions, R as RootCommandEntry, S as StringArgumentOptions, l as SubcommandEntry, U as UserArgumentOptions, o as getRoot, u as use } from '../BakitClient-Cvt3Nhoi.js';
1
+ export { A as Arg, d as ArgumentOptions, b as ArgumentType, c as BaseArgumentOptions, i as BaseCommandEntry, g as BaseCommandEntryOptions, j as BaseCommandGroupEntry, u as BaseContext, v as ChatInputContext, r as ChatInputContextSendOptions, p as Command, n as CommandConstructor, m as CommandEntry, o as CommandFactory, k as CommandGroupEntry, f as CommandHook, C as CommandHookExecutionState, e as CommandHookMethod, q as CommandRegistry, x as Context, t as ContextSendOptions, h as CreateCommandOptions, H as HOOKS_KEY, I as IntegerArgumentOptions, M as MemberArgumentOptions, w as MessageContext, s as MessageContextSendOptions, N as NumberArgumentOptions, R as RootCommandEntry, S as StringArgumentOptions, l as SubcommandEntry, U as UserArgumentOptions } from '../BakitClient-CgtDS6Hr.js';
2
2
  import 'discord.js';
3
3
  import 'type-fest';
@@ -106,13 +106,13 @@ var Arg = {
106
106
 
107
107
  // src/command/CommandEntry.ts
108
108
  import { Collection } from "discord.js";
109
- var HookExecutionState = /* @__PURE__ */ ((HookExecutionState2) => {
110
- HookExecutionState2["Main"] = "main";
111
- HookExecutionState2["Pre"] = "pre";
112
- HookExecutionState2["Post"] = "post";
113
- HookExecutionState2["Error"] = "error";
114
- return HookExecutionState2;
115
- })(HookExecutionState || {});
109
+ var CommandHookExecutionState = /* @__PURE__ */ ((CommandHookExecutionState2) => {
110
+ CommandHookExecutionState2["Main"] = "main";
111
+ CommandHookExecutionState2["Pre"] = "pre";
112
+ CommandHookExecutionState2["Post"] = "post";
113
+ CommandHookExecutionState2["Error"] = "error";
114
+ return CommandHookExecutionState2;
115
+ })(CommandHookExecutionState || {});
116
116
  var HOOKS_KEY = Symbol("hooks");
117
117
  var BaseCommandEntry = class _BaseCommandEntry {
118
118
  constructor(options) {
@@ -467,12 +467,10 @@ export {
467
467
  Command,
468
468
  CommandFactory,
469
469
  CommandGroupEntry,
470
+ CommandHookExecutionState,
470
471
  CommandRegistry,
471
472
  HOOKS_KEY,
472
- HookExecutionState,
473
473
  MessageContext,
474
474
  RootCommandEntry,
475
- SubcommandEntry,
476
- getRoot,
477
- use
475
+ SubcommandEntry
478
476
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- export { A as Arg, d as ArgumentOptions, b as ArgumentType, a as BakitClient, B as BakitClientOptions, c as BaseArgumentOptions, i as BaseCommandEntry, f as BaseCommandEntryOptions, j as BaseCommandGroupEntry, w as BaseContext, x as ChatInputContext, s as ChatInputContextSendOptions, q as Command, n as CommandConstructor, m as CommandEntry, p as CommandFactory, k as CommandGroupEntry, e as CommandHook, C as CommandHookMethod, r as CommandRegistry, F as CommandSyntaxError, E as CommandSyntaxErrorOptions, D as CommandSyntaxErrorType, z as Context, v as ContextSendOptions, g as CreateOptions, G as GetSyntaxErrorMessageFunction, h as HOOKS_KEY, H as HookExecutionState, I as IntegerArgumentOptions, M as MemberArgumentOptions, y as MessageContext, t as MessageContextSendOptions, N as NumberArgumentOptions, R as RootCommandEntry, S as StringArgumentOptions, l as SubcommandEntry, U as UserArgumentOptions, o as getRoot, u as use } from './BakitClient-Cvt3Nhoi.js';
1
+ import { B as BakitClient } from './BakitClient-CgtDS6Hr.js';
2
+ export { A as Arg, d as ArgumentOptions, b as ArgumentType, a as BakitClientOptions, c as BaseArgumentOptions, i as BaseCommandEntry, g as BaseCommandEntryOptions, j as BaseCommandGroupEntry, u as BaseContext, v as ChatInputContext, r as ChatInputContextSendOptions, p as Command, n as CommandConstructor, m as CommandEntry, o as CommandFactory, k as CommandGroupEntry, f as CommandHook, C as CommandHookExecutionState, e as CommandHookMethod, q as CommandRegistry, D as CommandSyntaxError, z as CommandSyntaxErrorOptions, y as CommandSyntaxErrorType, x as Context, t as ContextSendOptions, h as CreateCommandOptions, G as GetSyntaxErrorMessageFunction, H as HOOKS_KEY, I as IntegerArgumentOptions, M as MemberArgumentOptions, w as MessageContext, s as MessageContextSendOptions, N as NumberArgumentOptions, R as RootCommandEntry, S as StringArgumentOptions, l as SubcommandEntry, U as UserArgumentOptions } from './BakitClient-CgtDS6Hr.js';
2
3
  import { AsyncLocalStorage } from 'node:async_hooks';
3
- import 'discord.js';
4
- import 'type-fest';
4
+ import { SetOptional } from 'type-fest';
5
+ import { Awaitable, ClientEvents } from 'discord.js';
6
+ import EventEmitter from 'node:events';
5
7
 
6
8
  declare function extractId(value: string): string | null;
7
9
 
@@ -15,4 +17,69 @@ declare class StateBox {
15
17
  static use<T extends object>(defaultValue?: unknown): (target: T, key: keyof T) => void;
16
18
  }
17
19
 
18
- export { StateBox, type States, extractId };
20
+ type EventsLike = Record<keyof unknown, unknown[]>;
21
+ type EventKey<E extends EventsLike> = keyof E;
22
+ declare enum ListenerHookExecutionState {
23
+ Main = "main",
24
+ Pre = "pre",
25
+ Post = "post",
26
+ Error = "error"
27
+ }
28
+ type MainListenerHookMethod<E extends EventsLike, K extends EventKey<E>> = (...args: E[K] & unknown[]) => Awaitable<void>;
29
+ type ErrorListenerHookMethod<E extends EventsLike, K extends EventKey<E>> = (error: unknown, ...args: E[K] & unknown[]) => Awaitable<void>;
30
+ interface MainListenerHook<E extends EventsLike, K extends EventKey<E>> {
31
+ state: ListenerHookExecutionState.Main | ListenerHookExecutionState.Post | ListenerHookExecutionState.Pre;
32
+ method: MainListenerHookMethod<E, K>;
33
+ entry: ListenerEntry<E, K>;
34
+ }
35
+ interface ErrorListenerHook<E extends EventsLike, K extends EventKey<E>> {
36
+ state: ListenerHookExecutionState.Error;
37
+ method: ErrorListenerHookMethod<E, K>;
38
+ entry: ListenerEntry<E, K>;
39
+ }
40
+ type ListenerHook<E extends EventsLike, K extends EventKey<E>> = MainListenerHook<E, K> | ErrorListenerHook<E, K>;
41
+ interface ListenerEntryOptions<E extends EventsLike, K extends EventKey<E>> {
42
+ name: K;
43
+ once: boolean;
44
+ emitter?: EventEmitter;
45
+ }
46
+ declare class ListenerEntry<E extends EventsLike, K extends EventKey<E>> {
47
+ options: ListenerEntryOptions<E, K>;
48
+ static hooksKey: symbol;
49
+ private static cache;
50
+ main: <T extends MainListenerHookMethod<E, K>>(target: object, _key: string, descriptor: TypedPropertyDescriptor<T>) => void;
51
+ pre: <T extends MainListenerHookMethod<E, K>>(target: object, _key: string, descriptor: TypedPropertyDescriptor<T>) => void;
52
+ post: <T extends MainListenerHookMethod<E, K>>(target: object, _key: string, descriptor: TypedPropertyDescriptor<T>) => void;
53
+ error: <T extends ErrorListenerHookMethod<E, K>>(target: object, _key: string, descriptor: TypedPropertyDescriptor<T>) => void;
54
+ constructor(options: ListenerEntryOptions<E, K>);
55
+ static getHooks<E extends EventsLike, K extends EventKey<E>>(constructor: ListenerConstructor): readonly ListenerHook<E, K>[];
56
+ static getHooks<E extends EventsLike, K extends EventKey<E>>(constructor: ListenerConstructor, init: true): ListenerHook<E, K>[];
57
+ private static createMainHookDecorator;
58
+ private static createErrorHookDecorator;
59
+ private static addHook;
60
+ }
61
+
62
+ type ListenerConstructor = new (...args: unknown[]) => object;
63
+ type CreateListenerOptions<E extends EventsLike, K extends EventKey<E>> = SetOptional<ListenerEntryOptions<E, K>, "once"> | K;
64
+ declare function ListenerFactory<E extends EventsLike = ClientEvents, K extends EventKey<E> = EventKey<E>>(options: CreateListenerOptions<E, K>): ListenerEntry<E, K>;
65
+ declare function use(listener: ListenerEntry<never, never>): (target: ListenerConstructor) => void;
66
+ declare function getEntry(constructor: ListenerConstructor): ListenerEntry<never, never> | undefined;
67
+ declare const Listener: typeof ListenerFactory & {
68
+ use: typeof use;
69
+ getEntry: typeof getEntry;
70
+ };
71
+
72
+ declare function add(constructor: ListenerConstructor): void;
73
+ declare function remove(constructor: ListenerConstructor): void;
74
+ declare function removeAll(): void;
75
+ declare function setClient(newClient: BakitClient): void;
76
+ declare const ListenerRegistry: {
77
+ constructors: Set<ListenerConstructor>;
78
+ instances: WeakMap<ListenerConstructor, object>;
79
+ add: typeof add;
80
+ setClient: typeof setClient;
81
+ remove: typeof remove;
82
+ removeAll: typeof removeAll;
83
+ };
84
+
85
+ export { BakitClient, type CreateListenerOptions, type ErrorListenerHook, type ErrorListenerHookMethod, type EventKey, type EventsLike, Listener, type ListenerConstructor, ListenerEntry, type ListenerEntryOptions, ListenerFactory, type ListenerHook, ListenerHookExecutionState, ListenerRegistry, type MainListenerHook, type MainListenerHookMethod, StateBox, type States, extractId };
package/dist/index.js CHANGED
@@ -122,13 +122,13 @@ var Arg = {
122
122
  };
123
123
 
124
124
  // src/command/CommandEntry.ts
125
- var HookExecutionState = /* @__PURE__ */ ((HookExecutionState2) => {
126
- HookExecutionState2["Main"] = "main";
127
- HookExecutionState2["Pre"] = "pre";
128
- HookExecutionState2["Post"] = "post";
129
- HookExecutionState2["Error"] = "error";
130
- return HookExecutionState2;
131
- })(HookExecutionState || {});
125
+ var CommandHookExecutionState = /* @__PURE__ */ ((CommandHookExecutionState2) => {
126
+ CommandHookExecutionState2["Main"] = "main";
127
+ CommandHookExecutionState2["Pre"] = "pre";
128
+ CommandHookExecutionState2["Post"] = "post";
129
+ CommandHookExecutionState2["Error"] = "error";
130
+ return CommandHookExecutionState2;
131
+ })(CommandHookExecutionState || {});
132
132
  var HOOKS_KEY = Symbol("hooks");
133
133
  var BaseCommandEntry = class _BaseCommandEntry {
134
134
  constructor(options) {
@@ -564,13 +564,13 @@ var ArgumentResolver = class _ArgumentResolver {
564
564
  return this.options.message.client;
565
565
  }
566
566
  static create(message) {
567
- const client = message.client;
568
- const { enableMentionPrefix } = client.options;
567
+ const client2 = message.client;
568
+ const { enableMentionPrefix } = client2.options;
569
569
  const prefixes = [
570
570
  // Custom prefixes specified in options
571
- ...client.options.prefixes ?? [],
571
+ ...client2.options.prefixes ?? [],
572
572
  // Use bot mention as prefix if enabled
573
- ...enableMentionPrefix ? [client.user.toString()] : []
573
+ ...enableMentionPrefix ? [client2.user.toString()] : []
574
574
  ];
575
575
  const prefix = prefixes.find((p) => message.content.startsWith(p)) ?? null;
576
576
  if (!prefix) {
@@ -812,6 +812,140 @@ var StateBox = class _StateBox {
812
812
  }
813
813
  };
814
814
 
815
+ // src/listener/ListenerEntry.ts
816
+ var ListenerHookExecutionState = /* @__PURE__ */ ((ListenerHookExecutionState2) => {
817
+ ListenerHookExecutionState2["Main"] = "main";
818
+ ListenerHookExecutionState2["Pre"] = "pre";
819
+ ListenerHookExecutionState2["Post"] = "post";
820
+ ListenerHookExecutionState2["Error"] = "error";
821
+ return ListenerHookExecutionState2;
822
+ })(ListenerHookExecutionState || {});
823
+ var ListenerEntry = class _ListenerEntry {
824
+ constructor(options) {
825
+ this.options = options;
826
+ }
827
+ static hooksKey = Symbol("hooks");
828
+ static cache = /* @__PURE__ */ new WeakMap();
829
+ main = _ListenerEntry.createMainHookDecorator("main" /* Main */, this);
830
+ pre = _ListenerEntry.createMainHookDecorator("pre" /* Pre */, this);
831
+ post = _ListenerEntry.createMainHookDecorator("post" /* Post */, this);
832
+ error = _ListenerEntry.createErrorHookDecorator("error" /* Error */, this);
833
+ static getHooks(constructor, init = false) {
834
+ let hooks = this.cache.get(constructor) ?? Reflect.getMetadata(this.hooksKey, constructor);
835
+ if (!hooks) {
836
+ hooks = [];
837
+ if (init) {
838
+ Reflect.defineMetadata(this.hooksKey, hooks, constructor);
839
+ this.cache.set(constructor, hooks);
840
+ }
841
+ }
842
+ return init ? hooks : Object.freeze([...hooks]);
843
+ }
844
+ static createMainHookDecorator(state, entry) {
845
+ return (target, _key, descriptor) => {
846
+ this.addHook(target, state, descriptor.value, entry);
847
+ };
848
+ }
849
+ static createErrorHookDecorator(state, entry) {
850
+ return (target, _key, descriptor) => {
851
+ this.addHook(target, state, descriptor.value, entry);
852
+ };
853
+ }
854
+ static addHook(target, state, method, entry) {
855
+ const { constructor } = target;
856
+ const hooks = this.getHooks(constructor, true);
857
+ if (typeof method !== "function") {
858
+ throw new Error("CommandEntry decorator must be used with a class method.");
859
+ }
860
+ if (hooks.some((hook2) => hook2.state === state && hook2.entry === entry)) {
861
+ throw new Error(
862
+ `Hook "${state}" is already defined for entry "${String(entry.options.name)}".`
863
+ );
864
+ }
865
+ const hook = {
866
+ state,
867
+ entry,
868
+ method
869
+ };
870
+ hooks.push(hook);
871
+ }
872
+ };
873
+
874
+ // src/listener/Listener.ts
875
+ function ListenerFactory(options) {
876
+ if (typeof options !== "object") {
877
+ options = {
878
+ name: options,
879
+ once: false
880
+ };
881
+ }
882
+ options.once = Boolean(options.once);
883
+ return new ListenerEntry(options);
884
+ }
885
+ var ENTRY_KEY = Symbol("entry");
886
+ function use2(listener) {
887
+ return (target) => {
888
+ Reflect.defineMetadata(ENTRY_KEY, listener, target);
889
+ };
890
+ }
891
+ function getEntry(constructor) {
892
+ return Reflect.getMetadata(ENTRY_KEY, constructor);
893
+ }
894
+ var Listener = Object.assign(ListenerFactory, {
895
+ use: use2,
896
+ getEntry
897
+ });
898
+
899
+ // src/listener/ListenerRegistry.ts
900
+ var client;
901
+ var constructors = /* @__PURE__ */ new Set();
902
+ var instances = /* @__PURE__ */ new WeakMap();
903
+ function add(constructor) {
904
+ const entry = Listener.getEntry(constructor);
905
+ if (!entry) {
906
+ throw new Error(`No entry found for "${constructor.name}"`);
907
+ }
908
+ const { options } = entry;
909
+ if (!options.emitter) {
910
+ if (!client) {
911
+ throw new Error("Client is not ready.");
912
+ }
913
+ options.emitter = client;
914
+ }
915
+ constructors.add(constructor);
916
+ instances.set(constructor, new constructor());
917
+ }
918
+ function remove(constructor) {
919
+ const entry = Listener.getEntry(constructor);
920
+ if (!entry) {
921
+ return;
922
+ }
923
+ constructors.delete(constructor);
924
+ instances.delete(constructor);
925
+ const hook = ListenerEntry.getHooks(constructor).find((hook2) => hook2.entry === entry);
926
+ if (!hook) {
927
+ return;
928
+ }
929
+ const { name, emitter } = entry.options;
930
+ emitter?.removeListener(name, hook.method);
931
+ }
932
+ function removeAll() {
933
+ for (const constructor of constructors) {
934
+ remove(constructor);
935
+ }
936
+ }
937
+ function setClient(newClient) {
938
+ client = newClient;
939
+ }
940
+ var ListenerRegistry = {
941
+ constructors,
942
+ instances,
943
+ add,
944
+ setClient,
945
+ remove,
946
+ removeAll
947
+ };
948
+
815
949
  // src/BakitClient.ts
816
950
  var BakitClient = class _BakitClient extends Client {
817
951
  constructor(options) {
@@ -819,9 +953,10 @@ var BakitClient = class _BakitClient extends Client {
819
953
  options.getSyntaxErrorMessage = _BakitClient.getSyntaxErrorMessage;
820
954
  }
821
955
  super(options);
956
+ ListenerRegistry.setClient(this);
822
957
  this.once(
823
958
  Events.ClientReady,
824
- (client) => void this.registerApplicationCommands(client)
959
+ (client2) => void this.registerApplicationCommands(client2)
825
960
  );
826
961
  this.on(Events.InteractionCreate, (interaction) => void this.handleInteraction(interaction));
827
962
  this.on(Events.MessageCreate, (message) => void this.handleMessage(message));
@@ -841,9 +976,9 @@ var BakitClient = class _BakitClient extends Client {
841
976
  content
842
977
  };
843
978
  };
844
- async registerApplicationCommands(client) {
979
+ async registerApplicationCommands(client2) {
845
980
  const commands = CommandRegistry.constructors.map((c) => CommandRegistry.buildSlashCommand(c));
846
- await client.application.commands.set(commands);
981
+ await client2.application.commands.set(commands);
847
982
  }
848
983
  async handleMessage(message) {
849
984
  if (message.author.bot) {
@@ -999,7 +1134,7 @@ var BakitClient = class _BakitClient extends Client {
999
1134
  return { root, group, subcommand: sub };
1000
1135
  }
1001
1136
  createHookRecord(hooks) {
1002
- return Object.values(HookExecutionState).reduce(
1137
+ return Object.values(CommandHookExecutionState).reduce(
1003
1138
  (acc, state) => {
1004
1139
  acc[state] = hooks.find((h) => h.state === state);
1005
1140
  return acc;
@@ -1019,16 +1154,19 @@ export {
1019
1154
  Command,
1020
1155
  CommandFactory,
1021
1156
  CommandGroupEntry,
1157
+ CommandHookExecutionState,
1022
1158
  CommandRegistry,
1023
1159
  CommandSyntaxError,
1024
1160
  CommandSyntaxErrorType,
1025
1161
  HOOKS_KEY,
1026
- HookExecutionState,
1162
+ Listener,
1163
+ ListenerEntry,
1164
+ ListenerFactory,
1165
+ ListenerHookExecutionState,
1166
+ ListenerRegistry,
1027
1167
  MessageContext,
1028
1168
  RootCommandEntry,
1029
1169
  StateBox,
1030
1170
  SubcommandEntry,
1031
- extractId,
1032
- getRoot,
1033
- use
1171
+ extractId
1034
1172
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bakit",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "A framework for discord.js",
5
5
  "type": "module",
6
6
  "exports": {