aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md64
1 files changed, 64 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7a8d638
--- /dev/null
+++ b/README.md
@@ -0,0 +1,64 @@
1# Timeoutinator
2
3A Discord bot that instantly **timeouts** anyone who posts in a configured channel and **purges** all of their messages from the last 24 hours.
4
5## How it works
6
71. User sends a message in the policed channel.
82. Bot immediately times them out (`Moderate Members` — configurable duration, default 1 hour).
93. Bot bulk-deletes every message that user posted **in any channel of the guild** over the past 24 hours (including the triggering message).
10
11Bots, system messages, and webhook messages are ignored. The bot's own messages are also ignored. Concurrent handling of the same user is deduplicated so rapid-fire spam doesn't cause duplicate timeouts or purge races.
12
13## Setup
14
15### 1. Create a Discord Application
16
171. Go to [discord.com/developers/applications](https://discord.com/developers/applications)
182. Click **New Application** → name it → **Bot** tab → **Add Bot**
193. Under the bot, click **Reset Token** and copy the token — this is your `DISCORD_TOKEN`
20
21### 2. Enable Required Intents
22
23In the **Bot** tab, scroll to **Privileged Gateway Intents**.
24The bot only needs **Message Content** if you want to read message content — by default, only `GUILD_MESSAGES` is required, which is non-privileged. No privileged intents are required.
25
26### 3. Invite the Bot
27
28Use this URL (replace `YOUR_BOT_CLIENT_ID` with the bot's Client ID from the **General Information** tab):
29
30```
31https://discord.com/api/oauth2/authorize?client_id=YOUR_BOT_CLIENT_ID&permissions=1099511702528&scope=bot
32```
33
34Required permissions (encoded in the URL):
35
36| Permission | Why |
37|-------------------------|------------------------------------------|
38| View Channels | See the policed channel and the channels to purge |
39| Read Message History | Fetch messages to purge |
40| Manage Messages | Delete messages via bulk-delete endpoint |
41| Moderate Members | Apply timeouts |
42
43### 4. Run
44
45```bash
46cp .env.example .env # or export the env vars directly
47# edit .env with your token and target channel ID
48
49cargo run --release
50```
51
52## Environment Variables
53
54| Variable | Required | Default | Description |
55|-----------------------|----------|---------|----------------------------------------------------------------|
56| `DISCORD_TOKEN` | ✅ | — | Bot token from the Discord Developer Portal |
57| `TARGET_CHANNEL_ID` | ✅ | — | Snowflake ID of the channel to police (right-click → Copy ID) |
58| `TIMEOUT_MINUTES` | ❌ | `60` | Timeout duration in minutes (1–40320, i.e. up to 28 days) |
59| `PURGE_HOURS` | ❌ | `24` | How far back (hours) to look when deleting messages |
60
61## Requirements
62
63- Rust 1.85+ (edition 2024)
64- Network access (to fetch crates and connect to Discord's gateway)