@@ -18,13 +18,13 @@ The bot has the following extensions ("Cogs"):
18
18
19
19
## Screenshots
20
20
### Registration Channel:
21
- ![ Registration Channel] ( . /img/registration-channel.png)
21
+ ![ Registration Channel] ( docs /img/registration-channel.png)
22
22
23
23
### Registration Form:
24
- ![ Registration Form] ( . /img/registration-form.png)
24
+ ![ Registration Form] ( docs /img/registration-form.png)
25
25
26
26
### Programme Notification:
27
- ![ Programme Notification] ( . /img/programme-notification.png)
27
+ ![ Programme Notification] ( docs /img/programme-notification.png)
28
28
29
29
## Configuration
30
30
@@ -47,10 +47,12 @@ Cache files (will be created if necessary):
47
47
* ` pretix_cache.json ` : Local cache of Pretix ticket data
48
48
* ` schedule_cache.json ` : Local cache of [ programapi] ( https://github.com/europython/programapi ) schedule
49
49
50
- ## Setup
51
- ### Quickstart using ` pip `
50
+ ## Usage
52
51
53
- If you just want to try the bot and skip the development setup, you can use ` pip ` (requires Python >= 3.11):
52
+ This section describes how to install and run the bot.
53
+ Please see below for development and EuroPython-specific deployment instructions.
54
+
55
+ With pip:
54
56
55
57
``` shell
56
58
# create and activate virtual environment (optional, but recommended)
@@ -65,17 +67,65 @@ export DISCORD_BOT_TOKEN=... # Windows: $env:DISCORD_BOT_TOKEN = '...'
65
67
export PRETIX_TOKEN=... # Windows: $env:PRETIX_TOKEN = '...'
66
68
67
69
# run the bot with a given config file
68
- run-bot --config your-config-file.toml
70
+ run-bot --config-file your-config-file.toml
71
+ ```
72
+
73
+ With uv:
74
+
75
+ ``` shell
76
+ # install dependencies in virtual environment
77
+ uv sync
78
+
79
+ # set environment variables
80
+ export DISCORD_BOT_TOKEN=... # Windows: $env:DISCORD_BOT_TOKEN = '...'
81
+ export PRETIX_TOKEN=... # Windows: $env:PRETIX_TOKEN = '...'
82
+
83
+ # run the bot with a given config file
84
+ uv run run-bot --config-file your-config-file.toml
69
85
```
70
86
71
- ### Full Development Setup
87
+ ## Development Setup
72
88
73
- * Install ` uv ` as documented [ here] ( https://docs.astral.sh/uv/getting-started/installation/ ) .
74
- * Run ` uv sync --dev ` to create/update a virtual environment with all dependencies according to [ ` uv.lock ` ] ( ./uv.lock ) .
75
- * Run ` . .venv/bin/activate ` (Windows: ` .venv/Scripts/activate ` ) to activate the virtual environment
89
+ NOTE: This project uses [ uv] ( https://docs.astral.sh/uv/ ) to manage Python versions and dependencies.
90
+ If you don't plan to add/remove/update dependencies, you can also use [ pip] ( https://pip.pypa.io/en/stable/ ) , and any Python version >= 3.9.
91
+
92
+ ### Discord Server and Bot Setup
93
+
94
+ Follow [ Discord Server and Bot Setup] ( docs/discord-server-bot-setup.md )
95
+ if you don't yet have a Bot and Server for developing the bot.
96
+
97
+ Expected outcome: You have a Discord Bot Token and can run a Discord Bot on a Discord Server.
98
+
99
+ ### Discord Server Configuration
100
+
101
+ Follow [ Discord Server Configuration] ( docs/discord-server-configuration.md )
102
+ to configure your existing Discord Server with the expected channels, roles and messages.
103
+
104
+ Expected outcome: A Discord Server ready to be used for this bot.
105
+
106
+ ### Pretix Integration
107
+
108
+ This bot connects to a Pretix instance to obtain a list of valid tickets.
109
+
110
+ Follow [ Pretix Client Setup] ( docs/pretix-client-setup.md ) to either connect to a real Pretix instance,
111
+ or to use a mock.
112
+
113
+ ### Python environment setup
114
+
115
+ * Using ` uv `
116
+ * Install ` uv ` as documented [ here] ( https://docs.astral.sh/uv/getting-started/installation/ )
117
+ * Activate virtual environment: ` . .venv/bin/activate ` (macOS, Linux) or ` .venv/Scripts/activate ` (Windows)
118
+ * Run ` uv sync --dev ` to create/update a virtual environment with all dependencies according to [ uv.lock] ( ./uv.lock ) .
119
+ * Using ` pip `
120
+ * Create a virtual environment: ` python3 -m venv .venv ` (might require ` apt install python3-venv ` or similar on some systems)
121
+ * Activate virtual environment: ` . .venv/bin/activate ` (macOS, Linux) or ` .venv/Scripts/activate ` (Windows)
122
+ * Ensure ` pip ` version is >= 25.1.0: ` python3 -m pip install --upgrade pip ` (earlier versions don't support [ PEP 735] ( https://peps.python.org/pep-0735/ ) Dependency Groups)
123
+ * Install all dependencies according to [ pyproject.toml] ( pyproject.toml ) : ` python3 -m pip install -e . --group dev `
76
124
* Run ` pre-commit install ` to install the [ pre-commit] ( https://pre-commit.com/ ) hooks.
77
125
* Run ` pre-commit run --all-files ` to verify your setup. All checks should pass.
78
126
127
+ ### Run the bot
128
+
79
129
To run the bot, use the following:
80
130
81
131
``` shell
@@ -87,7 +137,7 @@ export PRETIX_TOKEN=... # Windows: $env:PRETIX_TOKEN = '...'
87
137
run-bot --config your-config-file.toml
88
138
```
89
139
90
- #### Working with ` uv `
140
+ ### Working with ` uv `
91
141
92
142
This is a list of useful commands when working with ` uv ` .
93
143
Please refer to the [ uv documentation] ( https://docs.astral.sh/uv ) or ` uv help ` for details.
@@ -123,15 +173,23 @@ uv remove [package]
123
173
* Check code style: ` ruff check . `
124
174
* Run tests: ` pytest `
125
175
126
- ### Deployment
176
+ ## Deployment
127
177
128
- The bot is deployed on a VPS using a GitHub Action .
178
+ For the EuroPython conference, this bot is deployed on a VPS.
129
179
It uses Ansible to configure the VPS, and Docker Compose to run the bot.
180
+ The deployment process is executed via a GitHub Action.
130
181
131
182
Related files:
132
183
133
- * [ .github/workflows/deploy.yml] ( ./.github/workflows/deploy.yml ) : The GitHub Action
134
- * [ ansible/deploy-playbook.yml] ( ./ansible/deploy-playbook.yml ) : The Ansible Playbook
135
- * [ Dockerfile] ( ./Dockerfile ) : The Docker container recipe
136
- * [ compose.yaml] ( ./compose.yaml ) : The Docker Compose recipe
137
- * [ prod-config.toml] ( ./prod-config.toml ) : The Prod bot configuration
184
+ * In this repository:
185
+ * [ .github/workflows/deploy.yml] ( ./.github/workflows/deploy.yml ) : GitHub Action
186
+ * [ ansible/deploy-playbook.yml] ( ./ansible/deploy-playbook.yml ) : Ansible Playbook
187
+ * [ Dockerfile] ( ./Dockerfile ) : Docker container recipe
188
+ * [ compose.yaml] ( ./compose.yaml ) : Docker Compose recipe
189
+ * [ prod-config.toml] ( ./prod-config.toml ) : Prod bot configuration
190
+ * On the VPS:
191
+ * ` /root/.secrets ` : Contains ` DISCORD_BOT_TOKEN ` and ` PRETIX_TOKEN `
192
+ * ` /root/livestreams.toml ` : Livestream URL configuration
193
+ * ` /home/bot/registered_log.txt ` : Registration log
194
+ * ` /home/bot/pretix_cache.json ` : Pretix cache
195
+ * ` /home/bot/schedule_cache.json ` : Program cache
0 commit comments