add deps to plugin calls and execute

This commit is contained in:
Jacob Nguyen
2024-05-19 22:33:57 -05:00
parent 699adf276c
commit 0beeb4c064
9 changed files with 100 additions and 103 deletions

View File

@@ -24,7 +24,6 @@ export function filterMapTo<V>(item: () => V): OperatorFunction<boolean, V> {
return concatMap(keep => keep ? of(item()) : EMPTY);
}
export const arrayifySource = <T>(src: T) =>
Array.isArray(src) ? src : [src];

View File

@@ -124,7 +124,7 @@ export class Context extends CoreContext<Message, ChatInputCommandInteraction> {
);
}
static override wrap(wrappable: BaseInteraction | Message, prefix?: string): Context {
static wrap(wrappable: BaseInteraction | Message, prefix?: string): Context {
if ('interaction' in wrappable) {
return new Context(Ok(wrappable), prefix);
}

View File

@@ -23,10 +23,4 @@ export abstract class CoreContext<M, I> {
public isSlash(): this is CoreContext<never, I> {
return !this.isMessage();
}
//todo: add agnostic options resolver for Context
abstract get options(): unknown;
static wrap(_: unknown): unknown {
throw Error('You need to override this method; cannot wrap an abstract class');
}
}

View File

@@ -65,10 +65,9 @@ export class Cron implements Emitter {
const retrievedModule = this.modules.get(eventName);
if(!retrievedModule) throw Error("Adding task: module " +eventName +"was not found");
const { pattern, name, runOnInit, timezone } = retrievedModule;
const task = cron.schedule(pattern,
(date) => listener({ date, deps: this.deps }),
{ name, runOnInit, timezone, scheduled: true });
task.on('task-failed', console.error)
cron.schedule(pattern,
(date) => listener({ date, deps: this.deps }),
{ name, runOnInit, timezone, scheduled: true });
return this;
}
removeListener(eventName: string | symbol, listener: AnyFunction) {