# Reminders

> Make a /remind command that DMs a member later, or pings them in the channel.

You will make `/remind`. A member runs it with a time and a note. Later, the bot sends them the note.

```text
/remind when: 2 hours note: Take the pizza out
```

The bot uses `schedule`. It saves an action now and runs it later. The bot keeps the action safe through restarts.

## 1. Create the command

Open **Create → Slash Command** and switch to **Advanced** at the top of the form.

| Field | Value |
|---|---|
| Command Name | `remind` |
| Description | `Remind me about something` |

Under **Behavior**, turn on **Only the user sees the reply**.

## 2. Add the arguments

| Type | Name | Required | Description |
|---|---|---|---|
| Text | `when` | Yes | For example 10 minutes, 2 hours, 3 days |
| Text | `note` | Yes | What to remind you about |

## 3. Add the code

Open **Pre-hook** and paste:

```python
await schedule("send_dm", f"in {when}", data=f"⏰ Reminder: {note}")
set_content(f"Got it! I will DM you {timestamp(f'in {when}', 'R')}.")
```

| Part | Job |
|---|---|
| `"send_dm"` | The action to run later: a DM. |
| `f"in {when}"` | When to run it, for example `in 2 hours`. |
| `data=...` | The text of the DM. |
| `timestamp(..., 'R')` | Shows "in 2 hours" in the reply. It counts down on its own in Discord. |

The DM goes to the member who ran the command. You do not need to say who.

> **Note:** Write the time as a length: `10 minutes`, `2 hours`, `3 days`. If the bot cannot read the time, the member sees *"Schedule time must be in the future"* and nothing is saved.

## 4. Try it

Save, then run:

```text
/remind when: 1 minute note: It works!
```

Wait one minute and check your DMs.

## Ping in the channel instead

Some members turn DMs off. Then a DM reminder fails without a word. To ping them in the channel instead, use `send_message`:

```python
await schedule(
    "send_message",
    f"in {when}",
    data=f"⏰ {user.mention}, reminder: {note}",
)
set_content(f"Got it! I will ping you here {timestamp(f'in {when}', 'R')}.")
```

The message goes to the channel where the command ran.

## Limits

`schedule` works on every plan. Each server can have a number of actions **waiting** at once:

| Plan | Waiting actions |
|---|---|
| Free | 20 |
| Starter | 100 |
| Basic | 250 |
| Advanced | 1,000 |

An action stops counting once it has run. When the server is full, `/remind` shows an error until older reminders go off.

> **Tip:** `schedule` returns an ID. Save it if you want a `/cancel-reminder` command later. `await cancel_schedule(id)` deletes a waiting action, and `await list_schedules()` lists all of them for the server.

## Learn more

- [Scheduling](https://ccbot.app/docs/reference/scheduling) lists every action `schedule` can run, like `add_role` and `delete_message`.
- [Time](https://ccbot.app/docs/reference/time) covers `timestamp` and the other time tools.
- The [/remind example](https://ccbot.app/docs/examples/remind) is a ready-to-copy version.
