Introduction to services


In an advanced bot, you might want to store some state, run a task on an interval, or just listen to events. This is where services come in, they allow you to define stateful logic within your bot, which can be accessed from commands.

When to use a service

It may be a little confusing to know when to use a service, so here's a list of reasons to help you out. You should use a service when you want to...

  • Persist data between commands
  • Do something on an interval or listen to an event
  • Consume a stateful API and interact with it using commands

There might be other reasons why you would want to use a service, but these are the most common.

Adding command groups
Creating a service