Skip to content

Commit

Permalink
Merge pull request #31 from srobo/kjk/team-management
Browse files Browse the repository at this point in the history
Add team management commands
  • Loading branch information
raccube authored Aug 28, 2024
2 parents 476a9c9 + e585d6d commit aa94032
Show file tree
Hide file tree
Showing 19 changed files with 639 additions and 217 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Cache dependencies
uses: actions/cache@v3
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Cache dependencies
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ WORKDIR /usr/src/app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY main.py .
COPY src/* .

CMD [ "python", "main.py" ]
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ For development, see `script/requirements.txt`

# Discord server set-up instructions

- ensure the `everyone` role cannot see any channels by default.
- Create a role named `verified` which can see the base channels (i.e. #general)
- Create a role named `unverified-volunteer` which can see the volunteer onboarding channel.
- ensure the `@everyone` role cannot see any channels by default.
- Create a role named `Verified` which can see the base channels (i.e. #general)
- Create a role named `Unverified Volunteer` which can see the volunteer onboarding channel.
- Create a role named `Blueshirt`.
- Create a new channel category called 'welcome', block all users from reading this category in its permissions.
- Create another channel, visible only to the admins, named '#role-passwords', enter in it 1 message per role in the form `role : password`. Special case: for the `unverified-volunteer` role, please use the role name `team-SRZ`.
- Create each role named `team-{role}`.
- Create another channel, visible only to the admins, named '#role-passwords', enter in it 1 message per role in the form `role : password`. Special case: for the `Unverified Volunteer` role, please use the role name `Team SRZ`.
- Create each role named `Team {role}`.

And voila, any new users should automatically get their role assigned once they enter the correct password.
And voilà, any new users should automatically get their role assigned once they enter the correct password.

## Install instructions

1. Set up discord to the correct settings (see above)
2. Register a discord bot.
3. Add an .env file with `DISCORD_TOKEN=<bot-token>`
3. Copy `.env` and fill it out with the application token and guild ID. In order to get the guild ID, you will need to enable developer mode in Discord's settings. Once enabled, right click the guild (server) in the sidebar and click `Copy Server ID`.
4. `pip install -r requirements.txt`
5. `python main.py`
5. `python src/main.py`
6. In the server settings, ensure the `/join` command cannot be used by the `Verified` role
3 changes: 2 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DISCORD_TOKEN=BLAHBLAH
DISCORD_TOKEN=
DISCORD_GUILD_ID=
163 changes: 0 additions & 163 deletions main.py

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python-dotenv
discord
discord.py
30 changes: 16 additions & 14 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
#
aiohttp==3.7.4.post0
aiohappyeyeballs==2.3.4
# via aiohttp
aiohttp==3.10.1
# via discord-py
async-timeout==3.0.1
aiosignal==1.3.1
# via aiohttp
attrs==21.2.0
async-timeout==4.0.3
# via aiohttp
chardet==4.0.0
attrs==24.1.0
# via aiohttp
discord==1.7.3
discord-py==2.4.0
# via -r requirements.in
discord-py==1.7.3
# via discord
idna==3.3
frozenlist==1.4.1
# via
# aiohttp
# aiosignal
idna==3.7
# via yarl
multidict==5.2.0
multidict==6.0.5
# via
# aiohttp
# yarl
python-dotenv==0.19.1
python-dotenv==1.0.1
# via -r requirements.in
typing-extensions==4.7.1
# via aiohttp
yarl==1.7.2
yarl==1.9.4
# via aiohttp
2 changes: 1 addition & 1 deletion script/linting/lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
if [ -z "$FLAKE8" ]; then
FLAKE8=flake8
fi
exec "$FLAKE8" main.py "$@"
exec "$FLAKE8" src/**.py "$@"
46 changes: 22 additions & 24 deletions script/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile script/requirements.in
#
aiohttp==3.7.4.post0
aiohappyeyeballs==2.3.4
# via
# -r script/../requirements.txt
# aiohttp
aiohttp==3.10.1
# via
# -r script/../requirements.txt
# discord-py
async-timeout==3.0.1
aiosignal==1.3.1
# via
# -r script/../requirements.txt
# aiohttp
attrs==21.2.0
async-timeout==4.0.3
# via
# -r script/../requirements.txt
# aiohttp
build==1.0.3
# via pip-tools
chardet==4.0.0
attrs==24.1.0
# via
# -r script/../requirements.txt
# aiohttp
build==1.0.3
# via pip-tools
click==8.1.7
# via pip-tools
discord==1.7.3
discord-py==2.4.0
# via -r script/../requirements.txt
discord-py==1.7.3
# via
# -r script/../requirements.txt
# discord
flake8==6.1.0
# via
# -r script/requirements.in
Expand All @@ -56,17 +56,20 @@ flake8-todo==0.7
# via -r script/requirements.in
flake8-tuple==0.4.1
# via -r script/requirements.in
idna==3.3
frozenlist==1.4.1
# via
# -r script/../requirements.txt
# aiohttp
# aiosignal
idna==3.7
# via
# -r script/../requirements.txt
# yarl
importlib-metadata==6.8.0
# via build
isort==5.12.0
# via flake8-isort
mccabe==0.7.0
# via flake8
multidict==5.2.0
multidict==6.0.5
# via
# -r script/../requirements.txt
# aiohttp
Expand All @@ -88,7 +91,7 @@ pyflakes==3.1.0
# via flake8
pyproject-hooks==1.0.0
# via build
python-dotenv==0.19.1
python-dotenv==1.0.1
# via -r script/../requirements.txt
six==1.16.0
# via flake8-tuple
Expand All @@ -99,18 +102,13 @@ tomli==2.0.1
# pip-tools
# pyproject-hooks
typing-extensions==4.7.1
# via
# -r script/../requirements.txt
# aiohttp
# mypy
# via mypy
wheel==0.41.2
# via pip-tools
yarl==1.7.2
yarl==1.9.4
# via
# -r script/../requirements.txt
# aiohttp
zipp==3.16.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
2 changes: 1 addition & 1 deletion script/typing/check
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
if [ -z "$MYPY" ]; then
MYPY=mypy
fi
exec "$MYPY" main.py
exec "$MYPY" src/**.py
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ignore =
W503

# try to keep it below 85, but this allows us to push it a bit when needed.
max_line_length = 100
max_line_length = 120


[isort]
Expand Down
Empty file added src/__init__.py
Empty file.
Loading

0 comments on commit aa94032

Please sign in to comment.