Skip to content

Commit b8e8d2e

Browse files
committed
refactor(config): update config.example.toml file
1 parent 12e9e55 commit b8e8d2e

8 files changed

Lines changed: 423 additions & 212 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- 308-documentation
78
paths:
89
- 'docs/**'
910
- '.github/workflows/docs.yml'

.run/Run.run.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run" type="CargoCommandRunConfiguration" factoryName="Cargo Command" nameIsGenerated="true">
3+
<option name="buildProfileId" value="dev" />
4+
<option name="command" value="run -p rustmail" />
5+
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
6+
<envs>
7+
<env name="RUSTFLAGS" value="--cfg tokio_unstable" />
8+
</envs>
9+
<option name="emulateTerminal" value="true" />
10+
<option name="channel" value="DEFAULT" />
11+
<option name="requiredFeatures" value="true" />
12+
<option name="allFeatures" value="false" />
13+
<option name="withSudo" value="false" />
14+
<option name="buildTarget" value="REMOTE" />
15+
<option name="backtrace" value="SHORT" />
16+
<option name="isRedirectInput" value="false" />
17+
<option name="redirectInputPath" value="" />
18+
<method v="2">
19+
<option name="ToolBeforeRunTask" enabled="true" actionId="Tool_External Tools_trunk" />
20+
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
21+
</method>
22+
</configuration>
23+
</component>

config.example.toml

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,72 @@
11
[bot]
2-
token = "TOKEN_HERE"
3-
status = "DM POUR SUPPORT"
4-
welcome_message = "Votre message à bien été reçu par l'équipe Staff ! Nous vous répondrons dès que possible."
5-
close_message = "Merci d'avoir contacté le support ! Ton ticket est désormais clos."
2+
token = "MTQyMjU1OTIyNjIwM.GWv0F5.v9sdNf59KZyWL0jVk_eqokcY-jnQ7X8upVBXYw"
3+
status = "DM FOR SUPPORT"
4+
welcome_message = "Message received! Our staff will get back to you as soon as possible."
5+
close_message = "Thank you for contacting support! Your ticket is now closed."
66
typing_proxy_from_user = true
77
typing_proxy_from_staff = true
88
enable_logs = true
99
enable_features = true
10-
logs_channel_id = 14043597305699
11-
features_channel_id = 14069404548593076
12-
panel_super_admin_users = []
10+
enable_panel = true
11+
client_id = 1422559226685450
12+
client_secret = "YWaq7VQM28PjfoNuWJPVpcs3gWFXI"
13+
redirect_url = "http://192.168.2.92:3002/api/auth/callback"
14+
timezone = "Europe/Paris"
15+
logs_channel_id = 14043597305635899
16+
features_channel_id = 14069404548309076
17+
ip = "http://192.168.2.92"
18+
panel_super_admin_users = [6891484871962727]
1319
panel_super_admin_roles = []
1420

1521
[bot.mode]
16-
type = "dual"
17-
community_guild_id = 12096679805062590
18-
staff_guild_id = 711880297271856
22+
type = "single"
23+
guild_id = 7118802972311856
1924

2025
[command]
2126
prefix = "!"
2227

2328
[thread]
24-
inbox_category_id = 137646043847505960
29+
inbox_category_id = 1376460638505960
2530
embedded_message = true
2631
user_message_color = "3d54ff"
2732
staff_message_color = "ff3126"
2833
system_message_color = "00ff00"
2934
block_quote = true
3035
time_to_close_thread = 5
3136
create_ticket_by_create_channel = true
37+
close_on_leave = false
38+
auto_archive_duration = 10080
39+
40+
[language]
41+
default_language = "fr"
42+
fallback_language = "en"
43+
supported_languages = [
44+
"en",
45+
"fr",
46+
"es",
47+
"de",
48+
]
49+
50+
[error_handling]
51+
show_detailed_errors = false
52+
log_errors = true
53+
send_error_embeds = true
54+
auto_delete_error_messages = true
55+
error_message_ttl = 30
56+
display_errors = true
3257

3358
[notifications]
3459
show_success_on_edit = false
3560
show_partial_success_on_edit = true
3661
show_failure_on_edit = true
3762
show_success_on_reply = false
3863
show_success_on_delete = false
39-
40-
[logs]
41-
show_log_on_edit = true
42-
show_log_on_delete = true
43-
44-
[language]
45-
default_language = "en"
46-
fallback_language = "en"
47-
supported_languages = ["en", "fr", "es", "de"]
64+
show_success = true
65+
show_error = true
4866

4967
[reminders]
5068
embed_color = "ffb800"
5169

