Scheduled Task payload types

Does this plugin support adding type for the payload? Tried to just add interface in d.ts as type for that key but that doesn't work. tried to search docs for that but I didn't find anything about that re-read docs and found that they actually mention ability to specify type for payload. but somehow that doesn't work for me. Tried passing just raw type, interface, actual type and still no success the way I declare task & it's payload:
declare module "@sapphire/plugin-scheduled-tasks" {
interface ScheduledTasks {
monthlyClansReset: unknown
removeInvite: RemoveInviteTaskPayload
}
}
declare module "@sapphire/plugin-scheduled-tasks" {
interface ScheduledTasks {
monthlyClansReset: unknown
removeInvite: RemoveInviteTaskPayload
}
}
11 Replies
secre
secreOP7mo ago
also small question. if task fails during it's execution does plugin automatically re-run it with some delay or we need to manually execute it after catching error with try catch {} for example :Hmm:
Favna
Favna7mo ago
that is all handled by the underlying library that we use bullmq. Not sure how they handle it.
secre
secreOP7mo ago
I see :okie:
čamdžić
čamdžić7mo ago
@secre hi since you didn't typed it yet you add augmentation to .d.ts file just like you did with type you want
Solution
čamdžić
čamdžić7mo ago
čamdžić
čamdžić7mo ago
that's how you do it
secre
secreOP7mo ago
oh, so you need to specify generic for that to work :WAHHHHHHHHHHHHH:
čamdžić
čamdžić7mo ago
yes it should be required that generic is optional idk why
secre
secreOP7mo ago
I think thats because you rarely have tasks that require payload
čamdžić
čamdžić7mo ago
yeah and default is never
secre
secreOP7mo ago
ye

Did you find this page helpful?