Closed Colton1070 closed 3 years ago
When you add a dynamic job you can send in an object for job configuration that would include a name events1,events2,events2,...
with the same path. This would create separate jobs but use the same file.
If you also use the worker
option you can pass an object to the job. Take a look at these docs and the node docs linked in that section.
Let's say that in my jobs folder I have a job - events.js
I want to use bree to allow members of a discord to schedule a message to be sent in a specific channel at a specific interval - that I know bree can accomplish. However, I am having a hard time grasping whether it is possible to use a universal job that has the ability to accept objects from the job that is being triggered - that way I can use the job as the "messenger" of what it needs to do and I do not have to worry about creating events1.js events2.js etc etc, just use events.js as a manager for all events type jobs.
Ideally I would be able to embed my own object when creating the job via bree.add(jobObject, myObject);
Maybe I am missing something but I want to go this direction because I'm already so close with the ability to add jobs at runtime, I do not want to be forced to generate unique job files as well if it's possible. Do I need to approach this by having the events.js job go any try to "look" for the metadata I want to use for that job? I feel like that can get complicated.