mirror of
https://github.com/sern-handler/handler
synced 2026-07-05 05:59:37 +00:00
add deps to plugin calls and execute
This commit is contained in:
@@ -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];
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user