Skip to main content

📔 Schedule Repository

The ScheduleRepository is the object responsible for storing schedules. It's stored by a ScheduleManager, and you can get it via ScheduleManager#getRepository().

It only consists of a Collection to store schedules, and methods to interact with it.

You can't modify the repository directly since the ScheduleManager returns a ReadonlyScheduleRepository type, but the hidden methods are available at the ScheduleManager. This is because adding and removing a schedule needs more logic than just modifying the repository, and the manager is responsible for coordinating this.

👷 Creation

You can create a schedule repository by either:

  • Extending DefaultScheduleRepository from @framework (recommended).
  • Implementing the ScheduleRepository interface from @core.
import { DefaultScheduleRepository } from '@nyx-discord/framework';

class MyScheduleRepository extends DefaultScheduleRepository {
// ...
}

const myRepository = MyScheduleRepository.create();

const myBot = Bot.create((bot) => ({
schedules: DefaultScheduleManager.create(bot, { repository: myRepository }),
}));