From 4794c2655df9389c2e13be1ff4b77e4d27d87e57 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Sat, 6 May 2023 03:13:02 -0500 Subject: [PATCH] revert: remove AnyDependencies type --- src/handler/events/generic.ts | 2 +- src/handler/events/interactions.ts | 4 ++-- src/handler/events/messages.ts | 12 +++--------- src/handler/events/ready.ts | 10 ++++++---- src/handler/events/userDefined.ts | 4 ++-- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/handler/events/generic.ts b/src/handler/events/generic.ts index 56459e5..4735f88 100644 --- a/src/handler/events/generic.ts +++ b/src/handler/events/generic.ts @@ -11,7 +11,7 @@ import { SernError } from '../../core/structures/errors'; import { filterMap } from '../../core/operators'; import { defaultModuleLoader } from '../../core/module-loading'; import { Processed } from '../../types/core'; -import { BothCommand, CommandModule, Module } from '../../types/module'; +import { BothCommand, CommandModule } from '../../types/module'; import { contextArgs, dispatchAutocomplete, dispatchCommand, interactionArg } from './dispatchers'; import { isAutocomplete } from '../../core/predicates'; import { ObservableInput, pipe, switchMap } from 'rxjs'; diff --git a/src/handler/events/interactions.ts b/src/handler/events/interactions.ts index e75c1fc..fb04d7a 100644 --- a/src/handler/events/interactions.ts +++ b/src/handler/events/interactions.ts @@ -1,9 +1,9 @@ -import { BaseInteraction, Interaction } from 'discord.js'; +import { Interaction } from 'discord.js'; import { catchError, concatMap, finalize, merge } from 'rxjs'; import { SernError } from '../../core/structures/errors'; import { executeModule, makeModuleExecutor } from './observableHandling'; import { ErrorHandling, handleError } from '../../core/contracts/errorHandling'; -import { SernEmitter, WebsocketStrategy } from '../../core'; +import { SernEmitter } from '../../core'; import { sharedObservable } from '../../core/operators'; import { useContainerRaw } from '../../core/dependencies'; import type { Logging, ModuleManager } from '../../core/contracts'; diff --git a/src/handler/events/messages.ts b/src/handler/events/messages.ts index 4fa8f6c..ebd43d7 100644 --- a/src/handler/events/messages.ts +++ b/src/handler/events/messages.ts @@ -1,18 +1,12 @@ -import { catchError, concatMap, EMPTY, finalize, map, pipe } from 'rxjs'; +import { catchError, concatMap, EMPTY, finalize } from 'rxjs'; import { SernError } from '../../core/structures/errors'; import type { Message } from 'discord.js'; import { executeModule, ignoreNonBot, makeModuleExecutor } from './observableHandling'; -import type { CommandModule } from '../../types/module'; import { ErrorHandling, handleError } from '../../core/contracts/errorHandling'; -import { contextArgs, dispatchCommand } from './dispatchers'; -import type { Processed } from '../../types/core'; -import { useContainerRaw } from '../../core/dependencies'; import type { Logging, ModuleManager } from '../../core/contracts'; import type { EventEmitter } from 'node:events'; -import { WebsocketStrategy, SernEmitter } from '../../core'; -import { err } from '../../core/functions'; -import { defaultModuleLoader } from '../../core/module-loading'; -import { sharedObservable, filterMap } from '../../core/operators'; +import { SernEmitter, useContainerRaw } from '../../core'; +import { sharedObservable } from '../../core/operators'; import { createMessageHandler } from './generic'; /** diff --git a/src/handler/events/ready.ts b/src/handler/events/ready.ts index 77df574..b7c98a8 100644 --- a/src/handler/events/ready.ts +++ b/src/handler/events/ready.ts @@ -1,10 +1,10 @@ -import { ObservableInput, fromEvent, of, take } from 'rxjs'; +import { ObservableInput, fromEvent, take } from 'rxjs'; import { callInitPlugins } from './observableHandling'; import { CommandType } from '../../core/structures'; import { SernError } from '../../core/structures/errors'; import { Result } from 'ts-results-es'; -import type { ModuleManager } from '../../core/contracts'; -import { SernEmitter, PlatformStrategy, DispatchType } from '../../core'; +import { ModuleManager } from '../../core/contracts'; +import { SernEmitter, } from '../../core'; import { sernMeta } from '../../commands'; import { Processed, ServerlessDependencyList, WebsocketDependencyList } from '../../types/core'; import { Module } from '../../types/module'; @@ -17,7 +17,7 @@ export function startReadyEvent( | WebsocketDependencyList, input: ObservableInput, ) { - const ready$ = fromEvent(client!, 'interactionCreate').pipe(take(1)); + const ready$ = fromEvent(client!, 'ready').pipe(take(1)); return ready$ .pipe( buildModules(input, sEmitter), @@ -54,3 +54,5 @@ function registerModule>( } return Result.wrap(() => manager.set(id, fullPath)); } + + diff --git a/src/handler/events/userDefined.ts b/src/handler/events/userDefined.ts index 9b4439f..a4c4869 100644 --- a/src/handler/events/userDefined.ts +++ b/src/handler/events/userDefined.ts @@ -1,5 +1,5 @@ import { catchError, finalize, map, mergeAll, of } from 'rxjs'; -import type { Processed, WebsocketDependencies, Wrapper } from '../../types/core'; +import type { Dependencies, Processed, Wrapper } from '../../types/core'; import { callInitPlugins } from './observableHandling'; import type { CommandModule, EventModule } from '../../types/module'; import type { EventEmitter } from 'node:events'; @@ -17,7 +17,7 @@ export function makeEventsHandler( eventsPath: string, containerGetter: Wrapper['containerConfig'], ) { - const lazy = (k: string) => containerGetter.get(k as keyof WebsocketDependencies)[0]; + const lazy = (k: string) => containerGetter.get(k as keyof Dependencies)[0]; const intoDispatcher = (e: Processed) => { switch (e.type) { case EventType.Sern: