|
| 1 | +# f-code-operator-bot |
| 2 | + |
| 3 | +A Discord bot for managing f-code candidates. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +* Ping the bot to check if it's online. |
| 8 | +* Get help with the bot's commands. |
| 9 | +* Add, delete, and verify candidates. |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +1. Clone the repository: |
| 14 | + ```bash |
| 15 | + git clone https://github.com/your-username/f-code-operator-bot.git |
| 16 | + ``` |
| 17 | +2. Install the Rust toolchain: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) |
| 18 | +3. Create a `.env` file and add the following environment variables: |
| 19 | + ``` |
| 20 | + DISCORD_TOKEN=your-discord-token |
| 21 | + ``` |
| 22 | +4. Run the database migrations: |
| 23 | + ```bash |
| 24 | + sqlx migrate run |
| 25 | + ``` |
| 26 | +5. Run the bot: |
| 27 | + ```bash |
| 28 | + cargo run --release |
| 29 | + ``` |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +The following commands are available: |
| 34 | + |
| 35 | +### `/ping` |
| 36 | + |
| 37 | +Test if bot is responsive. |
| 38 | + |
| 39 | +**Example:** |
| 40 | +``` |
| 41 | +/ping |
| 42 | +``` |
| 43 | + |
| 44 | +### `/help` |
| 45 | + |
| 46 | +Shows a help message, either for all commands or for a specific command. |
| 47 | + |
| 48 | +**Parameters:** |
| 49 | +* `command` (optional): The command to get help for. |
| 50 | + |
| 51 | +**Example:** |
| 52 | +``` |
| 53 | +/help |
| 54 | +``` |
| 55 | +``` |
| 56 | +/help add |
| 57 | +``` |
| 58 | + |
| 59 | +### `/add` |
| 60 | + |
| 61 | +Add one or more candidate IDs to the candidates database from a text file. |
| 62 | + |
| 63 | +**Permissions:** `MANAGE_MESSAGES` or `MANAGE_THREADS` |
| 64 | + |
| 65 | +**Parameters:** |
| 66 | +* `id`: A text file with candidate IDs (one per line, UTF-8). |
| 67 | + |
| 68 | +**Example:** |
| 69 | +``` |
| 70 | +/add [attach file with IDs] |
| 71 | +``` |
| 72 | + |
| 73 | +### `/delete` |
| 74 | + |
| 75 | +Delete a candidate by ID from the candidates database. |
| 76 | + |
| 77 | +**Permissions:** `MANAGE_MESSAGES` or `MANAGE_THREADS` |
| 78 | + |
| 79 | +**Parameters:** |
| 80 | +* `id`: The ID of the candidate to delete. |
| 81 | + |
| 82 | +**Example:** |
| 83 | +``` |
| 84 | +/delete SE1000 |
| 85 | +``` |
| 86 | + |
| 87 | +### `/verify` |
| 88 | + |
| 89 | +Verify a candidate and assign a role upon success. The bot will check if the user's nickname or global name contains the provided ID. |
| 90 | +
|
| 91 | +**Parameters:** |
| 92 | +* `id`: The candidate's ID to verify. |
| 93 | + |
| 94 | +**Example:** |
| 95 | +``` |
| 96 | +/verify SE1000 |
| 97 | +``` |
| 98 | + |
| 99 | +## Database |
| 100 | + |
| 101 | +The bot uses an SQLite database to store information about candidates. The database is created automatically when the bot is first run. The database schema is defined in the `migrations` directory. |
0 commit comments