52-
[error_handling]
53-
show_detailed_errors = false
54-
log_errors = true
55-
send_error_embeds = true
56-
auto_delete_error_messages = true
57-
error_message_ttl = 30
70+
[logs]
71+
show_log_on_edit = true
72+
show_log_on_delete = true

docs/book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[book]
22
title = "Rustmail Documentation"
33
description = "Documentation for Rustmail, a Discord modmail bot"
4-
authors = ["Rustmail Team"]
4+
authors = ["Akinator31"]
55
language = "en"
66
src = "."
77

docs/development/architecture.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,16 @@ rustmail_types/src/
126126

127127
### Gateway Events
128128

129-
Rustmail handles these Discord gateway events:
130-
131-
| Event | Handler | Purpose |
132-
|---------------------------|--------------------|---------------------------|
133-
| `message_create` | Guild messages | Process DMs and commands |
134-
| `interaction_create` | Guild interactions | Handle slash commands |
135-
| `guild_member_add/remove` | Guild members | Track user status |
136-
| `typing_start` | Typing proxy | Forward typing indicators |
137-
| `ready` | Ready handler | Initialize bot state |
129+
Rustmail reacts to various Discord gateway events. Here are the main ones:
130+
131+
| Event | Handler | Purpose |
132+
|----------------------|-------------------------|---------------------------|
133+
| `ready` | `ReadyHandler` | Initialize bot state |
134+
| `message_create` | `GuildMessagesHandler` | Process DMs and commands |
135+
| `interaction_create` | `InteractionHandler` | Handle slash commands |
136+
| `typing_start` | `TypingProxyHandler` | Forward typing indicators |
137+
138+
All event handlers are located in `rustmail/src/handlers/`.
138139

139140
### Commands System
140141

docs/development/building.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Install Rust via rustup:
1414
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
1515
```
1616

17-
Minimum version: Rust 1.75+
17+
Minimum version: **Rust 1.85+** (Edition 2024)
1818

1919
Verify installation:
2020
```bash
@@ -77,23 +77,27 @@ Output: `target/release/rustmail`
7777

7878
```bash
7979
cd rustmail_panel
80-
trunk build --release
80+
trunk build --release --dist ../rustmail/static
8181
```
8282

83-
Output: `rustmail_panel/dist/`
83+
Output: `rustmail/static/`
8484

85-
### Full Build
85+
### Full Build (Panel + Bot)
8686

87-
```bash
88-
# Build bot
89-
cargo build -p rustmail --release
87+
The panel must be built first and placed in `rustmail/static/` so the bot can embed it:
9088

91-
# Build panel
89+
```bash
90+
# Build panel and output to bot's static folder
9291
cd rustmail_panel
93-
trunk build --release
92+
trunk build --release --dist ../rustmail/static
9493
cd ..
94+
95+
# Build bot (embeds the panel)
96+
cargo build -p rustmail --release
9597
```
9698

99+
Output: `target/release/rustmail` (single binary with embedded panel)
100+
97101
---
98102

99103
## Development Build
@@ -157,9 +161,9 @@ cargo fmt --all --check
157161

158162
## Build Optimization
159163

160-
### Release Profile
164+
### Custom Release Profile
161165

162-
The default release profile in `Cargo.toml`:
166+
You can add a custom release profile to your workspace `Cargo.toml` for optimized builds:
163167

164168
```toml
165169
[profile.release]
@@ -170,7 +174,7 @@ opt-level = 3
170174

171175
### Smaller Binary
172176

173-
For reduced binary size:
177+
For reduced binary size, use:
174178

175179
```toml
176180
[profile.release]
@@ -180,6 +184,8 @@ codegen-units = 1
180184
opt-level = "z"
181185
```
182186

187+
Note: These profiles increase compile time but produce smaller/faster binaries.
188+
183189
---
184190

185191
## Cross-Compilation
@@ -293,6 +299,25 @@ cargo sqlx prepare --workspace
293299

294300
## IDE Setup
295301

302+
### RustRover / IntelliJ
303+
304+
The repository includes a pre-configured run configuration in `.run/Run rustmail.run.xml`.
305+
306+
This configuration:
307+
1. Builds the panel with Trunk
308+
2. Outputs to `rustmail/static/`
309+
3. Runs the bot
310+
311+
To use it:
312+
1. Open the project in RustRover
313+
2. Select "Run rustmail" from the run configurations dropdown
314+
3. Click Run
315+
316+
The equivalent command:
317+
```bash
318+
cd rustmail_panel && trunk build --release --dist ../rustmail/static && cd .. && cargo run -p rustmail
319+
```
320+
296321
### VS Code
297322

