# Honeypot

> A trap channel where nobody should write. Whoever writes in it, like spam bots, is removed from the server or timed out.

Source: https://docs.mayabot.eu/modules/honeypot

The Honeypot is a trap channel. Spam bots and compromised accounts write in every channel: when they do it here too, MayaBot deletes the message and punishes whoever wrote it. Real people read the warning and don't write in it.

You'll find it in **Config > Security**.

> **Use a new channel**
>
> MayaBot deletes **all** messages already in the channel, pinned ones included, and every new message. Create an empty channel on Discord just for this: never choose a channel that's in use.

## Setting up

### Create the channel on Discord

Create a text channel, for example `#do-not-post-here`, visible to all members. MayaBot doesn't create it by itself.

### Turn the module on

Turn on the **Honeypot** switch and press **+**.

### Choose channel and action

Choose the **Trap channel** and the **Action** (below).

### Write the warning and save

Choose the warning's **Format**, add any **Excluded roles** and press **Save**. MayaBot empties the channel, publishes the warning and from then on watches the channel.

## Action

| Action | What it does |
|---|---|
| **Softban** (default) | Bans whoever writes, deleting their messages from the last day across the whole server, and removes the ban after 2 seconds: the person leaves the server but can rejoin |
| **Delete + 5 min timeout** | Deletes the message and times out whoever writes for 5 minutes |

The softban is useful against spam: besides removing the account, it deletes the messages it has already left in other channels.

To save an action you yourself must have the matching permission on Discord: **Ban Members** for the softban, **Timeout Members** for the timeout.

## Who is not punished

The message is always deleted, but MayaBot doesn't punish:

- members with one of the **Excluded roles** (up to 20), for example staff;
- members with a role equal to or higher than MayaBot's;
- with the timeout, members with **Administrator**: Discord doesn't allow timing them out;
- other bots, webhooks and Discord system messages;
- members already punished in the last minute.

There's also a safety limit: if MayaBot punishes too many people in the same server in a short time, it suspends punishments for a while and only keeps deleting messages. This limits the damage if the chosen channel is actually in use.

People who are punished get no message from MayaBot. The actions appear in the server's audit log, with the reason "MayaBot Honeypot: message in the trap channel"; the end of a softban with "MayaBot Honeypot: end of the softban". The reasons are in the [server language](https://docs.mayabot.eu/getting-started/server-language).

## The warning

The warning has the three formats of the [Automatic message](https://docs.mayabot.eu/modules/auto-messages#format), without uploaded images and without buttons. The suggested text is "Do not write in this channel: it is a trap for spam bots and anyone who writes here is punished automatically." and it follows the [server language](https://docs.mayabot.eu/getting-started/server-language) until you edit it.

Besides the server placeholders you can use two counters:

| Placeholder | Becomes |
|---|---|
| `%kicks_here%` | People caught in this server, updated every minute |
| `%kicks_all%` | People caught across all servers with MayaBot, updated every 12 hours |

They only count people who were banned or timed out, not messages that were only deleted. When the counters change, MayaBot edits the warning by itself.

If the warning is deleted on Discord, the channel keeps working as a trap. To put it back use **Publish again** in the module's row: every publish empties the channel again.

## Messages written while the module is off

While the module is off or MayaBot is offline, messages in the channel stay. They're deleted, without punishments, when the module is turned back on or MayaBot restarts.

## Permissions

| MayaBot's permission | Where | Why |
|---|---|---|
| **View Channel**, **Send Messages** | Trap channel | Publishing the warning |
| **Manage Messages** | Trap channel | Deleting messages |
| **Read Message History** | Trap channel | Emptying the channel when it publishes |
| **Embed Links** | Trap channel | Only with the Embed (v1) format |
| **Ban Members** | Server | Softban action |
| **Timeout Members** | Server | Timeout action |

> **Read Message History**
>
> The dashboard doesn't save if MayaBot is missing this permission in the trap channel. If it loses it later, publishing fails with **MayaBot doesn't have the permissions to send the message in the selected channel.** even if MayaBot can write: add it in the channel and use **Publish again**.

## Turning off and resetting

- **Off**: MayaBot doesn't delete or punish. The warning stays on Discord.
- **Reset**: deletes the saved settings and warning, and MayaBot removes the warning from the channel. The channel stays on Discord. The counter of people caught isn't reset to zero.

## Common problems

| Problem | Fix |
|---|---|
| The message disappears but whoever wrote it isn't punished | Check excluded roles, the position of MayaBot's role and the action's permission. See [Who is not punished](#who-is-not-punished) |
| Messages stay in the channel | **Manage Messages** is missing, or the module is off |
| **Message saved but not published** | **Read Message History** is missing or, with Embed (v1), **Embed Links** |
| **Some messages are still in the channel: MayaBot will delete them in the next few minutes.** | The channel had a lot of messages: MayaBot finishes by itself |
| I can't save with Softban | Your account doesn't have **Ban Members**: ask someone who has it or use the timeout |
| A person stays banned | MayaBot lost **Ban Members** after the ban. Give the permission back: it tries again every 5 minutes. Or remove the ban yourself |
| Messages in the channel's threads aren't handled | The Honeypot only watches the channel, not its threads |
