Skip to content

Commit 99a2364

Browse files
Merge branch 'main' into vgs-main
2 parents 427ba3b + 8e0c245 commit 99a2364

37 files changed

Lines changed: 830 additions & 608 deletions

.github/workflows/check-build-deploy.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v5
1616

1717
- name: Install uv
18-
uses: astral-sh/setup-uv@v6
18+
uses: astral-sh/setup-uv@v7
1919
with:
2020
enable-cache: true
2121

@@ -39,7 +39,7 @@ jobs:
3939
python-version-file: .python-version
4040

4141
- name: Install uv
42-
uses: astral-sh/setup-uv@v6
42+
uses: astral-sh/setup-uv@v7
4343
with:
4444
enable-cache: true
4545

@@ -75,7 +75,7 @@ jobs:
7575
python-version-file: .python-version
7676

7777
- name: Install uv
78-
uses: astral-sh/setup-uv@v6
78+
uses: astral-sh/setup-uv@v7
7979
with:
8080
enable-cache: true
8181

@@ -125,15 +125,15 @@ jobs:
125125
python-version-file: .python-version
126126

127127
- name: Install uv
128-
uses: astral-sh/setup-uv@v6
128+
uses: astral-sh/setup-uv@v7
129129
with:
130130
enable-cache: true
131131

132-
- name: Install CCFT-PyMarkdown From Locked Dependencies
132+
- name: Install PyMarkdown From Locked Dependencies
133133
run: uv sync --only-group lint-format
134134

135135
- name: Run PyMarkdown scan
136-
run: uv run -- ccft-pymarkdown scan-all
136+
run: uv run -- pymarkdown scan .
137137

138138
pytest:
139139
needs: [uv-check]
@@ -154,7 +154,7 @@ jobs:
154154
python-version-file: .python-version
155155

156156
- name: Install uv
157-
uses: astral-sh/setup-uv@v6
157+
uses: astral-sh/setup-uv@v7
158158
with:
159159
enable-cache: true
160160

@@ -202,7 +202,7 @@ jobs:
202202
python-version-file: .python-version
203203

204204
- name: Install uv
205-
uses: astral-sh/setup-uv@v6
205+
uses: astral-sh/setup-uv@v7
206206
with:
207207
enable-cache: true
208208

@@ -241,7 +241,7 @@ jobs:
241241

242242
steps:
243243
- name: Log in to the Container registry
244-
uses: docker/login-action@v3.5.0
244+
uses: docker/login-action@v3.6.0
245245
with:
246246
registry: ${{env.REGISTRY}}
247247
username: ${{github.actor}}

.github/workflows/prevent-migrations-deletion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Prevent migrations files being changed or deleted
16-
uses: xalvarez/prevent-file-change-action@v2.0.0
16+
uses: xalvarez/prevent-file-change-action@v3.0.0
1717
with:
1818
githubToken: ${{ secrets.GITHUB_TOKEN }}
1919
pattern: '.*\/db\/.+\/migrations\/\d{4}\w*\.py$'

.pre-commit-config.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ default_language_version:
66

77
repos:
88
- repo: https://github.com/hadolint/hadolint
9-
rev: v2.13.1
9+
rev: v2.14.0
1010
hooks:
1111
- id: hadolint-docker
1212

1313
- repo: https://github.com/renovatebot/pre-commit-hooks
14-
rev: 41.98.4
14+
rev: 41.154.1
1515
hooks:
1616
- id: renovate-config-validator
1717
args: [--strict]
1818
stages: [manual]
1919

2020
- repo: https://github.com/python-jsonschema/check-jsonschema
21-
rev: 0.33.3
21+
rev: 0.34.1
2222
hooks:
2323
- id: check-github-workflows
2424

@@ -74,20 +74,23 @@ repos:
7474
stages: [manual]
7575

7676
- repo: https://github.com/astral-sh/ruff-pre-commit
77-
rev: v0.12.12
77+
rev: v0.14.1
7878
hooks:
7979
- id: ruff
8080
args: [--fix]
8181

8282
- id: ruff-format
8383

