diff --git a/src/core/ioc.ts b/src/core/ioc.ts index a605a88e..ebd4deaa 100644 --- a/src/core/ioc.ts +++ b/src/core/ioc.ts @@ -38,7 +38,11 @@ const dependencyBuilder = (container: Container) => { * Swap out a preexisting dependency. */ swap(key: keyof Dependencies, v: Insertable) { - container.swap(key, v); + if(typeof v !== 'function') { + container.swap(key, v); + } else { + container.swap(key, v(container.deps())); + } }, }; }; diff --git a/src/sern.ts b/src/sern.ts index 72ea4b3d..4f8faf44 100644 --- a/src/sern.ts +++ b/src/sern.ts @@ -9,7 +9,6 @@ import ready from './handlers/ready'; import messageHandler from './handlers/message'; import interactionHandler from './handlers/interaction'; import { presenceHandler } from './handlers/presence'; -import { handleCrash } from './handlers/event-utils'; import { UnpackedDependencies } from './types/utility'; import type { Presence} from './core/presences'; import { registerTasks } from './handlers/tasks';