RnDAO/tc-survey

Message scheduler

Opened this issue · 0 comments

Goal

  • As a user, I'd like to schedule announcements to go to a certain channel at a certain time.

How

  • First read the current code and understand the repo
  • Add a new command for scheduling messages which receives the date and the channel to send the scheduled message
  • Connect to MongoDB using the dbComm repo.
  • Create a new collection for each guild to store the scheduled message. You need to update dbComm repo to create an interface for your new collection.
  • Store the scheduled message
  • Create a cron tab to run every minute and check for sending scheduled messages
  • Send the scheduled message to the specified channel or thread
  • Create a command to show the scheduled messages
  • Create a command for removing a scheduled message

Suggestion

You can use this schema for the new collection, you might need to add new fields based on your need. this is only a jump start.

{ created_at: date, channelId: string, threadId: string, scheduled_for: date, message: string, userId: string, status: Enum(pending, done, failed) status_reason: string }