8484
- repo: https://github.com/astral-sh/uv-pre-commit
85-
rev: 0.8.15
85+
rev: 0.9.4
8686
hooks:
8787
- id: uv-lock
8888
always_run: true
8989

9090
- repo: https://github.com/google/yamlfmt
91-
rev: v0.17.2
91+
rev: v0.19.0
9292
hooks:
9393
- id: yamlfmt
94+
entry: yamlfmt
95+
types: [yaml]
96+
pass_filenames: true

CONTRIBUTING.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Additionally, linked below are some helpful resources:
2424
If you are new to contributing to open-source projects on GitHub, the general workflow is as follows:
2525

2626
1. [Fork](https://w3schools.com/git/git_remote_fork.asp) this [repository](https://phoenixnap.com/kb/what-is-a-git-repository#ftoc-heading-1) and [clone](https://w3schools.com/git/git_clone.asp) it
27-
2. Create a [branch](https://w3schools.com/git/git_remote_branch.asp) off main
27+
2. Create a [branch](https://w3schools.com/git/git_remote_branch.asp) from `main`
2828
3. Make your changes and [commit](https://w3schools.com/git/git_commit.asp) them
2929
4. [Push](https://w3schools.com/git/git_push_to_remote.asp) your local [branch](https://w3schools.com/git/git_remote_branch.asp) to your remote fork
3030
5. Open a new [pull request on GitHub](https://w3schools.com/git/git_remote_send_pull_request.asp)
@@ -44,20 +44,20 @@ If you find an issue with TeX-Bot, the best place to report it is through the is
4444
If you are looking for issues to contribute code to, it's a good idea to look at the [issues labelled "good-first-issue"](https://github.com/CSSUoB/TeX-Bot-Py-V2/issues?q=label%3A%22good+first+issue%22)!
4545

4646
When submitting an issue, please be as descriptive as possible.
47-
If you are submitting a bug report, please include the steps to reproduce the bug, and the environment it is in.
47+
If you are submitting a bug report, please include the steps to reproduce the bug and the environment it is in.
4848
If you are submitting a feature request, please include the steps to implement the feature.
4949

5050
## Repository Structure
5151

5252
### Top level files
5353

5454
* [`main.py`](main.py): is the main entrypoint to instantiate the [`Bot` object](https://docs.pycord.dev/stable/api/clients.html#discord.Bot) & run it
55-
* [`exceptions.py`](exceptions.py): contains common [exception](https://docs.python.org/3/tutorial/errors) subclasses that may be raised when certain errors occur
5655
* [`config.py`](config.py): retrieves the [environment variables](README.md#setting-environment-variables) & populates the correct values into the `settings` object
5756

5857
### Other significant directories
5958

6059
* [`cogs/`](cogs): contains all the [cogs](https://guide.pycord.dev/popular-topics/cogs) within this project, see [below](#cogs) for more information
60+
* [`exceptions/`](exceptions): contains common [exception](https://docs.python.org/3/tutorial/errors) subclasses that may be raised when certain errors occur
6161
* [`utils/`](utils): contains common utility classes & functions used by the top-level modules & cogs
6262
* [`db/core/models/`](db/core/models): contains all the [database ORM models](https://docs.djangoproject.com/en/stable/topics/db/models) to interact with storing information longer-term (between individual command events)
6363
* [`tests/`](tests): contains the complete test suite for this project, based on the [Pytest framework](https://pytest.org)
@@ -68,8 +68,8 @@ If you are submitting a feature request, please include the steps to implement t
6868
They combine related [listeners](https://guide.pycord.dev/getting-started/more-features#event-handlers) and [commands](https://guide.pycord.dev/category/application-commands) (each as individual methods) into one class.
6969
There are separate cog files for each activity, and one [`__init__.py`](cogs/__init__.py) file which instantiates them all:
7070

71-
<!--- pyml disable-next-line no-emphasis-as-heading-->
72-
*For more information about the purpose of each cog, please look at the documentation within the files themselves*
71+
> [!IMPORTANT]
72+
> For more information about the purpose of each cog, please look at the documentation within the files themselves
7373
7474
* [`cogs/__init__.py`](cogs/__init__.py): instantiates all the cog classes within this directory
7575

@@ -92,16 +92,16 @@ There are separate cog files for each activity, and one [`__init__.py`](cogs/__i
9292
* [`cogs/remind_me.py`](cogs/remind_me.py): cogs to ask TeX-Bot to send a reminder message at a later date
9393

9494
* [`cogs/send_get_roles_reminders.py`](cogs/send_get_roles_reminders.py): cogs relating to sending reminders, to Discord members, about opt-in roles.
95-
(See [Repeated Tasks Conditions](README.md#repeated-tasks-conditions) for which conditions are required to be met, to execute this task)
95+
(See [Repeated Tasks Conditions](README.md#repeated-tasks-conditions) for which conditions are required to be met to execute this task)
9696

9797
* [`cogs/send_introduction_reminders.py`](cogs/send_introduction_reminders.py): cogs relating to sending reminders, to Discord members, about introducing themselves.
98-
(See [Repeated Tasks Conditions](README.md#repeated-tasks-conditions) for which conditions are required to be met, to execute this task)
98+
(See [Repeated Tasks Conditions](README.md#repeated-tasks-conditions) for which conditions are required to be met to execute this task)
9999

100100
* [`cogs/source.py`](cogs/source.py): cogs for displaying information about the source-code of this project
101101

102102
* [`cogs/startup.py`](cogs/startup.py): cogs for startup & bot initialisation
103103

104-
* [`cogs/stats.py`](cogs/stats.py): cogs for displaying stats about your group's Discord guild, as well as its channels & Discord members
104+
* [`cogs/stats/`](cogs/stats): cogs for displaying stats about your group's Discord guild, as well as its channels & Discord members
105105

106106
* [`cogs/strike.py`](cogs/strike.py): cogs for applying moderation actions to Discord members
107107

@@ -159,20 +159,15 @@ It can be run with the following command:
159159
uv run mypy .
160160
```
161161

162-
Although there is [a PyCharm plugin](https://github.com/leinardi/mypy-pycharm#mypy-pycharm) to provide GUI control & inline warnings for [mypy](https://mypy-lang.org), it has been rather temperamental recently.
163-
So it is suggested to avoid using it, and run [mypy](https://mypy-lang.org) from the command-line instead.
164-
165162
#### PyMarkdown
166163

167164
[PyMarkdown](https://github.com/jackdewinter/pymarkdown) is a static analysis [Markdown](https://markdownguide.org/getting-started#what-is-markdown) [linter](https://wikipedia.org/wiki/Lint_(software)), which will alert you to possible formatting mistakes in your [MarkDown](https://markdownguide.org/getting-started#what-is-markdown) files.
168165
It can be run with the following command:
169166

170167
```shell
171-
uv run ccft-pymarkdown scan-all --with-git
168+
uv run pymarkdown scan .
172169
```
173170

174-
This command includes the removal of custom-formatted tables. See the [CCFT-PyMarkdown tool](https://github.com/CarrotManMatt/CCFT-PyMarkdown) for more information on linting Markdown files that contain custom-formatted tables.
175-
176171
### Git Commit Messages
177172

178173
Commit messages should be written in the imperative present tense. For example, "Fix bug #1".
@@ -205,7 +200,7 @@ Please note that any contributions you make will be made under the terms of the
205200

206201
## Guidance
207202

208-
We aim to get more people involved with our projects, and help build members' confidence in using git and contributing to open-source.
203+
We aim to get more people involved with our projects and help build members' confidence in using git and contributing to open-source.
209204
If you see an error, we encourage you to **be bold** and fix it yourself, rather than just raising an issue.
210205
If you are stuck, need help, or have a question, the best place to ask is on our Discord.
211206

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ uv sync
142142
> [!TIP]
143143
> Syncing the dependencies is not required. uv performs this automatically every time the `uv run` command is used
144144
145-
146145
### Creating Your [Bot](https://discord.com/developers/docs/topics/oauth2#bot-vs-user-accounts)
147146

148147
A full guide on how to create your bot's account can be found [here; on Pycord's wiki](https://docs.pycord.dev/en/stable/discord.html).
@@ -170,7 +169,7 @@ You'll also need to set a number of [environment variables](https://wikipedia.or
170169
* `SU_PLATFORM_ACCESS_COOKIE`: The SU platform [access session cookie](https://wikipedia.org/wiki/HTTP_cookie#Session_cookie).
171170
* This [session cookie](https://wikipedia.org/wiki/HTTP_cookie#Session_cookie) will [authenticate](https://wikipedia.org/wiki/Authentication) TeX-Bot to view your group's members list on the SU platform, as if it were [logged in to the website](https://wikipedia.org/wiki/Login_session) as a Committee member.
172171
* This can be [extracted from your web-browser](https://wikihow.com/View-Cookies), after logging in to view your members list yourself.
173-
It will most likely be listed as a [cookie](https://wikipedia.org/wiki/HTTP_cookie) named [`.ASPXAUTH`](https://stackoverflow.com/a/424061/14403974).
172+
It will most likely be listed as a [cookie](https://wikipedia.org/wiki/HTTP_cookie) named `.AspNet.SharedCookie`.
174173
* If you wish to test TeX-Bot with the SU platform-access disabled, a dummy value of 128 `0` characters can be used.
175174
Note that this will cause many commands and scheduled tasks to fail when they are used at runtime.
176175

cogs/add_users_to_threads_and_channels.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async def add_users_or_roles_with_ping(
167167
@capture_guild_does_not_exist_error
168168
async def on_thread_create(self, thread: discord.Thread) -> None:
169169
"""Add users to a thread when it is created."""
170-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
170+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
171171
committee_role: discord.Role = await self.bot.committee_role
172172
committee_elect_role: discord.Role = await self.bot.committee_elect_role
173173

@@ -183,18 +183,18 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
183183
users_or_roles=(committee_role, committee_elect_role), channel_or_thread=thread
184184
)
185185

186-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
186+
@discord.slash_command(
187187
name="add-users-to-channel", description="Adds selected users to a channel or thread."
188188
)
189-
@discord.option( # type: ignore[no-untyped-call, misc]
189+
@discord.option(
190190
name="user",
191191
description="The user to add to the channel.",
192192
input_type=str,
193-
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_members), # type: ignore[arg-type]
193+
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_members),
194194
required=True,
195195
parameter_name="user_id_str",
196196
)
197-
@discord.option( # type: ignore[no-untyped-call, misc]
197+
@discord.option(
198198
name="silent",
199199
description="Whether the users being added should be pinged or not.",
200200
input_type=bool,
@@ -203,7 +203,7 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
203203
)
204204
@CommandChecks.check_interaction_user_has_committee_role
205205
@CommandChecks.check_interaction_user_in_main_guild
206-
async def add_user_to_channel( # type: ignore[misc]
206+
async def add_user_to_channel(
207207
self,
208208
ctx: "TeXBotApplicationContext",
209209
user_id_str: str,
@@ -237,19 +237,19 @@ async def add_user_to_channel( # type: ignore[misc]
237237
ephemeral=True,
238238
)
239239

240-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
240+
@discord.slash_command(
241241
name="add-role-to-channel",
242242
description="Adds the selected role and it's users to a channel or thread.",
243243
)
244-
@discord.option( # type: ignore[no-untyped-call, misc]
244+
@discord.option(
245245
name="role",
246246
description="The role to add to the channel.",
247247
input_type=str,
248-
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_roles), # type: ignore[arg-type]
248+
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_roles),
249249
required=True,
250250
parameter_name="role_id_str",
251251
)
252-
@discord.option( # type: ignore[no-untyped-call, misc]
252+
@discord.option(
253253
name="silent",
254254
description="Whether the users being added should be pinged or not.",
255255
input_type=bool,
@@ -258,7 +258,7 @@ async def add_user_to_channel( # type: ignore[misc]
258258
)
259259
@CommandChecks.check_interaction_user_has_committee_role
260260
@CommandChecks.check_interaction_user_in_main_guild
261-
async def add_role_to_channel( # type: ignore[misc]
261+
async def add_role_to_channel(
262262
self,
263263
ctx: "TeXBotApplicationContext",
264264
role_id_str: str,

0 commit comments

Comments
 (0)