> From the BotGhost docs: https://botghost.com/docs/custom-commands-and-events/actions/server-actions/pause-invites-or-dms
> Every page: https://botghost.com/docs/llms.txt

# Pause Invites or DMs

Pause Invites or DMs stops new members joining, or stops members DMing each other, from a block. It's the same as the pause switches in Discord's server settings, so you can put it in a `/lockdown` command for your mods, in a timed event that pauses invites every night, or after a raid check. The [Invite Tracker](https://botghost.com/docs/server-management/invite-tracker#pause-invites)'s **Pause invites** switch uses it.

## What to do

- **Pause**: starts a pause.
- **Resume**: ends a pause straight away, so things work as normal again.

## How long

When you pause:

- **For a while**: up to 24 hours, for invites, DMs or both. This is Discord's own raid protection, the **Pause Invites** and **Pause DMs** buttons under **Server Settings > Security**. Discord ends it by itself, and server admins see the pause there and can end it early.
- **Until resumed**: invites only, with no end time. Nobody can join with an invite until a Resume block set to **The pause with no end** runs, or a server admin turns invites back on in Discord.

When you resume, **Which pause** picks the one to end: **The timed pause** or **The pause with no end**. Each leaves the other one alone.

## What to pause

- **New invites**: nobody can join the server with an invite, old or new. Members already in the server stay.
- **DMs between members**: members who aren't friends can't start DMs with each other through this server. DMs can only be paused for a while.

Turn on at least one. Pausing one leaves the other as it is, so a pause it already has keeps running.

## For how long

For **For a while** only: a number above 0 and **Minutes** or **Hours**. A variable works, like `{option_minutes}`. Discord pauses for 24 hours at most, so anything longer pauses for 24 hours.

## Which server

Leave it empty to use the server the command or event ran in, or type a server ID or a variable that gives one.

The bot needs the **Manage Server** permission in that server.

## Variables

| Variable | What it gives |
| --- | --- |
| `{invites_paused_until}` | For a while: the Unix time the invite pause ends. Empty when invites aren't paused |
| `{dms_paused_until}` | For a while: the Unix time the DM pause ends. Empty when DMs aren't paused |
| `{invites_paused}` | Until resumed: `true` while invites are paused, `false` once they work again |

To show when a timed pause ends, put `<t:{invites_paused_until}:R>` in a message.

## When it fails

It goes down its error path, with the reason in `{error_reason}`, when:

- The bot is missing **Manage Server** in the server.
- There's no server to use: the block ran outside a server and the server ID is empty, or the bot isn't in a server with that ID.
- **How long** isn't a number above 0.
- **Until resumed** is picked without **New invites**.
- Discord didn't send the server's settings. Nothing changes, so try again in a moment.

## Enable Success/Error Handles

Enable Success / Error Handles to detect success and errors inside of the action block. The green path on the bottom left side of the block runs when it works, and the red path on the bottom right side runs when it fails. The error variables are listed [here](https://botghost.com/docs/custom-commands-and-events/variables#error-variables).
