diff --git a/src/handler/events/interactionCreate.ts b/src/handler/events/interactionCreate.ts index a7a5fad..56444d7 100644 --- a/src/handler/events/interactionCreate.ts +++ b/src/handler/events/interactionCreate.ts @@ -118,7 +118,7 @@ export function onInteractionCreate (wrapper: Wrapper) { }), ).subscribe({ next({m, res, execute}) { - console.log(res); + }, error(err) { console.log(err); diff --git a/src/handler/events/messageEvent.ts b/src/handler/events/messageEvent.ts index b094822..be4fe77 100644 --- a/src/handler/events/messageEvent.ts +++ b/src/handler/events/messageEvent.ts @@ -43,9 +43,6 @@ export const onMessageCreate = (wrapper: Wrapper) => { concatMap(({ ctx, args, mod }) => { const res = Promise.all( mod.onEvent?.map(ePlug => { - if ((ePlug.modType & mod.type) === 0) { - return Err.EMPTY; - } return ePlug.execute([ctx, args], controller); }) ?? [], ); diff --git a/src/handler/plugins/plugin.ts b/src/handler/plugins/plugin.ts index 0c8ec51..86b9eb4 100644 --- a/src/handler/plugins/plugin.ts +++ b/src/handler/plugins/plugin.ts @@ -17,6 +17,7 @@ import type { Module, Override } from '../..'; import type { BaseModule, ModuleDefs } from '../structures/module'; import type { PluginType } from '../structures/enums'; import type { ValueOf } from 'ts-pattern/dist/types/helpers'; +import type { CommandType } from '../..'; export interface Controller { @@ -40,7 +41,9 @@ export type EventPlugin = Override, controller: Controller) => Awaitable>; }>; -export function plugins(...plug: CommandPlugin[]) { +export function plugins(...plug: CommandPlugin[]) : CommandPlugin[]; +export function plugins(...plug: EventPlugin[]) : EventPlugin[]; +export function plugins(...plug: EventPlugin[] | CommandPlugin[]) { return plug; } diff --git a/src/handler/utilities/predicates.ts b/src/handler/utilities/predicates.ts index 359c361..704aa57 100644 --- a/src/handler/utilities/predicates.ts +++ b/src/handler/utilities/predicates.ts @@ -37,7 +37,7 @@ export function isUserContextMenuCmd(i : CommandInteraction) : i is UserContextM return i.isUserContextMenuCommand(); } -function isPromise(promiseLike : Awaitable) : promiseLike is Promise { +export function isPromise(promiseLike : Awaitable) : promiseLike is Promise { const keys = new Set(Object.keys(promiseLike)); return keys.has('then') && keys.has('catch'); } \ No newline at end of file