298323
Recommended extensions:
@@ -308,10 +333,6 @@ Settings (`.vscode/settings.json`):
308333
}
309334
```
310335

311-
### IntelliJ/CLion
312-
313-
Install the Rust plugin. The project should be recognized automatically.
314-
315336
---
316337

317338
## Project Layout Reference
@@ -322,16 +343,20 @@ rustmail/
322343
├── Cargo.lock # Dependency lock file
323344
├── rustmail/ # Main bot crate
324345
│ ├── Cargo.toml
325-
│ └── src/
326-
├── rustmail_panel/ # Panel crate
346+
│ ├── src/
347+
│ └── static/ # Panel build output (embedded)
348+
├── rustmail_panel/ # Web panel crate (Yew/WASM)
327349
│ ├── Cargo.toml
328350
│ ├── Trunk.toml
329351
│ ├── index.html
330352
│ └── src/
331353
├── rustmail_types/ # Shared types crate
332354
│ ├── Cargo.toml
333355
│ └── src/
334-
├── migrations/ # Database migrations
356+
├── rustmail-i18n/ # Internationalization resources
357+
├── migrations/ # SQLite migrations
358+
├── docs/ # Documentation (mdBook)
359+
├── .run/ # IDE run configurations
335360
├── config.example.toml # Example configuration
336361
└── Dockerfile
337362
```

docs/getting-started/first-steps.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ From your installation directory:
1515
```
1616

1717
On Windows:
18+
1819
```cmd
1920
rustmail.exe
2021
```
@@ -24,10 +25,15 @@ rustmail.exe
2425
On successful startup, you will see:
2526

2627
```
27-
[INFO] Loading configuration...
28-
[INFO] Connecting to Discord...
29-
[INFO] Bot is ready!
30-
[INFO] Panel server running on http://0.0.0.0:3002
28+
[INFO] Database connection pool established
29+
[INFO] Database connected!
30+
[INFO] Starting rustmail...
31+
[INFO] listening on 0.0.0.0:3002
32+
[INFO] Configuration successfully validated!!
33+
[INFO] Mode: Mono server (ID: 711880297272311856)
34+
[INFO] Rustmail is online !
35+
[INFO] All pending reminders have been scheduled.
36+
[INFO] Updated 0 ticket statuses
3137
```
3238

3339
If there are configuration errors, the bot will display specific messages indicating what needs to be fixed.
@@ -38,7 +44,8 @@ If there are configuration errors, the bot will display specific messages indica
3844

3945
### 1. Check Bot Status
4046

41-
In Discord, verify the bot appears online in your server's member list. Its status should display the text you configured in `bot.status`.
47+
In Discord, verify the bot appears online in your server's member list. Its status should display the text you
48+
configured in `bot.status`.
4249

4350
### 2. Test Slash Commands
4451

@@ -48,16 +55,17 @@ In any channel where the bot has access:
4855
2. The bot should respond with a list of available commands
4956

5057
If slash commands don't appear:
58+
5159
- Wait a few minutes (Discord caches command registrations)
5260
- Verify the bot has the `applications.commands` scope
5361
- Check that the bot has permissions in the channel
5462

5563
### 3. Test Ticket Creation
5664

57-
1. Send a direct message to the bot from a non-staff account
65+
1. Send a direct message to the bot
5866
2. The bot should:
59-
- Reply with your configured `welcome_message`
60-
- Create a new channel in your inbox category
67+
- Reply with your configured `welcome_message`
68+
- Create a new channel in your inbox category
6169
3. Staff can now respond using `/reply` or `!reply` in the ticket channel
6270

6371
### 4. Access the Panel (if enabled)
@@ -80,6 +88,7 @@ Failed to parse config.toml: ...
8088
```
8189

8290
Check your `config.toml` for:
91+
8392
- Missing required fields
8493
- Incorrect TOML syntax (missing quotes, brackets)
8594
- Invalid color hex codes (should be 6 characters without `#`)
@@ -91,6 +100,7 @@ Serveur principal introuvable: ...
91100
```
92101

93102
Verify:
103+
94104
- The guild IDs in your configuration are correct
95105
- The bot has been invited to all configured servers
96106
- You're using the server ID, not a channel or user ID
@@ -102,6 +112,7 @@ Verify:
102112
```
103113

104114
Either:
115+
105116
- Set `enable_logs = false` to disable logging
106117
- Or provide a valid `logs_channel_id`
107118

@@ -110,6 +121,7 @@ The same applies to `enable_features` and `features_channel_id`.
110121
### OAuth2 Errors
111122

112123
If the panel login fails:
124+
113125
- Verify `client_id` and `client_secret` match your Discord application
114126
- Ensure `redirect_url` exactly matches what's configured in Discord Developer Portal
115127
- Check that your application has the OAuth2 redirect URI added

0 commit comments

Comments
 (0)