Open snopoke opened 3 weeks ago
Context: the mentioned tools create the equivalent of a "scheduled message" using the PeriodicTask
object (see here). Once created, celery will pick it up when the configured time comes and fire whatever method we specified in its "task" attribute. The kwargs of the PeriodicTask
contains details about the scheduled message i.e. which chats should be pinged, what message to use etc.
The new ScheduledMessage model should be used instead to create these messages. Scheduled Messages are currently created through events where the event.params attribute houses the details of the message. You can see what details will be stored there by looking at the scheduled message config form.
We need to basically do the following:
PeriodicTask
instances that are used for scheduled messages and create ScheduledMessage
records for each of these. We'll have to create event records to link to the ScheduledMessage
. The event's params can be populated using the periodic task's kwargs
and interval
/ clocked
attributes.ScheduledMessage
+ event records instead of PeriodicTask
records.