# Automatic message

> Messages sent to a channel at fixed times or at regular intervals, with text, embeds, buttons and images.

Source: https://docs.mayabot.eu/modules/auto-messages

MayaBot sends the messages you prepare in the dashboard to a channel, at fixed times or every so many minutes, hours, days or weeks. You'll find it in **Config > Automation**.

You can have up to **20 automatic messages** per server.

## Creating a message

### Turn the module on

Turn on the switch next to the **Automatic message** title.

### Add a message

Press **+**. In the panel fill in **Title** (only you see it in the list, it isn't sent) and choose the **Channel**: a text or announcement channel.

### Choose when to send it

Set **Repeat** and **Time zone** (below).

### Write the message and save

Choose the **Format**, write the text, add the images and press **Save**. The message starts out on and applies from the next minute.

## Repeat

### Fixed times

Choose the **Days** of the week and from 1 to 12 **Times**, the same for all the chosen days. Two times must be at least 5 minutes apart, even across midnight: 23:58 and 00:01 aren't allowed.

### Interval

**Repeat every** a certain number of minutes, hours, days or weeks, **Starting from** a date and time.

| Unit | Allowed values |
|---|---|
| Minutes | from 5 to 720 |
| Hours | from 1 to 168 |
| Days | from 1 to 365 |
| Weeks | from 1 to 52 |

The count starts from the start time and carries on without restarting at midnight. Every hour from 10:15 means 10:15, 11:15, 12:15 and so on. Every 7 days from a Monday at 9:00 means every Monday at 9:00. The start date can be in the past.

With an interval under 24 hours two more options appear:

- **Days**: the days of the week to send on.
- **Only within a time range**: sends only from **From** to **To**, both included. With the range the count restarts every day from **From**: every 2 hours from 9:00 to 18:00 means 9, 11, 13, 15, 17.

The range can't cross midnight. To send at night, for example from 22:00 to 6:00, use fixed times or two messages.

### Time zone

Each message has its own **Time zone**: times, days, range and start date are the local time of that zone. For a new message it's your browser's time zone.

With daylight saving time:

- a time that doesn't exist on that day (for example 2:30 on the night the clocks go forward) is skipped;
- a time that occurs twice (on the night the clocks go back) is sent only once;
- a daily send at 9:00 stays at 9:00 after the change too.

> **Bot offline**
>
> If MayaBot is down when a message is due, that send is lost: after the restart it carries on from the next send.

## Format

Each message has one of the three formats. Only the chosen one is saved.

**Content**

A normal text message, up to **2000 characters**, with Discord formatting. It can also be empty if you add at least one image.

**Embed (v1)**

The classic Discord embed box. It needs at least one filled-in field or an image.

| Field | Limit |
|---|---|
| **Colour** | hex code, such as `#5865F2` |
| **Author**: name, link, icon | name 256 characters |
| **Title**: text and link | 256 characters |
| **Description** | 4096 characters |
| **Fields**: name, value, **Inline** | up to 25; name 256, value 1024 characters |
| **Thumbnail** | link to an image |
| **Footer**: text and icon | 2048 characters |

In total the embed can have 6000 characters. Links must start with `http://` or `https://`.

The embed's large image is the first one you upload in **Images**; the others sit beside it. The thumbnail and icons can only be set from a link.

The **Embed Links** permission is needed in the channel.

**Embed (v2)**

A message made of components, one below the other. Press **Add component** and choose:

| Component | What it shows |
|---|---|
| **Container** | A box with a coloured bar that holds other components |
| **Text** | A block of text with Discord formatting, up to 4000 characters |
| **Section** | From 1 to 3 texts with a thumbnail or a button beside them |
| **Gallery** | From 1 to 10 images, uploaded or from a link, with alt text and spoiler |
| **File** | An uploaded image shown as a file |
| **Separator** | A space, small or large, with or without a line |
| **Buttons** | From 1 to 5 link buttons |

In total the message can have 40 components and 4000 characters of text.

Buttons are **link buttons only**: they have a **Label** (up to 80 characters), an optional **Emoji** and a `http://` or `https://` **Link**. There are no menus or buttons that make the bot do something.

Every uploaded image must appear in a Gallery, a Section or a File: otherwise saving flags it.

## Images

You can upload up to **4 images** per message: PNG, JPEG, WebP or GIF.

- Each image can be at most **1 MB** with its long side up to 4096 px. Larger images are resized and compressed in the browser before uploading.
- Animated GIFs larger than that are rejected, because compressing them would remove the animation.
- Before uploading, the hidden data in photos, such as GPS location, is removed.
- All the server's automatic messages together can use up to **32 MB** of images. Images from links don't count.

> **Links to images uploaded to Discord**
>
> Discord attachment links (`cdn.discordapp.com/attachments/...`) expire after about a day. Upload the image in the panel instead of pasting its link.

## Placeholders

In the Automatic message only the server placeholders work:

| Placeholder | Becomes |
|---|---|
| `%server%` | Server name |
| `%serverid%` | Server ID |
| `%servericon%` | Server icon link, useful in image fields |
| `%membercount%` | Member count |

They work in the text, in the embed fields and in the texts and links of components, but not in the message title. Placeholders for people, such as `%mention%`, stay written as they are: the message isn't about anyone in particular.

## Other options

**Delete the previous message**: after each send MayaBot deletes the message sent the previous time by the same automatic message. Useful for a reminder that shouldn't pile up.

Mentions, including `@everyone` and `@here`, show in the text but **don't send notifications**.

## Managing messages

- The **Active** switch on each row turns the single message on or off.
- A copy starts out **on**, even if the original was off.
- When you delete a message, the ones already sent stay on Discord.
- The order of the list, which you change by dragging the handle, doesn't change the priority of sends.

The module reset deletes all the server's automatic messages and their images.

## Permissions

| MayaBot's permission in the channel | When it's needed |
|---|---|
| **View Channel** and **Send Messages** | Always |
| **Embed Links** | Embed (v1) format |
| **Attach Files** | Messages with uploaded images |

**Manage Messages** isn't needed, not even for **Delete the previous message**: MayaBot only deletes its own messages.

## If a message isn't sent

| What you see | What to do |
|---|---|
| It's never sent | Check that both the module and the message (**Active**) are on |
| The row says **MayaBot can't write in this channel.**, **MayaBot can't see this channel.** or **The channel no longer exists.** | Give MayaBot its permissions back in the channel or choose another channel |
| An embed or a message with images isn't sent | **Embed Links** or **Attach Files** is missing. MayaBot skips the message and tries again after an hour |
| It's sent at the wrong time | Check the message's **Time zone** |
| `%mention%` shows as text | It doesn't work in this module: use the server placeholders |
| The **+** is grey | The module is off, you already have 20 messages or there's no channel where both you and MayaBot can write: the message on the **+** says who is missing the permission |
