Compare commits
334
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af2c96bd4e | ||
|
|
aaef1f249f | ||
|
|
4936013697 | ||
|
|
945f5766d5 | ||
|
|
8727c0d6f6 | ||
|
|
64e2c10b39 | ||
|
|
3d44c5c905 | ||
|
|
6653bb9bdd | ||
|
|
f5b45b8cab | ||
|
|
412a81db6e | ||
|
|
8069176128 | ||
|
|
5b5e699f7a | ||
|
|
3b0535663a | ||
|
|
6fd61c79cc | ||
|
|
c2c2b132e1 | ||
|
|
66f3d797fd | ||
|
|
ccc489dbaf | ||
|
|
d0961bb9f0 | ||
|
|
83b11206da | ||
|
|
6f28f09b66 | ||
|
|
e1508e6f31 | ||
|
|
be88f1e179 | ||
|
|
ae64ab6dde | ||
|
|
a76df955ec | ||
|
|
2473d258ff | ||
|
|
9c94704fbd | ||
|
|
0c62678797 | ||
|
|
0528eea5cd | ||
|
|
2836237b76 | ||
|
|
4c741136cc | ||
|
|
b221f1e438 | ||
|
|
1b08ba1355 | ||
|
|
e191df1a38 | ||
|
|
e35a2a8c8d | ||
|
|
d7046e4595 | ||
|
|
70037fb47a | ||
|
|
4ae3866e44 | ||
|
|
1349813f0d | ||
|
|
294b672fe2 | ||
|
|
72349a4cae | ||
|
|
f6e9d3c32e | ||
|
|
7c8455bf29 | ||
|
|
f4c4a0435b | ||
|
|
bbc63dd77a | ||
|
|
7ed3f0d613 | ||
|
|
eb6a8c7479 | ||
|
|
58b230afe6 | ||
|
|
fb8dfef55e | ||
|
|
487d174b6d | ||
|
|
abb50d71b4 | ||
|
|
7409e2fd2d | ||
|
|
6a67804937 | ||
|
|
4f4d76d151 | ||
|
|
f3985b5d21 | ||
|
|
142cc337a0 | ||
|
|
fd1d1c075e | ||
|
|
e3ffafcff2 | ||
|
|
855f3c1df8 | ||
|
|
a3371e9e8c | ||
|
|
a158248a35 | ||
|
|
886ac2f7ee | ||
|
|
f06033d2ec | ||
|
|
2ffc4126d2 | ||
|
|
4280ddd841 | ||
|
|
58c167bbe3 | ||
|
|
303e359c32 | ||
|
|
fb460ccc2c | ||
|
|
c5e4a94cd2 | ||
|
|
f95955dc7f | ||
|
|
dfea936aaa | ||
|
|
1df639499c | ||
|
|
be3ec007af | ||
|
|
e8839d2930 | ||
|
|
29eb21b286 | ||
|
|
b7439631d9 | ||
|
|
6b9d8f6ad9 | ||
|
|
c48fba9c85 | ||
|
|
7e3b57f4b6 | ||
|
|
889ba2fd6b | ||
|
|
8b5c954aa5 | ||
|
|
adc44d4466 | ||
|
|
1ab9cdfea3 | ||
|
|
5748159279 | ||
|
|
12b700f340 | ||
|
|
89534ed5b8 | ||
|
|
80dde1e8ed | ||
|
|
969f380b08 | ||
|
|
10d7014c41 | ||
|
|
89e77a6671 | ||
|
|
c2ff656114 | ||
|
|
81e2957fa5 | ||
|
|
ba24a268ec | ||
|
|
70d262d947 | ||
|
|
6199350cca | ||
|
|
c5e2b39648 | ||
|
|
5db2b43d6a | ||
|
|
b9be9e5470 | ||
|
|
6700199a36 | ||
|
|
8f9821e9c9 | ||
|
|
83af20e04c | ||
|
|
78d4b3d2de | ||
|
|
d9645dc342 | ||
|
|
f1dd3cbd3b | ||
|
|
d56251c0b9 | ||
|
|
667a600ec6 | ||
|
|
03a94ca6dd | ||
|
|
9da598e4d9 | ||
|
|
3a280696ca | ||
|
|
8825afdb46 | ||
|
|
5f7ef0a7fb | ||
|
|
6fc91e0708 | ||
|
|
95cfcca600 | ||
|
|
0419c9dfd6 | ||
|
|
6ec2862aed | ||
|
|
c8f5c5bffb | ||
|
|
a56b47a5fa | ||
|
|
906b63d57f | ||
|
|
1bae320446 | ||
|
|
a081718f8d | ||
|
|
0dd1a90edd | ||
|
|
1305e15edf | ||
|
|
86e9e3e32b | ||
|
|
8498f42ba0 | ||
|
|
be46edd4ea | ||
|
|
e34d847364 | ||
|
|
50d10f5168 | ||
|
|
a01503c2c3 | ||
|
|
4c40a4c0e5 | ||
|
|
c3f25b6b54 | ||
|
|
e36b2425aa | ||
|
|
d7a0480c2b | ||
|
|
8457c09b5b | ||
|
|
3c31d0ad33 | ||
|
|
70676a98dd | ||
|
|
512802def7 | ||
|
|
87b21782ce | ||
|
|
38ef2f4cb8 | ||
|
|
79706fbe34 | ||
|
|
83d39d0002 | ||
|
|
d81ff295dd | ||
|
|
9bfbafe15b | ||
|
|
b42f04aada | ||
|
|
2ba56ead82 | ||
|
|
be824de52e | ||
|
|
d3084c4ddb | ||
|
|
da7e529502 | ||
|
|
4044c84811 | ||
|
|
44586183fe | ||
|
|
3a47f58382 | ||
|
|
06d81a4604 | ||
|
|
b1f8e9d742 | ||
|
|
609fa38f20 | ||
|
|
f81e95381e | ||
|
|
62f9902298 | ||
|
|
1dd5a33da5 | ||
|
|
8dc2668f44 | ||
|
|
3b289e74c8 | ||
|
|
2244765d87 | ||
|
|
62f53bde55 | ||
|
|
b15e99ca68 | ||
|
|
628152c22c | ||
|
|
f00b6502f6 | ||
|
|
a55a90b922 | ||
|
|
7e0ff1da18 | ||
|
|
eb5102578d | ||
|
|
306e0d687a | ||
|
|
8fb59ba394 | ||
|
|
7b521893d3 | ||
|
|
19e654aed0 | ||
|
|
0d38bc82c4 | ||
|
|
b64e2471fa | ||
|
|
0b5330f7ca | ||
|
|
4e64eac176 | ||
|
|
c90ddf42c3 | ||
|
|
8eb2457ae9 | ||
|
|
2bdb7cb17b | ||
|
|
07906aaea1 | ||
|
|
9109ac53b3 | ||
|
|
47a33128be | ||
|
|
fdb04149aa | ||
|
|
4805f6cd5d | ||
|
|
ff85c8d485 | ||
|
|
ca0d27a929 | ||
|
|
8ebb689ee7 | ||
|
|
ecc81c5f35 | ||
|
|
96c1fcb17c | ||
|
|
840e17e03a | ||
|
|
f744d0d387 | ||
|
|
9c71d24fe3 | ||
|
|
cdc335936c | ||
|
|
303f0aa804 | ||
|
|
bc743cbb1a | ||
|
|
ed0895056d | ||
|
|
985e253954 | ||
|
|
9c175f3e52 | ||
|
|
b9621a67c9 | ||
|
|
9331e7ba4f | ||
|
|
6500f68d86 | ||
|
|
d9914529ca | ||
|
|
6cd82dfcc4 | ||
|
|
e485c119f6 | ||
|
|
1fd1be5576 | ||
|
|
ed06748984 | ||
|
|
02c313aee5 | ||
|
|
af37ce6518 | ||
|
|
ccbe86623a | ||
|
|
796b052bfc | ||
|
|
3ac164ab65 | ||
|
|
4fc569f4a3 | ||
|
|
2c5821e434 | ||
|
|
cbfd6e20bc | ||
|
|
34da664af0 | ||
|
|
c6c44afb76 | ||
|
|
c2d8239911 | ||
|
|
bec6494697 | ||
|
|
29a6b000ac | ||
|
|
dbd2863aab | ||
|
|
426f009ca7 | ||
|
|
ed07b2e231 | ||
|
|
0caa41cc90 | ||
|
|
e93f37dcf0 | ||
|
|
44c3961c46 | ||
|
|
0dcdd038b8 | ||
|
|
eb5d465ac9 | ||
|
|
eb1c87fbf4 | ||
|
|
cbd73a104e | ||
|
|
95ad47368c | ||
|
|
dea3f7cabf | ||
|
|
6a71e9ab1d | ||
|
|
bc56830396 | ||
|
|
1d14f8171d | ||
|
|
2efd380a7e | ||
|
|
475170025a | ||
|
|
f4f3bfe103 | ||
|
|
6827658b4a | ||
|
|
85a3ea0418 | ||
|
|
0b27c60bea | ||
|
|
1a6f373e03 | ||
|
|
0ff13453be | ||
|
|
6b29e26140 | ||
|
|
bbcb4e4dff | ||
|
|
00c8227b8e | ||
|
|
04c44bc470 | ||
|
|
3761d3bb77 | ||
|
|
a76bc02d4a | ||
|
|
3890c30d1f | ||
|
|
1e1407c918 | ||
|
|
be408307aa | ||
|
|
069dafe9ae | ||
|
|
7d54a0c30b | ||
|
|
39fd55146e | ||
|
|
a8323c9a88 | ||
|
|
51d6713940 | ||
|
|
65ed5e7b59 | ||
|
|
2059814394 | ||
|
|
063baa07ee | ||
|
|
24ffb02869 | ||
|
|
370bd71154 | ||
|
|
cb3eb4b09b | ||
|
|
c39e2c137b | ||
|
|
eedaf1c71f | ||
|
|
70e4a84db3 | ||
|
|
443b92dfd3 | ||
|
|
e1be3218b3 | ||
|
|
dfd4ef9347 | ||
|
|
094a22f5e7 | ||
|
|
7333100b1d | ||
|
|
e5d885e2a8 | ||
|
|
592819e028 | ||
|
|
f822ed2e2d | ||
|
|
5726875c59 | ||
|
|
52ee85f17c | ||
|
|
cf5b5f8068 | ||
|
|
ee6b301791 | ||
|
|
b9362f7eca | ||
|
|
36c738bfaa | ||
|
|
a1f955abbe | ||
|
|
9ab4d9e339 | ||
|
|
f51f66697f | ||
|
|
a3e195925a | ||
|
|
9d78070c45 | ||
|
|
4ae31159dc | ||
|
|
3fec5fab41 | ||
|
|
b12e2427a3 | ||
|
|
967d41b8ef | ||
|
|
4776b1857b | ||
|
|
01687ae8e8 | ||
|
|
3089da7282 | ||
|
|
24ae0fe21f | ||
|
|
ad3da6f2c6 | ||
|
|
5057e9a844 | ||
|
|
fea590bf9a | ||
|
|
058bdfef50 | ||
|
|
257a7eccd7 | ||
|
|
443609f5ba | ||
|
|
fde17edf09 | ||
|
|
084c9df65c | ||
|
|
4f9524a4c1 | ||
|
|
1495fb7ee6 | ||
|
|
fa312eec87 | ||
|
|
eb3cf2b77f | ||
|
|
c08cd84bed | ||
|
|
905314cfb5 | ||
|
|
bd3debf025 | ||
|
|
3a3c4b7995 | ||
|
|
f465117435 | ||
|
|
0777b71578 | ||
|
|
a2afdc0295 | ||
|
|
3b6bef3ff0 | ||
|
|
a963171b16 | ||
|
|
e1787f68d5 | ||
|
|
a8697b0187 | ||
|
|
8c8dc2c638 | ||
|
|
54933b427e | ||
|
|
5d05006a23 | ||
|
|
2596b9fa7b | ||
|
|
8c654612a9 | ||
|
|
e836ead399 | ||
|
|
fa691ced5d | ||
|
|
81f4c7741b | ||
|
|
2cde9f7109 | ||
|
|
2632bb883f | ||
|
|
2f75f0cdcb | ||
|
|
deb405f02b | ||
|
|
ee7cbaf2f6 | ||
|
|
7ba7d3563c | ||
|
|
39746123f1 | ||
|
|
c69adb8374 | ||
|
|
f722a6a87b | ||
|
|
b3550bbf55 | ||
|
|
0a18d819af | ||
|
|
2bd4fcb136 | ||
|
|
2a91274d7f | ||
|
|
4fb4927fb8 |
@@ -0,0 +1,6 @@
|
||||
.*
|
||||
Dockerfile
|
||||
LICENSE
|
||||
README.md
|
||||
renovate.json
|
||||
permissions_required.txt
|
||||
@@ -0,0 +1,16 @@
|
||||
# see https://editorconfig.org/
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
@@ -5,19 +5,21 @@ on:
|
||||
branches:
|
||||
- '*'
|
||||
- '!main'
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
uses: https://github.com/papodaca/install-docker-action@v1
|
||||
- name: Log into container registry
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.cheezers.org
|
||||
username: imcompiling
|
||||
@@ -3,19 +3,21 @@ name: build_latest
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
uses: https://github.com/papodaca/install-docker-action@v1
|
||||
- name: Log into container registry
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.cheezers.org
|
||||
username: imcompiling
|
||||
@@ -9,13 +9,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
uses: https://github.com/papodaca/install-docker-action@v1
|
||||
- name: Log into container registry
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.cheezers.org
|
||||
username: imcompiling
|
||||
+3
-5
@@ -124,13 +124,10 @@ dmypy.json
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
|
||||
# logging
|
||||
nextcord.log
|
||||
|
||||
# data file for bot
|
||||
# bot files
|
||||
highscores_data.json
|
||||
highscores_config.json
|
||||
deleted_backups/
|
||||
@@ -139,4 +136,5 @@ TODO.txt
|
||||
sql_tester.py
|
||||
conf
|
||||
outputs
|
||||
database
|
||||
/database
|
||||
dakiny-messages/
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-python.vscode-pylance",
|
||||
"ms-python.python",
|
||||
"ms-python.debugpy",
|
||||
"charliermarsh.ruff",
|
||||
"alexcvzz.vscode-sqlite",
|
||||
"editorconfig.editorconfig"
|
||||
]
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Module",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"module": "dakiny_bot",
|
||||
"justMyCode": true,
|
||||
"env": {
|
||||
"DEBUG": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"aiofiles",
|
||||
"autofilled",
|
||||
"blurple",
|
||||
"CAKEDAY",
|
||||
"cakedays",
|
||||
"CLANLEADER",
|
||||
"Dakiny",
|
||||
"DISCORDMANAGER",
|
||||
"highcouncil",
|
||||
"nextcord"
|
||||
]
|
||||
}
|
||||
+10
-21
@@ -1,26 +1,15 @@
|
||||
FROM python:3.10.6-slim
|
||||
FROM python:3.13.7-slim
|
||||
|
||||
# install dependencies for mysqlclient
|
||||
# RUN apt-get update && apt-get -y upgrade && apt-get -y install python3-dev default-libmysqlclient-dev build-essential
|
||||
# install dependencies
|
||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install git sqlite3
|
||||
|
||||
RUN pip install --upgrade pip
|
||||
# install uv
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.11.21 /uv /uvx /bin/
|
||||
|
||||
COPY . /home
|
||||
|
||||
# Sync the project into a new environment, using the frozen lockfile
|
||||
WORKDIR /home
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
|
||||
COPY config.py config.py
|
||||
COPY dakiny_bot.py dakiny_bot.py
|
||||
COPY utils.py utils.py
|
||||
|
||||
COPY bot_messages bot_messages/
|
||||
COPY classes classes/
|
||||
COPY cogs cogs/
|
||||
COPY database_setup database_setup/
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# remove build deps that aren't needed to run
|
||||
# RUN apt-get -y remove python3-dev build-essential && apt-get -y autoremove
|
||||
|
||||
CMD ["python3", "-u", "./dakiny_bot.py"]
|
||||
CMD ["uv", "run", "--frozen", "--no-dev", "-m", "dakiny_bot"]
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Dakiny Bot
|
||||
|
||||
Bot assumes that it always did the step before it. If the step before an action didn't happen, behavior is undefined.
|
||||
Dakiny clan's own discord bot!
|
||||
|
||||
|
||||
### Assumptions
|
||||
- For Elections: Bot assumes that it always did the step before it. If the step before an action didn't happen, behavior is undefined.
|
||||
Object creation in the middle of a cycle is only there for restarting the bot. All relevant information should already
|
||||
exist in the database.
|
||||
exist in the database.
|
||||
- Bot is running on machine that is usint UTC time. All today() calls specify UTC time zone.
|
||||
@@ -1,7 +0,0 @@
|
||||
Here's the {quarter} Clan Council:
|
||||
|
||||
Dakiny Council:
|
||||
{council}
|
||||
|
||||
Dakiny High Council:
|
||||
{high_council}
|
||||
@@ -1,54 +0,0 @@
|
||||
```fix
|
||||
Dakiny's Clan Council election
|
||||
```
|
||||
Dakiny is an organization built by and for its members. We are a community of people who come together to support each other in the creation of this magical and unique experience. To sustain what we've created here, and to grow and involve into the future, we vote in our leadership every 3 months to provide an opportunity for new clan members to represent their faction of Dakiny in the Clan Council.
|
||||
|
||||
This clan is about human interaction, and the Clan Council positions serve to prop up certain voices within our community, in an effort to shape it as a force for good. Our mission here is to spread love. The more loving Council Members (CMs) we have on the team, the greater the community will grow for all of us to enjoy. There are no term limits, but if you go inactive on RS or become uninterested in pouring your effort into this community, request to step down so that others may contribute where you are no longer able to.
|
||||
|
||||
We want all CMs to grow and succeed. Please, reach out for assistance and advice if you find yourself going even a few days without taking real, actionable steps towards the prosperity of Dakiny. Recruiting, hosting events, participating in the Clan Council Discord, and demonstrating the Core Elements of the position are required from each and every CM to grow a happy and healthy clan.
|
||||
|
||||
__So here's how it works:__
|
||||
---message_break---
|
||||
Each quarter, a channel is created here on Discord for clan members to cast their vote to determine the Clan Council for that 3-month period.
|
||||
|
||||
**Only clan members can vote and all clan members are granted exactly one equally weighted vote.** If you vote twice for different people, your vote will be annulled.
|
||||
|
||||
All clan members are permitted to run for a seat on the Clan Council as long as they:
|
||||
|
||||
**i)** have been in the clan for at least 13 weeks (enough time to have participated in at least one election);
|
||||
|
||||
**ii)** have no warnings under their name in the last 6 months and
|
||||
|
||||
**iii)** have been active in the clan for the past 13 weeks prior to the first day of elections. To be considered active in that timeframe, one must fulfill the following criteria: hosted/participated in at least three clan events, each one in a different week;
|
||||
|
||||
**iv)** are not running under aliases that hide their true identity.
|
||||
|
||||
Candidates are permitted to vote for themselves. Once a candidate reaches 3 votes from clan members, they have earned their seat, meaning no more votes can be cast for them.
|
||||
|
||||
Then, the new Clan Council Elect will come together to select the 2 High Council positions:
|
||||
RuneScape 3 Clan Leader
|
||||
Discord Server Manager
|
||||
|
||||
The Clan Council will be denoted by the Discord ranks of <@&{clan_council_id}> and <@&{high_council_id}> and in-game with the following ranks.
|
||||
<:Rank_Admin:479008185240518656> Admin
|
||||
<:Rank_Organiser:479008215024009216> Organizer
|
||||
<:Rank_Coordinator:479008238654849045> Coordinator
|
||||
<:Rank_Overseer:479008269382451201> Overseer
|
||||
<:Rank_Deputy:479008295319896064> Deputy Owner
|
||||
<:Rank_Owner:479008325137072155> Clan Leader
|
||||
---message_break---
|
||||
__Here's the timeline:__
|
||||
Election begins: {election_start}
|
||||
Term: {term_start} - {term_end}
|
||||
|
||||
**{election_start}**: Post here to announce candidacy
|
||||
**{voting_start}**: Voting begins
|
||||
**{voting_end}**: Votes are tallied and winners are announced
|
||||
**{highcouncil_election}**: The new Clan Council votes who among them shall receive the two High Council positions of: Clan Leader and Discord Server Manager.
|
||||
**{term_start}**: The new Clan Council is officially inaugurated and a drop party (or a giveaway event) begins to commemorate the new leadership.
|
||||
|
||||
This process will begin again next quarter on {next_election_start} with the inauguration scheduled for {term_end}.
|
||||
---message_break---
|
||||
**You may now announce your candidacy for a seat on the Dakiny Clan Council!
|
||||
**
|
||||
You may include a speech with your announcement, as well as specific pertinent facts such as total recruits, time in the clan, past Clan Council experience, and donations made. This data is available upon request via <@&{clan_council_id}>.
|
||||
@@ -1,12 +0,0 @@
|
||||
`Leadership Elections - candidacy time`
|
||||
|
||||
|
||||
<@&{clan_council_elect_role_id}>, welcome. We are starting the second part of our elections. On {highcouncil_election_announce} this channel will be open to write for all of you. Everyone else will be able to read this channel, but not write in it. Only members of the Clan Council Elected (CCE) can vote now. Any votes from others will be annulled.
|
||||
|
||||
From {highcouncil_election_announce} to {highcouncil_election_start}, you will be able to announce your candidacy for High Council. The positions are:
|
||||
Clan Leader
|
||||
Discord Server Manager
|
||||
|
||||
Each member of the CCE can vote once in each category (Discord Server Manager and Clan Leader). Alternatively, you may choose to intentionally abstain.
|
||||
|
||||
Votes can be cast until {highcouncil_election_end}, so we can announce and have everyone set up to start the term by {term_start}.
|
||||
@@ -1 +0,0 @@
|
||||
<@&{clan_council_elect_role_id}> it is now time to vote for the high council! You have until {term_start} to complete the vote.
|
||||
@@ -1,14 +0,0 @@
|
||||
====================
|
||||
<@&{clan_member_id}>, it's time to vote for clan council.
|
||||
|
||||
Press the Vote button to vote!
|
||||
Voting ends next {voting_end_day}, {voting_end}.
|
||||
Results will then be announced.
|
||||
|
||||
After a candidate receives 3 votes, their spot is secured in the new council, but you can still vote for them to show your support.
|
||||
|
||||
**Just a reminder:** only the people listed below are eligible to vote, and each clan member may **only vote for one person**. Votes from guests, diplomats, or allies will be annulled.
|
||||
Votes for multiple candidates from the same person will not be counted.
|
||||
|
||||
RS3 Clan Members
|
||||
OSRS Clan Members
|
||||
@@ -1,154 +0,0 @@
|
||||
"""
|
||||
Contains various views to be used while voting. Controls the logic when performing the vote.
|
||||
"""
|
||||
|
||||
from typing import List
|
||||
|
||||
import nextcord
|
||||
from nextcord import SelectOption
|
||||
from nextcord.interactions import Interaction
|
||||
from sqlalchemy import exc, select, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import (
|
||||
CouncilMembers,
|
||||
ElectionInformation,
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from utils import build_votes_str, get_election_cycle_name
|
||||
|
||||
|
||||
class VoteSelect(nextcord.ui.StringSelect):
|
||||
def __init__(self, options: List["SelectOption"], config: DakinyConfig) -> None:
|
||||
super().__init__(
|
||||
placeholder="Choose 1",
|
||||
min_values=1,
|
||||
max_values=1,
|
||||
options=options,
|
||||
)
|
||||
self.config = config
|
||||
|
||||
async def callback(self, interaction: Interaction):
|
||||
election_name = get_election_cycle_name(self.config)
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation.CouncilVoteMsgId).where(
|
||||
ElectionInformation.ElectionCycle == election_name
|
||||
)
|
||||
vote_msg_id = session.scalar(stmt)
|
||||
|
||||
if self.values[0] == "Abstain":
|
||||
voted_for = None
|
||||
else:
|
||||
voted_for = int(self.values[0])
|
||||
|
||||
new_vote = Votes(
|
||||
ElectionCycle=election_name,
|
||||
VoterId=interaction.user.id,
|
||||
VotedForId=voted_for,
|
||||
)
|
||||
|
||||
try:
|
||||
session.add(new_vote)
|
||||
session.commit()
|
||||
|
||||
except exc.IntegrityError:
|
||||
session.rollback()
|
||||
stmt = (
|
||||
update(Votes)
|
||||
.where(Votes.ElectionCycle == election_name)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
.values(VotedForId=voted_for)
|
||||
)
|
||||
session.execute(stmt)
|
||||
session.commit()
|
||||
|
||||
vote_message_str = build_votes_str(self.config)
|
||||
vote_msg: nextcord.Message = await interaction.channel.fetch_message(
|
||||
vote_msg_id
|
||||
)
|
||||
await vote_msg.edit(content=vote_message_str)
|
||||
|
||||
if voted_for is not None:
|
||||
msg = f"You have voted for <@{voted_for}>"
|
||||
else:
|
||||
msg = "You have abstained from voting."
|
||||
|
||||
await interaction.edit(content=msg, view=None)
|
||||
|
||||
|
||||
class VoteView(nextcord.ui.View):
|
||||
"""
|
||||
The button to press to start your nomination.
|
||||
"""
|
||||
|
||||
def __init__(self, config: DakinyConfig, guild: nextcord.Guild):
|
||||
super().__init__(timeout=None)
|
||||
self.config = config
|
||||
self.guild = guild
|
||||
|
||||
@nextcord.ui.button(
|
||||
label="Vote", style=nextcord.ButtonStyle.primary, custom_id="vote"
|
||||
)
|
||||
async def vote(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
) -> None:
|
||||
"""
|
||||
Enforces only members vote. Gets election cycle, creates voting options (checking if user has voted already),
|
||||
then sends the voting view.
|
||||
|
||||
Args:
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
|
||||
# enforce members only
|
||||
if (
|
||||
self.guild.get_role(self.config.params.clan_member_role_id)
|
||||
not in interaction.user.roles
|
||||
):
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{self.config.params.clan_member_role_id}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
election: str = get_election_cycle_name(self.config)
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionCycle == election)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
)
|
||||
voted_for = session.scalar(stmt)
|
||||
|
||||
stmt = select(CouncilMembers.MemberId).where(
|
||||
CouncilMembers.ElectionCycle == election
|
||||
)
|
||||
|
||||
options = [
|
||||
SelectOption(
|
||||
label=f"{self.guild.get_member(nominee).display_name} ☑️"
|
||||
if voted_for == nominee
|
||||
else f"{self.guild.get_member(nominee).display_name}",
|
||||
value=str(nominee),
|
||||
)
|
||||
for nominee in session.scalars(stmt)
|
||||
]
|
||||
options.append(
|
||||
SelectOption(
|
||||
label="Abstain ☑️" if voted_for is None else "Abstain",
|
||||
value="Abstain",
|
||||
)
|
||||
)
|
||||
|
||||
view = nextcord.ui.View()
|
||||
view.add_item(VoteSelect(options=options, config=self.config))
|
||||
|
||||
await interaction.response.send_message(
|
||||
content="Please vote for a clan member!",
|
||||
view=view,
|
||||
ephemeral=True,
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
"""
|
||||
Cog loader. Adds all command cogs to the bot.
|
||||
"""
|
||||
|
||||
from nextcord.ext import commands
|
||||
|
||||
from cogs.commands.request import RequestCog
|
||||
from cogs.commands.set import setCog
|
||||
from cogs.commands.test import TestCog
|
||||
from cogs.commands.view import ViewCog
|
||||
|
||||
|
||||
# This function will be called when this extension is loaded.
|
||||
# It is necessary to add these functions to the bot.
|
||||
def setup(bot: commands.Bot):
|
||||
"""
|
||||
Adds all command classes to bot.
|
||||
"""
|
||||
|
||||
bot.add_cog(RequestCog(bot))
|
||||
bot.add_cog(TestCog(bot))
|
||||
bot.add_cog(setCog())
|
||||
bot.add_cog(ViewCog())
|
||||
@@ -1,141 +0,0 @@
|
||||
"""
|
||||
Commands for testing.
|
||||
"""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import application_checks, commands
|
||||
|
||||
from classes.election_cycle import ElectionCycle
|
||||
from config import DakinyConfig
|
||||
from utils import get_current_cycle
|
||||
|
||||
|
||||
def is_me():
|
||||
"""
|
||||
predicate that makes sure only I can run the test commands.
|
||||
"""
|
||||
|
||||
def predicate(interaction: nextcord.Interaction):
|
||||
return interaction.user.id == 206602713511886849
|
||||
|
||||
return application_checks.check(predicate)
|
||||
|
||||
|
||||
class TestCog(commands.Cog, name="Test commands."):
|
||||
"""
|
||||
Class holds commands for testing.
|
||||
"""
|
||||
|
||||
def __init__(self, bot) -> None:
|
||||
"""
|
||||
Default constructor for HelpCog class. Does nothing.
|
||||
"""
|
||||
self.bot = bot
|
||||
|
||||
@nextcord.slash_command(guild_ids=[1000247361639030804])
|
||||
async def test(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Parent slash command for help. Never called.
|
||||
"""
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def election_start(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
idc
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): _description_
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.election_start_action()
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def voting_start(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
tests the voting start action
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): _description_
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.voting_start_action()
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def voting_end(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
tests the voting start action
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): _description_
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.voting_end_action()
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def highcouncil_vote(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
tests the voting start action
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): _description_
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.highcouncil_election_start_action()
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def election_reminder(self, interaction: nextcord.Interaction):
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.election_reminder()
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def daily(self, interaction: nextcord.Interaction):
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.check_date()
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def term_start(self, interaction: nextcord.Interaction):
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
)
|
||||
await cycle.term_start_action()
|
||||
@@ -1,96 +0,0 @@
|
||||
"""
|
||||
Commands for viewing information in the database.
|
||||
"""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from database_setup.sql_data_classes import ElectionInformation, Votes, engine
|
||||
|
||||
|
||||
class ViewCog(commands.Cog, name="View Commands"):
|
||||
"""
|
||||
Holds the view commands.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
Default constructor for ViewCog class. Does nothing.
|
||||
"""
|
||||
|
||||
@nextcord.slash_command()
|
||||
async def view(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Parent slash command for set. Never called.
|
||||
"""
|
||||
|
||||
@view.subcommand(
|
||||
description="Shows all voters and who they voted for in a given election."
|
||||
)
|
||||
async def votes(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
election_name: str = nextcord.SlashOption(
|
||||
required=True, description="The election you want to view votes for."
|
||||
),
|
||||
):
|
||||
"""
|
||||
Takes in an election name and sends a response message to the user with a list of people who voted in that
|
||||
election and who they voted for. Notes those tho abstained. Tells a user if the election is invalid. Uses
|
||||
autocompletion to assist with getting elections.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): User's interaction with the command.
|
||||
election_name (str): Is SlashOption. The name of the election to view votes for.
|
||||
"""
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionCycle == election_name)
|
||||
|
||||
with Session(engine) as session:
|
||||
# Check if election exists.
|
||||
if session.scalar(stmt) is None:
|
||||
await interaction.response.send_message(
|
||||
f"Invalid election: {election_name}.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
votes = session.scalars(stmt)
|
||||
content = ""
|
||||
for vote in votes:
|
||||
content += (
|
||||
f"<@{vote.VoterId}> voted for <@{vote.VotedForId}>.\n"
|
||||
if vote.VotedForId is not None
|
||||
else f"<@{vote.VoterId}> abstained from voted.\n"
|
||||
)
|
||||
|
||||
await interaction.response.send_message(content=content, ephemeral=True)
|
||||
|
||||
@votes.on_autocomplete("election_name")
|
||||
async def election_autocomplete(
|
||||
self, interaction: nextcord.Interaction, election_name: str
|
||||
):
|
||||
"""
|
||||
Collects all elections that start with the election string.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
election_name (str): String to run autocomplete on.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation.ElectionCycle)
|
||||
elections = session.scalars(stmt)
|
||||
|
||||
# if empty compare string
|
||||
if not election_name:
|
||||
await interaction.response.send_autocomplete(elections)
|
||||
return
|
||||
|
||||
autofilled_elections: "list[str]" = [
|
||||
election
|
||||
for election in elections
|
||||
if election.lower().startswith(election_name.lower())
|
||||
]
|
||||
await interaction.response.send_autocomplete(autofilled_elections[:25])
|
||||
@@ -1,17 +0,0 @@
|
||||
"""
|
||||
Initializing code for all loops.
|
||||
"""
|
||||
|
||||
from nextcord.ext import commands
|
||||
|
||||
from cogs.loops.bot_presence import BotPresence
|
||||
from cogs.loops.daily_loop import DailyLoop
|
||||
|
||||
|
||||
def setup(bot: commands.Bot):
|
||||
"""
|
||||
Adds functions to bot.
|
||||
"""
|
||||
|
||||
bot.add_cog(BotPresence(bot))
|
||||
bot.add_cog(DailyLoop(bot))
|
||||
@@ -1,120 +0,0 @@
|
||||
"""
|
||||
Defines the daily loop that runs the Dakiny bot functions.
|
||||
"""
|
||||
|
||||
import random
|
||||
from datetime import datetime, time
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands, tasks
|
||||
from pytz import timezone
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from classes.election_cycle import ElectionCycle
|
||||
from config import DakinyConfig
|
||||
from dakiny_bot import birthday_list
|
||||
from database_setup.sql_data_classes import UserBirthday, engine
|
||||
from utils import get_current_cycle
|
||||
|
||||
|
||||
class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
"""
|
||||
Class for performing daily functions.
|
||||
"""
|
||||
|
||||
def __init__(self, bot: commands.Bot) -> None:
|
||||
self.bot = bot
|
||||
self.current_election = None
|
||||
self.update_birthdays()
|
||||
|
||||
# pylint doesn't recognize that daily_loop is subclassed from tasks.loop.
|
||||
self.daily_loop.start() # pylint: disable=no-member
|
||||
|
||||
@tasks.loop(time=time(hour=0, tzinfo=timezone("GMT")))
|
||||
async def daily_loop(self):
|
||||
"""
|
||||
Runs daily. Checks if the current election is None. If so, checks if there is an active election. If there is
|
||||
an active election, runs the check_date() function for the election to perform actions. Finally checks if the
|
||||
election is over to delete the current election object.
|
||||
"""
|
||||
|
||||
if self.current_election is None:
|
||||
self.current_election = self.get_election_cycle()
|
||||
|
||||
if self.current_election is not None:
|
||||
await self.current_election.check_date()
|
||||
if self.current_election.election_over:
|
||||
self.current_election = None
|
||||
|
||||
self.update_birthdays()
|
||||
|
||||
if 239547993106284544 in birthday_list:
|
||||
# inform kandy that it is her "birthday"
|
||||
kandy: nextcord.User = await self.bot.fetch_user(239547993106284544)
|
||||
await kandy.send('Happy "Birthday"!')
|
||||
|
||||
await self.cakedays()
|
||||
|
||||
@daily_loop.before_loop
|
||||
async def before_loop(self):
|
||||
"""
|
||||
Actions run before the loop starts. Want to wait for bot to be ready and get the current cycle.
|
||||
"""
|
||||
|
||||
await self.bot.wait_until_ready()
|
||||
|
||||
# Bot needs to know guilds to get the current cycle.
|
||||
self.current_election = self.get_election_cycle()
|
||||
|
||||
def get_election_cycle(self) -> ElectionCycle:
|
||||
"""
|
||||
Creates an object for the current election cycle if one is active. An election is considered active
|
||||
between the election start and the term start.
|
||||
|
||||
Returns:
|
||||
ElectionCycle: Current election cycle, None if there is no election happening.
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = get_current_cycle(config)
|
||||
|
||||
return ElectionCycle(cycle, config, self.bot.get_guild(config.params.guild_id))
|
||||
|
||||
def update_birthdays(self) -> None:
|
||||
"""
|
||||
Goes through database to collect all birthdays that are today. Adds user's id to birthday list.
|
||||
"""
|
||||
birthday_list.clear()
|
||||
|
||||
# kandy's 1% chance
|
||||
if random.randint(0, 99) == 0:
|
||||
birthday_list.append(239547993106284544)
|
||||
|
||||
today = datetime.today()
|
||||
birthday = f"{today.month}/{today.day}"
|
||||
|
||||
stmt = select(UserBirthday.UserId).where(UserBirthday.Birthday == birthday)
|
||||
with Session(engine) as session:
|
||||
to_add = session.scalars(stmt)
|
||||
birthday_list.extend(to_add.all())
|
||||
|
||||
async def cakedays(self) -> None:
|
||||
"""
|
||||
Loops through the guild's humans checking for joined_at dates that match today's date. Sends a message
|
||||
saying happy cakeday.
|
||||
"""
|
||||
|
||||
today = datetime.today()
|
||||
guild: nextcord.Guild = self.bot.get_guild(self.bot.config.params.guild_id)
|
||||
announce_channel: nextcord.TextChannel = guild.get_channel(self.bot.config.params.general_channel_id)
|
||||
|
||||
cakedays: list[nextcord.Member] = [
|
||||
human for human in guild.humans if human.joined_at.month == today.month and human.joined_at.day == today.day
|
||||
]
|
||||
|
||||
for member in cakedays:
|
||||
years = today.year - member.joined_at.year
|
||||
year_str = "years" if years > 1 else "year"
|
||||
msg = f"Happy Cake day! <@{member.id}> joined the discord {years} {year_str} ago!"
|
||||
await announce_channel.send(msg)
|
||||
@@ -1,50 +0,0 @@
|
||||
"""
|
||||
File contains classes defining the Hydra configuraton structure.
|
||||
"""
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Params:
|
||||
"""
|
||||
Class defines the various configuration parameters.
|
||||
"""
|
||||
|
||||
admin_channel_id: int # might want to rename this...
|
||||
announcement_category_id: int
|
||||
clan_council_elect_role_id: int
|
||||
clan_council_role_id: int
|
||||
clan_info_channel_id: int
|
||||
clan_member_role_id: int
|
||||
discord_token: str
|
||||
general_channel_id: int
|
||||
guild_id: int
|
||||
high_council_role_id: int
|
||||
voting_parent_id: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class ElectionCycle:
|
||||
"""
|
||||
Class defines relevant election dates.
|
||||
"""
|
||||
|
||||
election_start: str
|
||||
highcouncil_election_announce: str
|
||||
highcouncil_election_end: str
|
||||
highcouncil_election_start: str
|
||||
name: str
|
||||
term_end: str
|
||||
term_start: str
|
||||
voting_end: str
|
||||
voting_start: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class DakinyConfig:
|
||||
"""
|
||||
Class defines all configs required for Dakiny Bot.
|
||||
"""
|
||||
|
||||
election_cycles: list[ElectionCycle]
|
||||
params: Params
|
||||
@@ -1,72 +0,0 @@
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import hydra
|
||||
import nextcord
|
||||
from hydra.core.config_store import ConfigStore
|
||||
from nextcord.ext import commands
|
||||
|
||||
import database_setup.create_database as create_database
|
||||
from classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||
from classes.nominate_views import NominateView
|
||||
from classes.voting_highcouncil_views import VoteHighcouncilView
|
||||
from classes.voting_views import VoteView
|
||||
from config import DakinyConfig
|
||||
|
||||
cs = ConfigStore.instance()
|
||||
cs.store(name="dakiny_config", node=DakinyConfig)
|
||||
|
||||
birthday_list: list[int] = []
|
||||
|
||||
logger = logging.getLogger("nextcord")
|
||||
logger.setLevel(logging.DEBUG)
|
||||
handler = logging.FileHandler(filename="nextcord.log", encoding="utf-8", mode="w")
|
||||
handler.setFormatter(
|
||||
logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
|
||||
)
|
||||
logger.addHandler(handler)
|
||||
|
||||
|
||||
@hydra.main(config_path="conf", config_name="config")
|
||||
def main(cfg: DakinyConfig):
|
||||
# Allows privledged intents for monitoring members joining, roles editing, and role assignments
|
||||
# These need to be enabled in the developer portal as well
|
||||
intents = nextcord.Intents.default()
|
||||
|
||||
# Required in order to read messages (eg. prefix commands)
|
||||
intents.message_content = True
|
||||
|
||||
# To enable the guilds priveleged intent:
|
||||
# intents.guilds = True
|
||||
|
||||
# To enable the members priveleged intent:
|
||||
intents.members = True
|
||||
|
||||
bot = commands.Bot(intents=intents)
|
||||
bot.config = cfg
|
||||
|
||||
# Get the modules of all cogs whose directory structure is ./cogs/<module_name>
|
||||
for folder in os.listdir("cogs"):
|
||||
bot.load_extension(f"cogs.{folder}")
|
||||
|
||||
@bot.listen()
|
||||
async def on_ready():
|
||||
"""When Discord is connected"""
|
||||
assert bot.user is not None
|
||||
create_database # pylint: disable=pointless-statement
|
||||
bot.add_view(NominateView(cfg, bot.get_guild(cfg.params.guild_id)))
|
||||
bot.add_view(NominateHighCouncilView(cfg, bot.get_guild(cfg.params.guild_id)))
|
||||
bot.add_view(VoteView(cfg, bot.get_guild(cfg.params.guild_id)))
|
||||
bot.add_view(VoteHighcouncilView(cfg, bot.get_guild(cfg.params.guild_id)))
|
||||
print(f"{bot.user.name} has connected to Discord!")
|
||||
|
||||
# Run Discord bot
|
||||
bot.run(bot.config.params.discord_token)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.argv.append("hydra.job.chdir=False")
|
||||
sys.argv.append("hydra/job_logging=none")
|
||||
sys.argv.append("hydra/hydra_logging=none")
|
||||
main() # pylint: disable=no-value-for-parameter
|
||||
@@ -0,0 +1,87 @@
|
||||
"""File contains classes defining Dakiny settings structure."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from dataclass_wizard import YAMLWizard
|
||||
|
||||
CONFIG_LOCATION = "conf/config.yaml"
|
||||
|
||||
|
||||
@dataclass
|
||||
class ChannelIds:
|
||||
"""Class holds all channel ids needed by bot."""
|
||||
|
||||
admin: int # might want to rename this...
|
||||
announcement: int
|
||||
clan_info: int
|
||||
event_post: int
|
||||
general: int
|
||||
voting: int
|
||||
ban: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class Election:
|
||||
"""Class defines relevant election dates."""
|
||||
|
||||
active: bool
|
||||
election_start: str
|
||||
highcouncil_election_announce: str
|
||||
highcouncil_election_end: str
|
||||
highcouncil_election_start: str
|
||||
name: str
|
||||
term_end: str
|
||||
term_start: str
|
||||
voting_end: str
|
||||
voting_start: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Params:
|
||||
"""Class defines start parameters that shouldn't be changed."""
|
||||
|
||||
discord_token: str
|
||||
git_branch: str
|
||||
guild_id: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class PointSettings:
|
||||
"""Class defines point settings editable by Clan Council."""
|
||||
|
||||
clan_points: int
|
||||
clan_points_weekly_limit: int
|
||||
events_weekly_limit: int
|
||||
host_points: int
|
||||
participate_points: int
|
||||
verify_clan_points: bool
|
||||
verify_events: bool
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoleIds:
|
||||
"""Class holds all role ids needed by bot."""
|
||||
|
||||
clan_council: int
|
||||
clan_council_elect: int
|
||||
clan_member: int
|
||||
event_host: int
|
||||
high_council: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class DakinySettings(YAMLWizard):
|
||||
"""Class defines all configs required for Dakiny Bot."""
|
||||
|
||||
channel_ids: ChannelIds
|
||||
election_cycles: list[Election]
|
||||
params: Params
|
||||
point_settings: PointSettings
|
||||
role_ids: RoleIds
|
||||
|
||||
def save(self) -> None:
|
||||
"""Saves settings to the yaml file."""
|
||||
self.to_yaml_file(CONFIG_LOCATION)
|
||||
|
||||
|
||||
settings = DakinySettings.from_yaml_file(CONFIG_LOCATION)
|
||||
@@ -0,0 +1 @@
|
||||
"""Empty init file for dakiny_bot module."""
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Starts the app for dakiny_bot."""
|
||||
|
||||
import logging
|
||||
|
||||
from .app import run
|
||||
|
||||
nextcord_logger = logging.getLogger("nextcord")
|
||||
nextcord_logger.setLevel(logging.DEBUG)
|
||||
nextcord_handler = logging.FileHandler(filename="nextcord.log", encoding="utf-8", mode="w")
|
||||
nextcord_handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
|
||||
nextcord_logger.addHandler(nextcord_handler)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Main file for bot."""
|
||||
|
||||
import os
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||
from dakiny_bot.classes.nominate_views import NominateView
|
||||
from dakiny_bot.classes.voting_highcouncil_views import VoteHighcouncilView
|
||||
from dakiny_bot.classes.voting_views import VoteView
|
||||
from dakiny_bot.database import create_database
|
||||
|
||||
from .DakinySettings import settings
|
||||
|
||||
birthday_list: list[int] = []
|
||||
|
||||
|
||||
def run() -> None:
|
||||
"""Builds and runs bot."""
|
||||
# Allows privileged intents for monitoring members joining, roles editing, and role assignments
|
||||
# These need to be enabled in the developer portal as well
|
||||
intents = nextcord.Intents.default()
|
||||
|
||||
# Required in order to read messages (eg. prefix commands)
|
||||
intents.message_content = True
|
||||
|
||||
# To enable the members privileged intent:
|
||||
intents.members = True
|
||||
|
||||
bot = commands.Bot(intents=intents)
|
||||
|
||||
# Get the modules of all cogs whose directory structure is ./cogs/<module_name>
|
||||
for folder in os.listdir("dakiny_bot/cogs"):
|
||||
bot.load_extension(f"dakiny_bot.cogs.{folder}")
|
||||
|
||||
@bot.listen()
|
||||
async def on_ready() -> None:
|
||||
"""When Discord is connected."""
|
||||
assert bot.user is not None # noqa: S101 documentation does this
|
||||
create_database # noqa: B018
|
||||
bot.add_view(NominateView(bot.get_guild(settings.params.guild_id)))
|
||||
bot.add_view(NominateHighCouncilView(bot.get_guild(settings.params.guild_id)))
|
||||
bot.add_view(VoteView(bot.get_guild(settings.params.guild_id)))
|
||||
bot.add_view(VoteHighcouncilView(bot.get_guild(settings.params.guild_id)))
|
||||
print(f"{bot.user.name} has connected to Discord!") # noqa: T201 TODO make logging to print my stuff to console
|
||||
|
||||
# Run Discord bot
|
||||
bot.run(settings.params.discord_token)
|
||||
@@ -1,68 +1,64 @@
|
||||
"""
|
||||
Contains the election cycle class
|
||||
"""
|
||||
"""Contains the election cycle class."""
|
||||
|
||||
import collections
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
import nextcord
|
||||
from sqlalchemy import select, true
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||
from classes.nominate_views import NominateView
|
||||
from classes.voting_highcouncil_views import VoteHighcouncilView
|
||||
from classes.voting_views import VoteView
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import (
|
||||
from dakiny_bot.classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||
from dakiny_bot.classes.nominate_views import NominateView
|
||||
from dakiny_bot.classes.voting_highcouncil_views import VoteHighcouncilView
|
||||
from dakiny_bot.classes.voting_views import VoteView
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import (
|
||||
CouncilMembers,
|
||||
ElectionInformation,
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from utils import (
|
||||
from dakiny_bot.logger import dakiny_logger
|
||||
from dakiny_bot.utils import (
|
||||
TEMPLATES_DIR,
|
||||
VoteType,
|
||||
build_highcouncil_votes_str,
|
||||
build_votes_str,
|
||||
get_cl_election_name,
|
||||
edit_clan_council_info,
|
||||
get_datetime,
|
||||
get_dm_election_name,
|
||||
get_election_cycle_name,
|
||||
get_election_name,
|
||||
)
|
||||
from sqlalchemy import select, true, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
REQUIRED_VOTES_TO_BE_ELECTED = 3
|
||||
|
||||
|
||||
class ElectionCycle:
|
||||
class Election:
|
||||
"""
|
||||
Election class.
|
||||
|
||||
This class represents all the dates required for an election cycle along with all the functions needed to operate
|
||||
the cycle.
|
||||
"""
|
||||
|
||||
def __init__(self, cycle: int, config: DakinyConfig, guild: nextcord.Guild) -> None:
|
||||
def __init__(self, cycle: int, guild: nextcord.Guild) -> None:
|
||||
"""
|
||||
Generates all dates relevant to the election cycle determined by the config and cycle.
|
||||
|
||||
Args:
|
||||
cycle (int): Which election cycle this cycle is.
|
||||
config (DakinyConfig): The entire config object.
|
||||
guild (nextcord.Guild): The guild that this election is running in.
|
||||
"""
|
||||
|
||||
self.config: DakinyConfig = config
|
||||
self.cycle = cycle
|
||||
self.election_cycle = self.config.election_cycles[self.cycle]
|
||||
self.election_cycle = settings.election_cycles[self.cycle]
|
||||
self.active = self.election_cycle.active
|
||||
self.election_start: datetime = get_datetime(self.election_cycle.election_start)
|
||||
self.term_start: datetime = get_datetime(self.election_cycle.term_start)
|
||||
self.term_end: datetime = get_datetime(self.election_cycle.term_end)
|
||||
self.voting_start: datetime = get_datetime(self.election_cycle.voting_start)
|
||||
self.voting_end: datetime = get_datetime(self.election_cycle.voting_end)
|
||||
self.highcouncil_election_announce: datetime = get_datetime(
|
||||
self.election_cycle.highcouncil_election_announce
|
||||
)
|
||||
self.highcouncil_election_start: datetime = get_datetime(
|
||||
self.election_cycle.highcouncil_election_start
|
||||
)
|
||||
self.highcouncil_election_end: datetime = get_datetime(
|
||||
self.election_cycle.highcouncil_election_end
|
||||
)
|
||||
self.highcouncil_election_announce: datetime = get_datetime(self.election_cycle.highcouncil_election_announce)
|
||||
self.highcouncil_election_start: datetime = get_datetime(self.election_cycle.highcouncil_election_start)
|
||||
self.highcouncil_election_end: datetime = get_datetime(self.election_cycle.highcouncil_election_end)
|
||||
self.guild: nextcord.Guild = guild
|
||||
self.election_over: bool = False
|
||||
|
||||
@@ -74,21 +70,16 @@ class ElectionCycle:
|
||||
list[str]: A list of message contents in the correct order. Must be a string because the message is too
|
||||
long.
|
||||
"""
|
||||
|
||||
with open(
|
||||
"bot_messages/election_announcement.txt", mode="r", encoding="utf8"
|
||||
) as file:
|
||||
with Path(f"{TEMPLATES_DIR}/election_announcement.txt", encoding="utf8").open() as file:
|
||||
message = file.read()
|
||||
|
||||
next_election = get_datetime(
|
||||
self.config.election_cycles[
|
||||
(self.cycle + 1) % len(self.config.election_cycles)
|
||||
].election_start
|
||||
settings.election_cycles[(self.cycle + 1) % len(settings.election_cycles)].election_start
|
||||
)
|
||||
|
||||
message = message.format(
|
||||
clan_council_id=self.config.params.clan_council_role_id,
|
||||
high_council_id=self.config.params.high_council_role_id,
|
||||
clan_council_id=settings.role_ids.clan_council,
|
||||
high_council_id=settings.role_ids.high_council,
|
||||
election_start=self.election_start.strftime("%B %d"),
|
||||
term_start=self.term_start.strftime("%B %d"),
|
||||
term_end=self.term_end.strftime("%B %d"),
|
||||
@@ -107,23 +98,14 @@ class ElectionCycle:
|
||||
Returns:
|
||||
str: Message to send.
|
||||
"""
|
||||
|
||||
with open(
|
||||
"bot_messages/highcouncil_election.txt", mode="r", encoding="utf8"
|
||||
) as file:
|
||||
with Path(f"{TEMPLATES_DIR}/highcouncil_election.txt", encoding="utf8").open() as file:
|
||||
message = file.read()
|
||||
|
||||
return message.format(
|
||||
clan_council_elect_role_id=self.config.params.clan_council_elect_role_id,
|
||||
highcouncil_election_announce=self.highcouncil_election_announce.strftime(
|
||||
"%B %d"
|
||||
),
|
||||
highcouncil_election_start=self.highcouncil_election_start.strftime(
|
||||
"%B %d"
|
||||
),
|
||||
highcouncil_election_end=self.highcouncil_election_end.strftime(
|
||||
"%B %d"
|
||||
),
|
||||
clan_council_elect_role_id=settings.role_ids.clan_council_elect,
|
||||
highcouncil_election_announce=self.highcouncil_election_announce.strftime("%B %d"),
|
||||
highcouncil_election_start=self.highcouncil_election_start.strftime("%B %d"),
|
||||
highcouncil_election_end=self.highcouncil_election_end.strftime("%B %d"),
|
||||
term_start=self.term_start.strftime("%B %d"),
|
||||
)
|
||||
|
||||
@@ -134,14 +116,11 @@ class ElectionCycle:
|
||||
Returns:
|
||||
str: Message to send.
|
||||
"""
|
||||
|
||||
with open(
|
||||
"bot_messages/highcouncil_vote.txt", mode="r", encoding="utf8"
|
||||
) as file:
|
||||
with Path(f"{TEMPLATES_DIR}/highcouncil_vote.txt", encoding="utf8").open() as file:
|
||||
message = file.read()
|
||||
|
||||
return message.format(
|
||||
clan_council_elect_role_id=self.config.params.clan_council_elect_role_id,
|
||||
clan_council_elect_role_id=settings.role_ids.clan_council_elect,
|
||||
term_start=self.term_start.strftime("%B %d"),
|
||||
)
|
||||
|
||||
@@ -152,58 +131,52 @@ class ElectionCycle:
|
||||
Returns:
|
||||
str: Message to send
|
||||
"""
|
||||
|
||||
with open("bot_messages/vote_start.txt", mode="r", encoding="utf8") as file:
|
||||
with Path(f"{TEMPLATES_DIR}/vote_start.txt", encoding="utf8").open() as file:
|
||||
message = file.read()
|
||||
vote_end: datetime = get_datetime(
|
||||
self.config.election_cycles[self.cycle].voting_end
|
||||
)
|
||||
vote_end: datetime = get_datetime(settings.election_cycles[self.cycle].voting_end)
|
||||
|
||||
return message.format(
|
||||
clan_member_id=self.config.params.clan_member_role_id,
|
||||
clan_member_id=settings.role_ids.clan_member,
|
||||
voting_end=vote_end.strftime("%B %d"),
|
||||
voting_end_day=vote_end.strftime("%A"),
|
||||
)
|
||||
|
||||
async def check_date(self) -> None:
|
||||
"""
|
||||
Function checks current date to see if something needs to be run.
|
||||
"""
|
||||
today = datetime.today()
|
||||
"""Function checks current date to see if something needs to be run."""
|
||||
today = datetime.now(tz=UTC)
|
||||
dakiny_logger.debug("Checking date.")
|
||||
|
||||
# check all dates if action is needed
|
||||
if today.date() == self.election_start.date():
|
||||
dakiny_logger.debug("Election start.")
|
||||
await self.election_start_action()
|
||||
elif today.date() == self.voting_start.date():
|
||||
dakiny_logger.debug("Voting start.")
|
||||
await self.voting_start_action()
|
||||
elif (
|
||||
(self.voting_end - timedelta(3)).date()
|
||||
<= today.date()
|
||||
< self.voting_end.date()
|
||||
):
|
||||
elif (self.voting_end - timedelta(3)).date() <= today.date() < self.voting_end.date():
|
||||
dakiny_logger.debug("Election reminder.")
|
||||
await self.election_reminder()
|
||||
elif today.date() == self.voting_end.date():
|
||||
dakiny_logger.debug("Voting end.")
|
||||
await self.voting_end_action()
|
||||
elif today.date() == self.highcouncil_election_start.date():
|
||||
dakiny_logger.debug("Highcouncil election start.")
|
||||
await self.highcouncil_election_start_action()
|
||||
elif today.date() == self.term_start.date():
|
||||
dakiny_logger.debug("Term start")
|
||||
await self.term_start_action()
|
||||
else:
|
||||
dakiny_logger.warning("Check date didn't do anything. This should never happen.")
|
||||
|
||||
async def election_start_action(self) -> None:
|
||||
"""
|
||||
Performs required actions for when the election cycle starts.
|
||||
"""
|
||||
"""Performs required actions for when the election cycle starts."""
|
||||
# create new channel for election
|
||||
parent: nextcord.TextChannel = self.guild.get_channel(
|
||||
self.config.params.voting_parent_id
|
||||
)
|
||||
quarter_name: str = get_election_cycle_name(self.config)
|
||||
parent: nextcord.TextChannel = self.guild.get_channel(settings.channel_ids.voting)
|
||||
quarter_name: str = get_election_name()
|
||||
|
||||
thread_msg: nextcord.Message = await parent.send(content=quarter_name)
|
||||
|
||||
thread: nextcord.Thread = await parent.create_thread(
|
||||
name=quarter_name, message=thread_msg
|
||||
)
|
||||
thread: nextcord.Thread = await parent.create_thread(name=quarter_name, message=thread_msg)
|
||||
|
||||
# post message announcing election
|
||||
# election start message is returned as an array of string because it is too long. send each string
|
||||
@@ -212,16 +185,14 @@ class ElectionCycle:
|
||||
for index, message in enumerate(messages):
|
||||
# if last item, add the nominate button
|
||||
if index + 1 == len(messages):
|
||||
nominate_msg: nextcord.Message = await thread.send(
|
||||
message, view=NominateView(self.config, self.guild)
|
||||
)
|
||||
nominate_msg: nextcord.Message = await thread.send(message, view=NominateView(self.guild))
|
||||
else:
|
||||
await thread.send(message)
|
||||
|
||||
# create new entry into database.
|
||||
with Session(engine) as session:
|
||||
new_cycle = ElectionInformation(
|
||||
ElectionCycle=quarter_name,
|
||||
ElectionName=quarter_name,
|
||||
ThreadId=thread.id,
|
||||
CouncilNominationMsgId=nominate_msg.id,
|
||||
)
|
||||
@@ -230,61 +201,44 @@ class ElectionCycle:
|
||||
|
||||
async def voting_start_action(self) -> None:
|
||||
"""
|
||||
Actions performed when starting a vote.
|
||||
|
||||
Sends message informing members that voting has started.
|
||||
Removes write permission from the general clan member role.
|
||||
"""
|
||||
message = self.build_vote_start()
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||
self.get_election_info().ThreadId
|
||||
)
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(self.get_election_info().ThreadId)
|
||||
await election_thread.send(message)
|
||||
vote_msg = await election_thread.send(
|
||||
build_votes_str(self.config), view=VoteView(self.config, self.guild)
|
||||
build_votes_str(self.guild),
|
||||
view=VoteView(self.guild),
|
||||
)
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation).where(
|
||||
ElectionInformation.ElectionCycle
|
||||
== get_election_cycle_name(self.config)
|
||||
)
|
||||
stmt = select(ElectionInformation).where(ElectionInformation.ElectionName == get_election_name())
|
||||
info = session.scalar(stmt)
|
||||
info.CouncilVoteMsgId = vote_msg.id
|
||||
session.commit()
|
||||
|
||||
thread: nextcord.Thread = self.guild.get_thread(info.ThreadId)
|
||||
nominate_msg: nextcord.Message = await thread.fetch_message(
|
||||
info.CouncilNominationMsgId
|
||||
)
|
||||
nominate_msg: nextcord.Message = await thread.fetch_message(info.CouncilNominationMsgId)
|
||||
await nominate_msg.edit(view=None)
|
||||
|
||||
async def voting_end_action(self) -> None:
|
||||
"""
|
||||
Performs required actions for when voting time has ended.
|
||||
"""
|
||||
|
||||
"""Performs required actions for when voting time has ended."""
|
||||
message = self.build_highcouncil_election_announce()
|
||||
council_elect_role: nextcord.Role = self.guild.get_role(
|
||||
self.config.params.clan_council_elect_role_id
|
||||
)
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||
self.get_election_info().ThreadId
|
||||
)
|
||||
council_elect_role: nextcord.Role = self.guild.get_role(settings.role_ids.clan_council_elect)
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(self.get_election_info().ThreadId)
|
||||
|
||||
nominate_msg: nextcord.Message = await election_thread.send(
|
||||
message, view=NominateHighCouncilView(self.config, self.guild)
|
||||
)
|
||||
nominate_msg: nextcord.Message = await election_thread.send(message, view=NominateHighCouncilView(self.guild))
|
||||
|
||||
election_name = get_election_cycle_name(self.config)
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
# remove vote button from vote message
|
||||
stmt = select(ElectionInformation).where(
|
||||
ElectionInformation.ElectionCycle == election_name
|
||||
)
|
||||
stmt = select(ElectionInformation).where(ElectionInformation.ElectionName == election_name)
|
||||
info = session.scalar(stmt)
|
||||
vote_msg: nextcord.Message = await election_thread.fetch_message(
|
||||
info.CouncilVoteMsgId
|
||||
)
|
||||
vote_msg: nextcord.Message = await election_thread.fetch_message(info.CouncilVoteMsgId)
|
||||
await vote_msg.edit(view=None)
|
||||
|
||||
# add the highcouncil nomination message to election information
|
||||
@@ -292,14 +246,18 @@ class ElectionCycle:
|
||||
session.commit()
|
||||
|
||||
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
|
||||
stmt = select(Votes.VotedForId).where(Votes.ElectionCycle == election_name)
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.Type == VoteType.COUNCIL)
|
||||
)
|
||||
vote_count = collections.Counter(session.scalars(stmt))
|
||||
|
||||
for user_id, votes in vote_count.items():
|
||||
if votes >= 3:
|
||||
if votes >= REQUIRED_VOTES_TO_BE_ELECTED:
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == election_name)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == user_id)
|
||||
)
|
||||
council_member = session.scalar(stmt)
|
||||
@@ -314,56 +272,39 @@ class ElectionCycle:
|
||||
)
|
||||
|
||||
async def highcouncil_election_start_action(self) -> None:
|
||||
"""
|
||||
Performs required actions for when the highcouncil is elected.
|
||||
"""
|
||||
|
||||
"""Performs required actions for when the highcouncil is elected."""
|
||||
message = self.build_highcouncil_vote_start()
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||
self.get_election_info().ThreadId
|
||||
)
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(self.get_election_info().ThreadId)
|
||||
await election_thread.send(message)
|
||||
vote_msg = await election_thread.send(
|
||||
build_highcouncil_votes_str(self.config),
|
||||
view=VoteHighcouncilView(self.config, self.guild),
|
||||
build_highcouncil_votes_str(self.guild),
|
||||
view=VoteHighcouncilView(self.guild),
|
||||
)
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation).where(
|
||||
ElectionInformation.ElectionCycle
|
||||
== get_election_cycle_name(self.config)
|
||||
)
|
||||
stmt = select(ElectionInformation).where(ElectionInformation.ElectionName == get_election_name())
|
||||
info = session.scalar(stmt)
|
||||
info.HighCouncilVoteMsgId = vote_msg.id
|
||||
session.commit()
|
||||
|
||||
# remove highcouncil nomination view
|
||||
nomination_msg: nextcord.Message = await election_thread.fetch_message(
|
||||
info.HighCouncilNominationMsgId
|
||||
)
|
||||
nomination_msg: nextcord.Message = await election_thread.fetch_message(info.HighCouncilNominationMsgId)
|
||||
await nomination_msg.edit(view=None)
|
||||
|
||||
async def term_start_action(self) -> None:
|
||||
"""
|
||||
Marks the election as over.
|
||||
"""
|
||||
|
||||
"""Marks the election as over."""
|
||||
self.election_over = True
|
||||
|
||||
elect_role: nextcord.Role = self.guild.get_role(
|
||||
self.config.params.clan_council_elect_role_id
|
||||
)
|
||||
council_role: nextcord.Role = self.guild.get_role(
|
||||
self.config.params.clan_council_role_id
|
||||
)
|
||||
elect_role: nextcord.Role = self.guild.get_role(settings.role_ids.clan_council_elect)
|
||||
council_role: nextcord.Role = self.guild.get_role(settings.role_ids.clan_council)
|
||||
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
# role management
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
.where(
|
||||
CouncilMembers.ElectionCycle == get_election_cycle_name(self.config)
|
||||
)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.Elected == true())
|
||||
)
|
||||
|
||||
@@ -380,43 +321,62 @@ class ElectionCycle:
|
||||
|
||||
# announce high council members
|
||||
# ties are undefined behavior.
|
||||
dm_election = get_dm_election_name(self.config)
|
||||
cl_election = get_cl_election_name(self.config)
|
||||
stmt = select(Votes.VotedForId).where(Votes.ElectionCycle == dm_election)
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.Type == VoteType.DISCORDMANAGER)
|
||||
)
|
||||
dm_votes = collections.Counter(session.scalars(stmt))
|
||||
stmt = select(Votes.VotedForId).where(Votes.ElectionCycle == cl_election)
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.Type == VoteType.CLANLEADER)
|
||||
)
|
||||
cl_votes = collections.Counter(session.scalars(stmt))
|
||||
|
||||
try:
|
||||
dm_winner = max(dm_votes, key=dm_votes.get)
|
||||
stmt = (
|
||||
update(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == dm_winner)
|
||||
.values(DiscordManager=True)
|
||||
)
|
||||
session.execute(stmt)
|
||||
except ValueError:
|
||||
dm_winner = "No winner"
|
||||
try:
|
||||
cl_winner = max(cl_votes, key=cl_votes.get)
|
||||
stmt = (
|
||||
update(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == cl_winner)
|
||||
.values(ClanLeader=True)
|
||||
)
|
||||
session.execute(stmt)
|
||||
except ValueError:
|
||||
cl_winner = "No winner"
|
||||
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||
self.get_election_info().ThreadId
|
||||
)
|
||||
session.commit()
|
||||
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(self.get_election_info().ThreadId)
|
||||
|
||||
# clear view from vote message
|
||||
stmt = select(ElectionInformation.HighCouncilVoteMsgId).where(
|
||||
ElectionInformation.ElectionCycle == get_election_cycle_name(self.config)
|
||||
ElectionInformation.ElectionName == get_election_name()
|
||||
)
|
||||
vote_msg_id = session.scalar(stmt)
|
||||
vote_msg: nextcord.Message = await election_thread.fetch_message(vote_msg_id)
|
||||
await vote_msg.edit(view=None)
|
||||
|
||||
highcouncil_msg: str = f"Congratulations for our high council members!\n Clan Leader: <@{cl_winner}>\n"
|
||||
highcouncil_msg: str = f"Congratulations for our high council members!\nClan Leader: <@{cl_winner}>\n"
|
||||
highcouncil_msg += f"Discord Manager: <@{dm_winner}>"
|
||||
await election_thread.send(highcouncil_msg)
|
||||
|
||||
await election_thread.send(
|
||||
"This election cycle is now over. Thank you everyone for participating!"
|
||||
)
|
||||
await election_thread.send("This election cycle is now over. Thank you everyone for participating!")
|
||||
|
||||
await election_thread.edit(archived=True, locked=True)
|
||||
await edit_clan_council_info(self.guild)
|
||||
|
||||
def get_election_info(self) -> ElectionInformation:
|
||||
"""
|
||||
@@ -425,24 +385,15 @@ class ElectionCycle:
|
||||
Returns:
|
||||
ElectionInformation: The information from the database about the current election.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation).where(
|
||||
ElectionInformation.ElectionCycle
|
||||
== get_election_cycle_name(self.config)
|
||||
)
|
||||
stmt = select(ElectionInformation).where(ElectionInformation.ElectionName == get_election_name())
|
||||
return session.scalar(stmt)
|
||||
|
||||
async def election_reminder(self) -> None:
|
||||
"""
|
||||
Sends a message to general chat reminder clan about election.
|
||||
"""
|
||||
"""Sends a message to general chat reminder clan about election."""
|
||||
general: nextcord.TextChannel = self.guild.get_channel(settings.channel_ids.general)
|
||||
|
||||
general: nextcord.TextChannel = self.guild.get_channel(
|
||||
self.config.params.general_channel_id
|
||||
)
|
||||
|
||||
message = f"Reminder to <@&{self.config.params.clan_member_role_id}>! Clan elections are happening! Head over "
|
||||
message = f"Reminder to <@&{settings.role_ids.clan_member}>! Clan elections are happening! Head over "
|
||||
message += f"to <#{self.get_election_info().ThreadId}> to cast your vote!"
|
||||
|
||||
await general.send(content=message)
|
||||
@@ -0,0 +1,193 @@
|
||||
# generated by datamodel-codegen:
|
||||
# filename: gitea_webhook.json
|
||||
# timestamp: 2024-05-16T21:15:27+00:00
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Author(BaseModel):
|
||||
name: str
|
||||
email: str
|
||||
username: str
|
||||
|
||||
|
||||
class Committer(BaseModel):
|
||||
name: str
|
||||
email: str
|
||||
username: str
|
||||
|
||||
|
||||
class Commit(BaseModel):
|
||||
id: str
|
||||
message: str
|
||||
url: str
|
||||
author: Author
|
||||
committer: Committer
|
||||
verification: None
|
||||
timestamp: str
|
||||
added: list[str]
|
||||
removed: list[str]
|
||||
modified: list[str]
|
||||
|
||||
|
||||
class HeadCommit(BaseModel):
|
||||
id: str
|
||||
message: str
|
||||
url: str
|
||||
author: Author
|
||||
committer: Committer
|
||||
verification: None
|
||||
timestamp: str
|
||||
added: list[str]
|
||||
removed: list[str]
|
||||
modified: list[str]
|
||||
|
||||
|
||||
class Owner(BaseModel):
|
||||
id: int
|
||||
login: str
|
||||
login_name: str
|
||||
full_name: str
|
||||
email: str
|
||||
avatar_url: str
|
||||
language: str
|
||||
is_admin: bool
|
||||
last_login: str
|
||||
created: str
|
||||
restricted: bool
|
||||
active: bool
|
||||
prohibit_login: bool
|
||||
location: str
|
||||
website: str
|
||||
description: str
|
||||
visibility: str
|
||||
followers_count: int
|
||||
following_count: int
|
||||
starred_repos_count: int
|
||||
username: str
|
||||
|
||||
|
||||
class Permissions(BaseModel):
|
||||
admin: bool
|
||||
push: bool
|
||||
pull: bool
|
||||
|
||||
|
||||
class Repository(BaseModel):
|
||||
id: int
|
||||
owner: Owner
|
||||
name: str
|
||||
full_name: str
|
||||
description: str
|
||||
empty: bool
|
||||
private: bool
|
||||
fork: bool
|
||||
template: bool
|
||||
parent: None
|
||||
mirror: bool
|
||||
size: int
|
||||
language: str
|
||||
languages_url: str
|
||||
html_url: str
|
||||
url: str
|
||||
link: str
|
||||
ssh_url: str
|
||||
clone_url: str
|
||||
original_url: str
|
||||
website: str
|
||||
stars_count: int
|
||||
forks_count: int
|
||||
watchers_count: int
|
||||
open_issues_count: int
|
||||
open_pr_counter: int
|
||||
release_counter: int
|
||||
default_branch: str
|
||||
archived: bool
|
||||
created_at: str
|
||||
updated_at: str
|
||||
archived_at: str
|
||||
permissions: Permissions
|
||||
has_issues: bool
|
||||
has_wiki: bool
|
||||
has_pull_requests: bool
|
||||
has_projects: bool
|
||||
has_releases: bool
|
||||
has_packages: bool
|
||||
has_actions: bool
|
||||
ignore_whitespace_conflicts: bool
|
||||
allow_merge_commits: bool
|
||||
allow_rebase: bool
|
||||
allow_rebase_explicit: bool
|
||||
allow_squash_merge: bool
|
||||
allow_rebase_update: bool
|
||||
default_delete_branch_after_merge: bool
|
||||
default_merge_style: str
|
||||
default_allow_maintainer_edit: bool
|
||||
avatar_url: str
|
||||
internal: bool
|
||||
mirror_interval: str
|
||||
mirror_updated: str
|
||||
repo_transfer: None
|
||||
|
||||
|
||||
class Pusher(BaseModel):
|
||||
id: int
|
||||
login: str
|
||||
login_name: str
|
||||
full_name: str
|
||||
email: str
|
||||
avatar_url: str
|
||||
language: str
|
||||
is_admin: bool
|
||||
last_login: str
|
||||
created: str
|
||||
restricted: bool
|
||||
active: bool
|
||||
prohibit_login: bool
|
||||
location: str
|
||||
website: str
|
||||
description: str
|
||||
visibility: str
|
||||
followers_count: int
|
||||
following_count: int
|
||||
starred_repos_count: int
|
||||
username: str
|
||||
|
||||
|
||||
class Sender(BaseModel):
|
||||
id: int
|
||||
login: str
|
||||
login_name: str
|
||||
full_name: str
|
||||
email: str
|
||||
avatar_url: str
|
||||
language: str
|
||||
is_admin: bool
|
||||
last_login: str
|
||||
created: str
|
||||
restricted: bool
|
||||
active: bool
|
||||
prohibit_login: bool
|
||||
location: str
|
||||
website: str
|
||||
description: str
|
||||
visibility: str
|
||||
followers_count: int
|
||||
following_count: int
|
||||
starred_repos_count: int
|
||||
username: str
|
||||
|
||||
|
||||
class GiteaWebhook(BaseModel):
|
||||
ref: str
|
||||
before: str
|
||||
after: str
|
||||
compare_url: str
|
||||
commits: list[Commit]
|
||||
total_commits: int
|
||||
head_commit: HeadCommit
|
||||
repository: Repository
|
||||
pusher: Pusher
|
||||
sender: Sender
|
||||
+40
-77
@@ -1,32 +1,31 @@
|
||||
"""
|
||||
Contains various views to be used in the high council nomination process.
|
||||
"""
|
||||
"""Contains various views to be used in the high council nomination process."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.interactions import Interaction
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import CouncilMembers, engine
|
||||
from utils import (
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import CouncilMembers, engine
|
||||
from dakiny_bot.utils import (
|
||||
NOMINEE_SPLITTER,
|
||||
decorate_cl_nomination,
|
||||
decorate_dm_nomination,
|
||||
get_election_cycle_name,
|
||||
get_election_name,
|
||||
)
|
||||
|
||||
|
||||
class NominateDMModal(nextcord.ui.Modal):
|
||||
"""
|
||||
Modal for nominating oneself. User writes a speech and then the callback sends the speech into the correct channel.
|
||||
Modal for nominating oneself.
|
||||
|
||||
User writes a speech and then the callback sends the speech into the correct channel.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: DakinyConfig,
|
||||
usr_id: int,
|
||||
usr_nominated: bool,
|
||||
usr_nominated: bool, # noqa: FBT001
|
||||
speech_content: str,
|
||||
):
|
||||
super().__init__(
|
||||
@@ -34,7 +33,6 @@ class NominateDMModal(nextcord.ui.Modal):
|
||||
timeout=5 * 60, # 5 minutes
|
||||
)
|
||||
self.usr_id: int = usr_id
|
||||
self.config: DakinyConfig = config
|
||||
self.usr_nominated = usr_nominated
|
||||
|
||||
self.speech = nextcord.ui.TextInput(
|
||||
@@ -55,15 +53,14 @@ class NominateDMModal(nextcord.ui.Modal):
|
||||
interaction (Interaction): Interaction with user.
|
||||
|
||||
"""
|
||||
|
||||
speech = decorate_dm_nomination(interaction.user.id, self.speech.value)
|
||||
|
||||
with Session(engine) as session:
|
||||
# user already in table
|
||||
cycle = get_election_cycle_name(self.config)
|
||||
election_name = get_election_name()
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == self.usr_id)
|
||||
)
|
||||
council_elect = session.scalar(stmt)
|
||||
@@ -74,26 +71,21 @@ class NominateDMModal(nextcord.ui.Modal):
|
||||
council_elect.DiscordManagerSpeechId = msg.id
|
||||
session.commit()
|
||||
else:
|
||||
msg: nextcord.Message = await interaction.channel.fetch_message(
|
||||
council_elect.DiscordManagerSpeechId
|
||||
)
|
||||
await msg.edit(
|
||||
content=decorate_dm_nomination(
|
||||
interaction.user.id, self.speech.value
|
||||
)
|
||||
)
|
||||
msg: nextcord.Message = await interaction.channel.fetch_message(council_elect.DiscordManagerSpeechId)
|
||||
await msg.edit(content=decorate_dm_nomination(interaction.user.id, self.speech.value))
|
||||
|
||||
|
||||
class NominateCLModal(nextcord.ui.Modal):
|
||||
"""
|
||||
Modal for nominating oneself. User writes a speech and then the callback sends the speech into the correct channel.
|
||||
Modal for nominating oneself.
|
||||
|
||||
User writes a speech and then the callback sends the speech into the correct channel.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: DakinyConfig,
|
||||
usr_id: int,
|
||||
usr_nominated: bool,
|
||||
usr_nominated: bool, # noqa: FBT001
|
||||
speech_content: str,
|
||||
):
|
||||
super().__init__(
|
||||
@@ -101,7 +93,6 @@ class NominateCLModal(nextcord.ui.Modal):
|
||||
timeout=5 * 60, # 5 minutes
|
||||
)
|
||||
self.usr_id: int = usr_id
|
||||
self.config: DakinyConfig = config
|
||||
self.usr_nominated = usr_nominated
|
||||
|
||||
self.speech = nextcord.ui.TextInput(
|
||||
@@ -122,15 +113,14 @@ class NominateCLModal(nextcord.ui.Modal):
|
||||
interaction (Interaction): Interaction with user.
|
||||
|
||||
"""
|
||||
|
||||
speech = decorate_cl_nomination(interaction.user.id, self.speech.value)
|
||||
|
||||
with Session(engine) as session:
|
||||
# user already in table
|
||||
cycle = get_election_cycle_name(self.config)
|
||||
election_name = get_election_name()
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == self.usr_id)
|
||||
)
|
||||
council_elect = session.scalar(stmt)
|
||||
@@ -141,24 +131,15 @@ class NominateCLModal(nextcord.ui.Modal):
|
||||
council_elect.ClanLeaderSpeechId = msg.id
|
||||
session.commit()
|
||||
else:
|
||||
msg: nextcord.Message = await interaction.channel.fetch_message(
|
||||
council_elect.ClanLeaderSpeechId
|
||||
)
|
||||
await msg.edit(
|
||||
content=decorate_cl_nomination(
|
||||
interaction.user.id, self.speech.value
|
||||
)
|
||||
)
|
||||
msg: nextcord.Message = await interaction.channel.fetch_message(council_elect.ClanLeaderSpeechId)
|
||||
await msg.edit(content=decorate_cl_nomination(interaction.user.id, self.speech.value))
|
||||
|
||||
|
||||
class NominateHighCouncilView(nextcord.ui.View):
|
||||
"""
|
||||
The buttons to press to start your High Council nomination.
|
||||
"""
|
||||
"""The buttons to press to start your High Council nomination."""
|
||||
|
||||
def __init__(self, config: DakinyConfig, guild: nextcord.Guild):
|
||||
def __init__(self, guild: nextcord.Guild):
|
||||
super().__init__(timeout=None)
|
||||
self.config: DakinyConfig = config
|
||||
self.guild: nextcord.Guild = guild
|
||||
|
||||
@nextcord.ui.button(
|
||||
@@ -166,10 +147,10 @@ class NominateHighCouncilView(nextcord.ui.View):
|
||||
style=nextcord.ButtonStyle.primary,
|
||||
custom_id="nominate-dm",
|
||||
)
|
||||
async def nominate_dm(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
) -> None:
|
||||
async def nominate_dm(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Button for nominating oneself for Discord Manager.
|
||||
|
||||
Gathers previous information about the user if they have already nominated themselves, then launches
|
||||
the nomination modal to get their speech.
|
||||
|
||||
@@ -177,25 +158,21 @@ class NominateHighCouncilView(nextcord.ui.View):
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
|
||||
# enforce council elect only
|
||||
if (
|
||||
self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
||||
not in interaction.user.roles
|
||||
):
|
||||
if self.guild.get_role(settings.role_ids.clan_council_elect) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{self.config.params.clan_council_elect_role_id}> role to vote.",
|
||||
f"You must have the <@&{settings.role_ids.clan_council_elect}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
cycle = get_election_cycle_name(self.config)
|
||||
election_name = get_election_name()
|
||||
usr_nominated = False
|
||||
speech_content = ""
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == interaction.user.id)
|
||||
)
|
||||
obj = session.scalar(stmt)
|
||||
@@ -203,26 +180,20 @@ class NominateHighCouncilView(nextcord.ui.View):
|
||||
# user needs to exist to get here anyways...
|
||||
if obj.DiscordManagerSpeechId is not None:
|
||||
usr_nominated = True
|
||||
msg = await interaction.channel.fetch_message(
|
||||
obj.DiscordManagerSpeechId
|
||||
)
|
||||
msg = await interaction.channel.fetch_message(obj.DiscordManagerSpeechId)
|
||||
speech_content = msg.content.split(NOMINEE_SPLITTER)[1]
|
||||
|
||||
await interaction.response.send_modal(
|
||||
NominateDMModal(
|
||||
self.config, interaction.user.id, usr_nominated, speech_content
|
||||
)
|
||||
)
|
||||
await interaction.response.send_modal(NominateDMModal(interaction.user.id, usr_nominated, speech_content))
|
||||
|
||||
@nextcord.ui.button(
|
||||
label="Nominate for Clan Leader",
|
||||
style=nextcord.ButtonStyle.primary,
|
||||
custom_id="nominate-cl",
|
||||
)
|
||||
async def nominate_cl(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
) -> None:
|
||||
async def nominate_cl(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Button for nominating oneself for Clan Leader.
|
||||
|
||||
Gathers previous information about the user if they have already nominated themselves, then launches
|
||||
the nomination modal to get their speech.
|
||||
|
||||
@@ -230,25 +201,21 @@ class NominateHighCouncilView(nextcord.ui.View):
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
|
||||
# enforce council elect only
|
||||
if (
|
||||
self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
||||
not in interaction.user.roles
|
||||
):
|
||||
if self.guild.get_role(settings.role_ids.clan_council_elect) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{self.config.params.clan_council_elect_role_id}> role to vote.",
|
||||
f"You must have the <@&{settings.role_ids.clan_council_elect}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
cycle = get_election_cycle_name(self.config)
|
||||
election_name = get_election_name()
|
||||
usr_nominated = False
|
||||
speech_content = ""
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == interaction.user.id)
|
||||
)
|
||||
obj = session.scalar(stmt)
|
||||
@@ -259,8 +226,4 @@ class NominateHighCouncilView(nextcord.ui.View):
|
||||
msg = await interaction.channel.fetch_message(obj.ClanLeaderSpeechId)
|
||||
speech_content = msg.content.split(NOMINEE_SPLITTER)[1]
|
||||
|
||||
await interaction.response.send_modal(
|
||||
NominateCLModal(
|
||||
self.config, interaction.user.id, usr_nominated, speech_content
|
||||
)
|
||||
)
|
||||
await interaction.response.send_modal(NominateCLModal(interaction.user.id, usr_nominated, speech_content))
|
||||
@@ -1,27 +1,26 @@
|
||||
"""
|
||||
Contains various views to be used in the nomination process.
|
||||
"""
|
||||
"""Contains various views to be used in the nomination process."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.interactions import Interaction
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import CouncilMembers, engine
|
||||
from utils import NOMINEE_SPLITTER, decorate_nomination, get_election_cycle_name
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import CouncilMembers, engine
|
||||
from dakiny_bot.utils import NOMINEE_SPLITTER, decorate_nomination, get_election_name
|
||||
|
||||
|
||||
class NominateModal(nextcord.ui.Modal):
|
||||
"""
|
||||
Modal for nominating oneself. User writes a speech and then the callback sends the speech into the correct channel.
|
||||
Modal for nominating oneself.
|
||||
|
||||
User writes a speech and then the callback sends the speech into the correct channel.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: DakinyConfig,
|
||||
usr_id: int,
|
||||
usr_nominated: bool,
|
||||
usr_nominated: bool, # noqa: FBT001
|
||||
speech_content: str,
|
||||
):
|
||||
super().__init__(
|
||||
@@ -29,7 +28,6 @@ class NominateModal(nextcord.ui.Modal):
|
||||
timeout=5 * 60, # 5 minutes
|
||||
)
|
||||
self.usr_id: int = usr_id
|
||||
self.config: DakinyConfig = config
|
||||
self.usr_nominated = usr_nominated
|
||||
|
||||
self.speech = nextcord.ui.TextInput(
|
||||
@@ -50,15 +48,15 @@ class NominateModal(nextcord.ui.Modal):
|
||||
interaction (Interaction): Interaction with user.
|
||||
|
||||
"""
|
||||
|
||||
speech = decorate_nomination(interaction.user.id, self.speech.value)
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
if not self.usr_nominated:
|
||||
msg = await interaction.channel.send(speech)
|
||||
|
||||
council_member = CouncilMembers(
|
||||
ElectionCycle=get_election_cycle_name(self.config),
|
||||
ElectionName=election_name,
|
||||
MemberId=interaction.user.id,
|
||||
SpeechMsgId=msg.id,
|
||||
)
|
||||
@@ -66,30 +64,22 @@ class NominateModal(nextcord.ui.Modal):
|
||||
session.commit()
|
||||
else:
|
||||
# user already nominated, just need to update the election speech
|
||||
cycle = get_election_cycle_name(self.config)
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == self.usr_id)
|
||||
)
|
||||
obj = session.scalar(stmt)
|
||||
|
||||
msg: nextcord.Message = await interaction.channel.fetch_message(
|
||||
obj.SpeechMsgId
|
||||
)
|
||||
await msg.edit(
|
||||
content=decorate_nomination(interaction.user.id, self.speech.value)
|
||||
)
|
||||
msg: nextcord.Message = await interaction.channel.fetch_message(obj.SpeechMsgId)
|
||||
await msg.edit(content=decorate_nomination(interaction.user.id, self.speech.value))
|
||||
|
||||
|
||||
class NominateView(nextcord.ui.View):
|
||||
"""
|
||||
The button to press to start your nomination.
|
||||
"""
|
||||
"""The button to press to start your nomination."""
|
||||
|
||||
def __init__(self, config: DakinyConfig, guild: nextcord.Guild):
|
||||
def __init__(self, guild: nextcord.Guild):
|
||||
super().__init__(timeout=None)
|
||||
self.config: DakinyConfig = config
|
||||
self.guild: nextcord.Guild = guild
|
||||
|
||||
@nextcord.ui.button(
|
||||
@@ -97,10 +87,10 @@ class NominateView(nextcord.ui.View):
|
||||
style=nextcord.ButtonStyle.primary,
|
||||
custom_id="nominate",
|
||||
)
|
||||
async def nominate(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
) -> None:
|
||||
async def nominate(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Button to nominate oneself for Clan Council.
|
||||
|
||||
Gathers previous information about the user if they have already nominated themselves, then launches
|
||||
the nomination modal to get their speech.
|
||||
|
||||
@@ -108,25 +98,21 @@ class NominateView(nextcord.ui.View):
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
|
||||
# enforce members only
|
||||
if (
|
||||
self.guild.get_role(self.config.params.clan_member_role_id)
|
||||
not in interaction.user.roles
|
||||
):
|
||||
if self.guild.get_role(settings.role_ids.clan_member) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{self.config.params.clan_member_role_id}> role to vote.",
|
||||
f"You must have the <@&{settings.role_ids.clan_member}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
cycle = get_election_cycle_name(self.config)
|
||||
election_name = get_election_name()
|
||||
usr_nominated = False
|
||||
speech_content = ""
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.MemberId == interaction.user.id)
|
||||
)
|
||||
obj = session.scalar(stmt)
|
||||
@@ -135,8 +121,4 @@ class NominateView(nextcord.ui.View):
|
||||
msg = await interaction.channel.fetch_message(obj.SpeechMsgId)
|
||||
speech_content = msg.content.split(NOMINEE_SPLITTER)[1]
|
||||
|
||||
await interaction.response.send_modal(
|
||||
NominateModal(
|
||||
self.config, interaction.user.id, usr_nominated, speech_content
|
||||
)
|
||||
)
|
||||
await interaction.response.send_modal(NominateModal(interaction.user.id, usr_nominated, speech_content))
|
||||
@@ -0,0 +1,10 @@
|
||||
[tool.ruff]
|
||||
# Extend the `pyproject.toml` file in the parent directory...
|
||||
extend = "../../pyproject.toml"
|
||||
|
||||
# Exclude a variety of commonly ignored directories.
|
||||
exclude = ["gitea_webhook.py"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
# ignore implicit-namespace-package in this directory.
|
||||
ignore = ["INP001"]
|
||||
+70
-86
@@ -1,8 +1,4 @@
|
||||
"""
|
||||
Contains various views to be used while voting for high council. Controls the logic when performing the vote.
|
||||
"""
|
||||
|
||||
from typing import List
|
||||
"""Contains various views to be used while voting for high council. Controls the logic when performing the vote."""
|
||||
|
||||
import nextcord
|
||||
from nextcord import SelectOption
|
||||
@@ -10,61 +6,52 @@ from nextcord.interactions import Interaction
|
||||
from sqlalchemy import exc, select, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import (
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import (
|
||||
CouncilMembers,
|
||||
ElectionInformation,
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from utils import (
|
||||
build_highcouncil_votes_str,
|
||||
get_cl_election_name,
|
||||
get_dm_election_name,
|
||||
get_election_cycle_name,
|
||||
)
|
||||
from dakiny_bot.utils import VoteType, build_highcouncil_votes_str, get_election_name
|
||||
|
||||
|
||||
class VoteSelect(nextcord.ui.StringSelect):
|
||||
def __init__(
|
||||
self, options: List["SelectOption"], config: DakinyConfig, election_type: str
|
||||
) -> None:
|
||||
"""Vote view string select."""
|
||||
|
||||
def __init__(self, options: list["SelectOption"], election_type: str) -> None:
|
||||
super().__init__(
|
||||
placeholder="Choose 1",
|
||||
min_values=1,
|
||||
max_values=1,
|
||||
options=options,
|
||||
)
|
||||
self.config = config
|
||||
self.election_type = election_type
|
||||
|
||||
async def callback(self, interaction: Interaction):
|
||||
# decide on election type
|
||||
match self.election_type:
|
||||
case "cl":
|
||||
election_name: str = get_cl_election_name(self.config)
|
||||
case "dm":
|
||||
election_name: str = get_dm_election_name(self.config)
|
||||
case _:
|
||||
# should never happen
|
||||
raise ValueError('election type was not "cl" or "dm"')
|
||||
async def callback(self, interaction: Interaction) -> None:
|
||||
"""
|
||||
Callback override for the StringSelect.
|
||||
|
||||
cycle: str = get_election_cycle_name(self.config)
|
||||
Submits the High Council vote to database if a user is selected. Handles adding vs editing a vote.
|
||||
Returns message informing user that vote has been recorded.
|
||||
|
||||
Args:
|
||||
interaction (Interaction): Interaction with this callback.
|
||||
"""
|
||||
election_name: str = get_election_name()
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation.HighCouncilVoteMsgId).where(
|
||||
ElectionInformation.ElectionCycle == cycle
|
||||
ElectionInformation.ElectionName == election_name
|
||||
)
|
||||
vote_msg_id = session.scalar(stmt)
|
||||
|
||||
if self.values[0] == "Abstain":
|
||||
voted_for = None
|
||||
else:
|
||||
voted_for = int(self.values[0])
|
||||
voted_for = None if self.values[0] == "Abstain" else int(self.values[0])
|
||||
|
||||
new_vote = Votes(
|
||||
ElectionCycle=election_name,
|
||||
ElectionName=election_name,
|
||||
VoterId=interaction.user.id,
|
||||
VotedForId=voted_for,
|
||||
Type=self.election_type,
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -72,38 +59,32 @@ class VoteSelect(nextcord.ui.StringSelect):
|
||||
session.commit()
|
||||
|
||||
except exc.IntegrityError:
|
||||
# user already has a vote in the election and election type
|
||||
session.rollback()
|
||||
stmt = (
|
||||
update(Votes)
|
||||
.where(Votes.ElectionCycle == election_name)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
.where(Votes.Type == self.election_type)
|
||||
.values(VotedForId=voted_for)
|
||||
)
|
||||
session.execute(stmt)
|
||||
session.commit()
|
||||
|
||||
vote_message_str = build_highcouncil_votes_str(self.config)
|
||||
vote_msg: nextcord.Message = await interaction.channel.fetch_message(
|
||||
vote_msg_id
|
||||
)
|
||||
vote_message_str = build_highcouncil_votes_str(interaction.guild)
|
||||
vote_msg: nextcord.Message = await interaction.channel.fetch_message(vote_msg_id)
|
||||
await vote_msg.edit(content=vote_message_str)
|
||||
|
||||
if voted_for is not None:
|
||||
msg = f"You have voted for <@{voted_for}>"
|
||||
else:
|
||||
msg = "You have abstained from voting."
|
||||
msg = f"You have voted for <@{voted_for}>" if voted_for is not None else "You have abstained from voting."
|
||||
|
||||
await interaction.edit(content=msg, view=None)
|
||||
|
||||
|
||||
class VoteHighcouncilView(nextcord.ui.View):
|
||||
"""
|
||||
The button to press to start voting for HighCouncil.
|
||||
"""
|
||||
"""The button to press to start voting for HighCouncil."""
|
||||
|
||||
def __init__(self, config: DakinyConfig, guild: nextcord.Guild):
|
||||
def __init__(self, guild: nextcord.Guild):
|
||||
super().__init__(timeout=None)
|
||||
self.config = config
|
||||
self.guild = guild
|
||||
|
||||
@nextcord.ui.button(
|
||||
@@ -111,10 +92,10 @@ class VoteHighcouncilView(nextcord.ui.View):
|
||||
style=nextcord.ButtonStyle.primary,
|
||||
custom_id="vote-cl",
|
||||
)
|
||||
async def vote_cl(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
) -> None:
|
||||
async def vote_cl(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Button to vote for Clan Leader.
|
||||
|
||||
Enforces only council elect vote. Gets election cycle, creates voting
|
||||
options for clan leader (checking if user has voted already),
|
||||
then sends the voting view.
|
||||
@@ -123,43 +104,44 @@ class VoteHighcouncilView(nextcord.ui.View):
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
|
||||
# enforce council elect only
|
||||
if (
|
||||
self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
||||
not in interaction.user.roles
|
||||
):
|
||||
if self.guild.get_role(settings.role_ids.clan_council_elect) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{self.config.params.clan_council_elect_role_id}> role to vote.",
|
||||
f"You must have the <@&{settings.role_ids.clan_council_elect}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
cycle: str = get_election_cycle_name(self.config)
|
||||
election: str = get_cl_election_name(self.config)
|
||||
election_name: str = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionCycle == election)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
.where(Votes.Type == VoteType.CLANLEADER)
|
||||
)
|
||||
voted_for = session.scalar(stmt)
|
||||
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.filter(CouncilMembers.ClanLeaderSpeechId.is_not(None))
|
||||
)
|
||||
|
||||
options = [
|
||||
SelectOption(
|
||||
label=f"{self.guild.get_member(nominee).display_name} ☑️"
|
||||
if voted_for == nominee
|
||||
else f"{self.guild.get_member(nominee).display_name}",
|
||||
label=(
|
||||
f"{self.guild.get_member(nominee).display_name} ☑️"
|
||||
if voted_for == nominee
|
||||
else f"{self.guild.get_member(nominee).display_name}"
|
||||
),
|
||||
value=str(nominee),
|
||||
)
|
||||
for nominee in session.scalars(stmt)
|
||||
for nominee in sorted(
|
||||
session.scalars(stmt),
|
||||
key=lambda nominee: self.guild.get_member(nominee).display_name.lower(),
|
||||
)
|
||||
]
|
||||
options.append(
|
||||
SelectOption(
|
||||
@@ -169,9 +151,7 @@ class VoteHighcouncilView(nextcord.ui.View):
|
||||
)
|
||||
|
||||
view = nextcord.ui.View()
|
||||
view.add_item(
|
||||
VoteSelect(options=options, config=self.config, election_type="cl")
|
||||
)
|
||||
view.add_item(VoteSelect(options=options, election_type=VoteType.CLANLEADER))
|
||||
|
||||
await interaction.response.send_message(
|
||||
content="Please vote for a Clan Leader!",
|
||||
@@ -184,10 +164,10 @@ class VoteHighcouncilView(nextcord.ui.View):
|
||||
style=nextcord.ButtonStyle.primary,
|
||||
custom_id="vote-dm",
|
||||
)
|
||||
async def vote_dm(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
) -> None:
|
||||
async def vote_dm(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Button to vote for Discord Manager.
|
||||
|
||||
Enforces only council elect vote. Gets election cycle, creates voting
|
||||
options for discord manager (checking if user has voted already),
|
||||
then sends the voting view.
|
||||
@@ -196,43 +176,44 @@ class VoteHighcouncilView(nextcord.ui.View):
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
|
||||
# enforce council elect only
|
||||
if (
|
||||
self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
||||
not in interaction.user.roles
|
||||
):
|
||||
if self.guild.get_role(settings.role_ids.clan_council_elect) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{self.config.params.clan_council_elect_role_id}> role to vote.",
|
||||
f"You must have the <@&{settings.role_ids.clan_council_elect}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
cycle: str = get_election_cycle_name(self.config)
|
||||
election: str = get_dm_election_name(self.config)
|
||||
election_name: str = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionCycle == election)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
.where(Votes.Type == VoteType.DISCORDMANAGER)
|
||||
)
|
||||
voted_for = session.scalar(stmt)
|
||||
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
.where(CouncilMembers.ElectionCycle == cycle)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.filter(CouncilMembers.DiscordManagerSpeechId.is_not(None))
|
||||
)
|
||||
|
||||
options = [
|
||||
SelectOption(
|
||||
label=f"{self.guild.get_member(nominee).display_name} ☑️"
|
||||
if voted_for == nominee
|
||||
else f"{self.guild.get_member(nominee).display_name}",
|
||||
label=(
|
||||
f"{self.guild.get_member(nominee).display_name} ☑️"
|
||||
if voted_for == nominee
|
||||
else f"{self.guild.get_member(nominee).display_name}"
|
||||
),
|
||||
value=str(nominee),
|
||||
)
|
||||
for nominee in session.scalars(stmt)
|
||||
for nominee in sorted(
|
||||
session.scalars(stmt),
|
||||
key=lambda nominee: self.guild.get_member(nominee).display_name.lower(),
|
||||
)
|
||||
]
|
||||
options.append(
|
||||
SelectOption(
|
||||
@@ -243,7 +224,10 @@ class VoteHighcouncilView(nextcord.ui.View):
|
||||
|
||||
view = nextcord.ui.View()
|
||||
view.add_item(
|
||||
VoteSelect(options=options, config=self.config, election_type="dm")
|
||||
VoteSelect(
|
||||
options=options,
|
||||
election_type=VoteType.DISCORDMANAGER,
|
||||
)
|
||||
)
|
||||
|
||||
await interaction.response.send_message(
|
||||
@@ -0,0 +1,147 @@
|
||||
"""Contains various views to be used while voting. Controls the logic when performing the vote."""
|
||||
|
||||
import nextcord
|
||||
from nextcord import SelectOption
|
||||
from nextcord.interactions import Interaction
|
||||
from sqlalchemy import exc, select, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import (
|
||||
CouncilMembers,
|
||||
ElectionInformation,
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from dakiny_bot.utils import VoteType, build_votes_str, get_election_name
|
||||
|
||||
|
||||
class VoteSelect(nextcord.ui.StringSelect):
|
||||
"""Vote view string select."""
|
||||
|
||||
def __init__(self, options: list["SelectOption"]) -> None:
|
||||
super().__init__(
|
||||
placeholder="Choose 1",
|
||||
min_values=1,
|
||||
max_values=1,
|
||||
options=options,
|
||||
)
|
||||
|
||||
async def callback(self, interaction: Interaction) -> None:
|
||||
"""
|
||||
Callback override for the StringSelect.
|
||||
|
||||
Submits the vote to database if a user is selected. Handles adding vs editing a vote. Returns message
|
||||
informing user that vote has been recorded.
|
||||
|
||||
Args:
|
||||
interaction (Interaction): Interaction with this callback.
|
||||
"""
|
||||
election_name = get_election_name()
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation.CouncilVoteMsgId).where(ElectionInformation.ElectionName == election_name)
|
||||
vote_msg_id = session.scalar(stmt)
|
||||
|
||||
voted_for = None if self.values[0] == "Abstain" else int(self.values[0])
|
||||
|
||||
new_vote = Votes(
|
||||
ElectionName=election_name,
|
||||
VoterId=interaction.user.id,
|
||||
VotedForId=voted_for,
|
||||
Type=VoteType.COUNCIL,
|
||||
)
|
||||
|
||||
try:
|
||||
session.add(new_vote)
|
||||
session.commit()
|
||||
|
||||
except exc.IntegrityError:
|
||||
session.rollback()
|
||||
stmt = (
|
||||
update(Votes)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
.where(Votes.Type == VoteType.COUNCIL)
|
||||
.values(VotedForId=voted_for)
|
||||
)
|
||||
session.execute(stmt)
|
||||
session.commit()
|
||||
|
||||
vote_message_str = build_votes_str(interaction.guild)
|
||||
vote_msg: nextcord.Message = await interaction.channel.fetch_message(vote_msg_id)
|
||||
await vote_msg.edit(content=vote_message_str)
|
||||
|
||||
msg = f"You have voted for <@{voted_for}>" if voted_for is not None else "You have abstained from voting."
|
||||
|
||||
await interaction.edit(content=msg, view=None)
|
||||
|
||||
|
||||
class VoteView(nextcord.ui.View):
|
||||
"""The button to press to start your nomination."""
|
||||
|
||||
def __init__(self, guild: nextcord.Guild):
|
||||
super().__init__(timeout=None)
|
||||
self.guild = guild
|
||||
|
||||
@nextcord.ui.button(label="Vote", style=nextcord.ButtonStyle.primary, custom_id="vote")
|
||||
async def vote(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Enforces only members vote.
|
||||
|
||||
Gets election cycle, creates voting options (checking if user has voted already),
|
||||
then sends the voting view.
|
||||
|
||||
Args:
|
||||
button (nextcord.ui.Button): Unused. idk why its needed in the decorator
|
||||
interaction (nextcord.Interaction): Interaction of user who pressed the button
|
||||
"""
|
||||
# enforce members only
|
||||
if self.guild.get_role(settings.role_ids.clan_member) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{settings.role_ids.clan_member}> role to vote.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
election_name: str = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(Votes.VotedForId)
|
||||
.where(Votes.ElectionName == election_name)
|
||||
.where(Votes.VoterId == interaction.user.id)
|
||||
.where(Votes.Type == VoteType.COUNCIL)
|
||||
)
|
||||
voted_for = session.scalar(stmt)
|
||||
|
||||
stmt = select(CouncilMembers.MemberId).where(CouncilMembers.ElectionName == election_name)
|
||||
|
||||
options = [
|
||||
SelectOption(
|
||||
label=(
|
||||
f"{self.guild.get_member(nominee).display_name} ☑️"
|
||||
if voted_for == nominee
|
||||
else f"{self.guild.get_member(nominee).display_name}"
|
||||
),
|
||||
value=str(nominee),
|
||||
)
|
||||
for nominee in sorted(
|
||||
session.scalars(stmt),
|
||||
key=lambda nominee: self.guild.get_member(nominee).display_name.lower(),
|
||||
)
|
||||
]
|
||||
options.append(
|
||||
SelectOption(
|
||||
label="Abstain ☑️" if voted_for is None else "Abstain",
|
||||
value="Abstain",
|
||||
)
|
||||
)
|
||||
|
||||
view = nextcord.ui.View()
|
||||
view.add_item(VoteSelect(options))
|
||||
|
||||
await interaction.response.send_message(
|
||||
content="Please vote for a clan member!",
|
||||
view=view,
|
||||
ephemeral=True,
|
||||
)
|
||||
@@ -0,0 +1,98 @@
|
||||
"""File contains logic for creating a webhook listener, pulling from git, and updating all messages."""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from git import Repo
|
||||
from git.exc import GitCommandError
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.classes.gitea_webhook import GiteaWebhook
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.logger import dakiny_logger
|
||||
from dakiny_bot.utils import REPO_DIR, edit_clan_council_info, update_clan_messages
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import nextcord
|
||||
|
||||
app = FastAPI()
|
||||
REPO_URL = "https://gitea.cheezers.org/imcompiling/dakiny-messages.git"
|
||||
|
||||
|
||||
class ClanMessages(commands.Cog, name="Clan Messages"):
|
||||
"""
|
||||
Cog to be loaded into the bot.
|
||||
|
||||
Used to be able to have a fastapi post listener and access to the bot at
|
||||
the same time.
|
||||
"""
|
||||
|
||||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot
|
||||
self.repo_setup()
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self) -> None:
|
||||
"""Triggers when the bot is in ready state. Adds the webhook listener to FastAPI and serves."""
|
||||
app.add_api_route("/messages/", self.update_messages, methods=["POST"])
|
||||
# Bind to all interfaces, don't know the docker interface ahead of time.
|
||||
config = uvicorn.Config(app=app, host="0.0.0.0", port=5000, log_level="info") # noqa: S104
|
||||
server = uvicorn.Server(config)
|
||||
await server.serve()
|
||||
|
||||
async def update_messages(self, hook_info: GiteaWebhook) -> dict:
|
||||
"""
|
||||
Triggered by webhook.
|
||||
|
||||
Pulls from git and then calls method to update all the discord messages as described by the
|
||||
files in the git repo.
|
||||
"""
|
||||
# Get all modified/added files
|
||||
modified_files: list[str] = [
|
||||
file for files in [commit.modified + commit.added for commit in hook_info.commits] for file in files
|
||||
]
|
||||
|
||||
template_updates = {file.split("/")[1] for file in modified_files if "message_templates" in file}
|
||||
channel_updates = {file.split("/")[1] for file in modified_files if file.split("/")[1] not in template_updates}
|
||||
|
||||
try:
|
||||
self.origin.pull()
|
||||
except GitCommandError:
|
||||
# I think the git connection timed out. Get a new one.
|
||||
dakiny_logger.info("Refreshing git connection.")
|
||||
self.repo_setup()
|
||||
guild: nextcord.Guild = self.bot.get_guild(settings.params.guild_id)
|
||||
|
||||
await update_clan_messages(guild, channel_updates)
|
||||
|
||||
# if the council members template has changed, update the message
|
||||
if "council_members.txt" in template_updates:
|
||||
await edit_clan_council_info(self.bot.get_guild(settings.params.guild_id))
|
||||
|
||||
return {"message": "Successfully updated all discord messages."}
|
||||
|
||||
def repo_setup(self) -> None:
|
||||
"""Checks if the repo exists and creates repo object, clones if it does not."""
|
||||
# check if repo has been cloned. open repo object
|
||||
if Path(REPO_DIR).is_dir():
|
||||
self.repo = Repo(REPO_DIR)
|
||||
else:
|
||||
self.repo = Repo.clone_from(REPO_URL, REPO_DIR)
|
||||
|
||||
self.origin = self.repo.remote("origin")
|
||||
|
||||
if settings.params.git_branch == "test":
|
||||
self.repo.create_head("test", self.origin.refs.test).set_tracking_branch(self.origin.refs.test).checkout()
|
||||
else:
|
||||
self.repo.create_head("main", self.origin.refs.main).set_tracking_branch(self.origin.refs.main).checkout()
|
||||
|
||||
self.origin.pull()
|
||||
|
||||
|
||||
# This function will be called when this extension is loaded.
|
||||
# It is necessary to add these functions to the bot.
|
||||
def setup(bot: commands.Bot) -> None:
|
||||
"""Adds function to bot."""
|
||||
bot.add_cog(ClanMessages(bot))
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Cog loader. Adds all command cogs to the bot."""
|
||||
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.cogs.commands.record import RecordCog
|
||||
from dakiny_bot.cogs.commands.refresh import RefreshCog
|
||||
from dakiny_bot.cogs.commands.remove import RemoveCog
|
||||
from dakiny_bot.cogs.commands.request import RequestCog
|
||||
from dakiny_bot.cogs.commands.set import SetCog
|
||||
from dakiny_bot.cogs.commands.settings import SettingsCog
|
||||
from dakiny_bot.cogs.commands.test import TestCog
|
||||
from dakiny_bot.cogs.commands.time import TimeCog
|
||||
from dakiny_bot.cogs.commands.view import ViewCog
|
||||
|
||||
|
||||
# This function will be called when this extension is loaded.
|
||||
# It is necessary to add these functions to the bot.
|
||||
def setup(bot: commands.Bot) -> None:
|
||||
"""Adds all command classes to bot."""
|
||||
bot.add_cog(RecordCog(bot))
|
||||
bot.add_cog(RefreshCog(bot))
|
||||
bot.add_cog(RemoveCog())
|
||||
bot.add_cog(RequestCog(bot))
|
||||
bot.add_cog(SetCog())
|
||||
bot.add_cog(SettingsCog())
|
||||
bot.add_cog(TestCog(bot))
|
||||
bot.add_cog(TimeCog())
|
||||
bot.add_cog(ViewCog())
|
||||
@@ -0,0 +1,358 @@
|
||||
"""Contained commands and views for record commands."""
|
||||
|
||||
import nextcord
|
||||
from discord import TextInputStyle
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, record_points
|
||||
|
||||
|
||||
class RecordCog(commands.Cog, name="Record Commands"):
|
||||
"""Class holds record commands."""
|
||||
|
||||
def __init__(self, bot: commands.Bot) -> None:
|
||||
"""Default constructor for RecordCog class. Does nothing."""
|
||||
super().__init__()
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@nextcord.slash_command(guild_ids=GUILDS)
|
||||
async def record(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for record. Never called."""
|
||||
|
||||
@record.subcommand(description="Record an event and its participants.")
|
||||
async def event(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
name: str = nextcord.SlashOption(required=True, description="Name of the event that was hosted."),
|
||||
host: nextcord.Member = nextcord.SlashOption(
|
||||
required=False,
|
||||
description="An alternative host if you are recording event for someone else.",
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Create and send recording event.
|
||||
|
||||
This command creates the base event recording embed and sends a message with it and the EventView
|
||||
for gathering more information on the event.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): interaction with this command.
|
||||
name (str): Name of the event.
|
||||
host (nextcord.Member, optional): Alternative host to user using command.
|
||||
"""
|
||||
# check role
|
||||
if interaction.guild.get_role(settings.role_ids.event_host) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{settings.role_ids.event_host}> role to record an event.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
if host is None:
|
||||
host = interaction.user
|
||||
|
||||
embed: nextcord.Embed = nextcord.Embed(title=name, description="")
|
||||
embed.add_field(name="Participants", value="")
|
||||
embed.add_field(name="Non-Discord Participants", value="")
|
||||
embed.add_field(name="Hosted by", value=f"<@{host.id}>", inline=False)
|
||||
|
||||
await interaction.response.send_message(
|
||||
"Fill out event details and select all members who participated!",
|
||||
view=EventView(name, host.id),
|
||||
ephemeral=True,
|
||||
embed=embed,
|
||||
)
|
||||
|
||||
@record.subcommand(description="Record a miscellaneous point for a clan member.")
|
||||
async def point(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
activity: str = nextcord.SlashOption(
|
||||
description="The type of activity to receive points for.",
|
||||
required=True,
|
||||
choices=[
|
||||
"Clan chat activity",
|
||||
"Teaching or sharing in-game tips",
|
||||
"Recruiting efforts",
|
||||
"Successful recruitment",
|
||||
],
|
||||
),
|
||||
justification: str = nextcord.SlashOption(
|
||||
required=True,
|
||||
description="Reason to give the recipient a point.",
|
||||
max_length=int(MAX_DISCORD_MESSAGE_LENGTH / 2),
|
||||
),
|
||||
recipient: nextcord.Member = nextcord.SlashOption(
|
||||
required=False,
|
||||
description="Discord user to give point to.",
|
||||
),
|
||||
non_discord_recipient: str = nextcord.SlashOption(
|
||||
required=False, description="Non Discord user to give point to.", max_length=32
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Gives a point to the provided recipient. Sends recording message to event participation channel.
|
||||
|
||||
Only one recipient should be given point/provided to the command. Fails if not exactly one recipient
|
||||
is given.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): interaction with this command.
|
||||
activity (str): Choice list of activities to give point for.
|
||||
justification (str): Reason to give point.
|
||||
recipient (nextcord.Member): Discord member to give point to.
|
||||
non_discord_recipient (str): Non Discord member to give point to.
|
||||
"""
|
||||
# role check
|
||||
if interaction.guild.get_role(settings.role_ids.clan_member) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
f"You must have the <@&{settings.role_ids.clan_member}> role to record points.",
|
||||
ephemeral=True,
|
||||
)
|
||||
return
|
||||
|
||||
# pylint or whatever seems to think that there are lines of unreachable code. That is false.
|
||||
if recipient and non_discord_recipient:
|
||||
await interaction.response.send_message("Please only provide 1 recipient.", ephemeral=True)
|
||||
return
|
||||
elif recipient is not None: # noqa: RET505
|
||||
record_points(
|
||||
[str(recipient.id)],
|
||||
settings.point_settings.clan_points,
|
||||
PointType.CLAN,
|
||||
is_member=True,
|
||||
)
|
||||
recipient_str = f"<@{recipient.id}>"
|
||||
elif non_discord_recipient is not None:
|
||||
record_points(
|
||||
[non_discord_recipient],
|
||||
settings.point_settings.clan_points,
|
||||
PointType.CLAN,
|
||||
is_member=False,
|
||||
)
|
||||
recipient_str = f'"{non_discord_recipient}"'
|
||||
else:
|
||||
await interaction.response.send_message("You must provide a recipient.", ephemeral=True)
|
||||
return
|
||||
|
||||
event_channel: nextcord.TextChannel = interaction.guild.get_channel(settings.channel_ids.event_post)
|
||||
|
||||
msg = f"<@{interaction.user.id}> has given {recipient_str} points for the {activity} activity. Justification: {justification}" # noqa: E501
|
||||
if not msg.endswith("."):
|
||||
msg += "."
|
||||
await event_channel.send(msg)
|
||||
await interaction.response.send_message("Point has been added.", ephemeral=True)
|
||||
|
||||
|
||||
class EventView(nextcord.ui.View):
|
||||
"""
|
||||
Class handles gathering information on an event.
|
||||
|
||||
Has buttons to edit the information, cancel, and submit.
|
||||
Also contains a UserSelect object to pick discord members.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str, host_id: int):
|
||||
super().__init__(timeout=60 * 60 * 2) # timeout 2 hours
|
||||
|
||||
self.name: str = name
|
||||
self.host_id: int = host_id
|
||||
|
||||
self.event_participants = ParticipantSelect()
|
||||
|
||||
self.add_item(self.event_participants)
|
||||
|
||||
@nextcord.ui.button(label="Cancel", style=nextcord.ButtonStyle.red, row=1)
|
||||
async def cancel(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""Cancels event submission. Removes embed and view."""
|
||||
await interaction.response.edit_message("Canceled", ephemeral=True, embed=None, view=None)
|
||||
self.stop()
|
||||
|
||||
@nextcord.ui.button(label="Edit", style=nextcord.ButtonStyle.blurple, row=1)
|
||||
async def edit(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""Calls modal to update the text input information of the event."""
|
||||
await interaction.response.send_modal(ParticipantModal(interaction.message.embeds[0]))
|
||||
|
||||
@nextcord.ui.button(label="Confirm", style=nextcord.ButtonStyle.green, row=1)
|
||||
async def confirm(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Submits the event embed to the event channel.
|
||||
|
||||
Removes view and embed from recording message.
|
||||
Sends point information to database.
|
||||
"""
|
||||
if settings.point_settings.verify_events:
|
||||
verification_channel: nextcord.TextChannel = interaction.guild.get_channel(settings.channel_ids.admin)
|
||||
verification_view = EventVerification(
|
||||
self.event_participants.values.members, interaction.message.embeds[0].fields[1].value, self.host_id
|
||||
)
|
||||
await verification_channel.send(
|
||||
content="Event record request.", embed=interaction.message.embeds[0], view=verification_view
|
||||
)
|
||||
submission_response = "Event has been submitted to admins for approval."
|
||||
else:
|
||||
process_event(
|
||||
self.event_participants.values.members,
|
||||
interaction.message.embeds[0].fields[1].value,
|
||||
self.host_id,
|
||||
)
|
||||
|
||||
event_channel: nextcord.TextChannel = interaction.guild.get_channel(settings.channel_ids.event_post)
|
||||
await event_channel.send(embed=interaction.message.embeds[0])
|
||||
submission_response = "Event has been submitted."
|
||||
|
||||
await interaction.response.edit_message(content=submission_response, view=None, embed=None)
|
||||
self.stop()
|
||||
|
||||
|
||||
class EventVerification(nextcord.ui.View):
|
||||
"""Class contains code to approve/deny event submissions."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
discord_users: list[nextcord.Member],
|
||||
non_discord_users: str,
|
||||
host_id: int,
|
||||
):
|
||||
super().__init__(timeout=None, auto_defer=True)
|
||||
self.discord_users: list[nextcord.Member] = discord_users
|
||||
self.non_discord_users: str = non_discord_users
|
||||
self.host_id: int = host_id
|
||||
|
||||
@nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green)
|
||||
async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Approve button for an event submission.
|
||||
|
||||
Calls the process event function. Records who approved the event.
|
||||
Removes the view from the interaction message.
|
||||
|
||||
Args:
|
||||
button (nextcord.ui.Button): Unused.
|
||||
interaction (nextcord.Interaction): The interaction of the user clicking the button.
|
||||
"""
|
||||
process_event(self.discord_users, self.non_discord_users, self.host_id)
|
||||
event_channel: nextcord.TextChannel = interaction.guild.get_channel(settings.channel_ids.event_post)
|
||||
await event_channel.send(embed=interaction.message.embeds[0])
|
||||
|
||||
content = f"\nApproved by <@{interaction.user.id}>."
|
||||
await interaction.response.edit_message(content=content, view=None)
|
||||
|
||||
@nextcord.ui.button(label="Deny", style=nextcord.ButtonStyle.red)
|
||||
async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Deny button for an event submission. Just removes the view and logs who denied the request.
|
||||
|
||||
Args:
|
||||
button (nextcord.ui.Button): Unused.
|
||||
interaction (nextcord.Interaction): The interaction of the user clicking the button.
|
||||
"""
|
||||
content = f"\nDenied by <@{interaction.user.id}>."
|
||||
await interaction.response.edit_message(content=content, view=None)
|
||||
|
||||
|
||||
class ParticipantModal(nextcord.ui.Modal):
|
||||
"""
|
||||
This modal contains all the text edits for an event.
|
||||
|
||||
You can change the name, description, and add the usernames of participants who are not in the discord.
|
||||
"""
|
||||
|
||||
# consider turning this embed into a dict
|
||||
def __init__(self, embed: nextcord.Embed):
|
||||
super().__init__(
|
||||
"Edit the event.",
|
||||
timeout=5 * 60,
|
||||
)
|
||||
self.embed: nextcord.Embed = embed
|
||||
self.name: nextcord.ui.TextInput = nextcord.ui.TextInput(
|
||||
required=True,
|
||||
label="Event Name",
|
||||
default_value=self.embed.title,
|
||||
)
|
||||
self.description: nextcord.ui.TextInput = nextcord.ui.TextInput(
|
||||
required=False,
|
||||
label="Event Description",
|
||||
default_value=self.embed.description,
|
||||
style=TextInputStyle.paragraph,
|
||||
placeholder="Add a description if desired.",
|
||||
max_length=1000,
|
||||
)
|
||||
self.participants: nextcord.ui.TextInput = nextcord.ui.TextInput(
|
||||
required=False,
|
||||
label="Non-Discord Usernames",
|
||||
style=TextInputStyle.paragraph,
|
||||
placeholder="Please separate usernames with a new line.",
|
||||
default_value=self.embed.fields[1].value,
|
||||
)
|
||||
self.add_item(self.name)
|
||||
self.add_item(self.description)
|
||||
self.add_item(self.participants)
|
||||
|
||||
async def callback(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Edits the interaction message to contain the Non-Discord participants.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction of the callback.
|
||||
"""
|
||||
self.embed.title = self.name.value
|
||||
self.embed.description = self.description.value
|
||||
self.embed.set_field_at(index=1, name="Non-Discord Participants", value=self.participants.value)
|
||||
|
||||
await interaction.response.edit_message(embed=self.embed)
|
||||
|
||||
|
||||
class ParticipantSelect(nextcord.ui.UserSelect):
|
||||
"""A selection drop down for discord members. Updates the embed with all users selected."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
min_values=1,
|
||||
max_values=25,
|
||||
placeholder="Select all participants",
|
||||
row=0,
|
||||
)
|
||||
|
||||
async def callback(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Edits the interaction message to contain the Discord participants.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction of the callback.
|
||||
"""
|
||||
embed: nextcord.Embed = interaction.message.embeds[0]
|
||||
participants: str = "\n".join([f"<@{participant.id}>" for participant in self.values.members])
|
||||
embed.set_field_at(0, name="Participants", value=participants)
|
||||
await interaction.response.edit_message(embed=embed)
|
||||
|
||||
|
||||
def process_event(discord_users: list[nextcord.Member], non_discord_users: str, host_id: int) -> None:
|
||||
"""
|
||||
Processes all points to give to participants and host for an event.
|
||||
|
||||
Args:
|
||||
discord_users (list[nextcord.Member]): List of discord members that participated in event.
|
||||
non_discord_users (str): Newline separated list of non discord members that participated in event.
|
||||
host_id (int): Discord ID of host.
|
||||
"""
|
||||
if discord_users:
|
||||
discord_users_list: list[str] = [str(user.id) for user in discord_users if user.id is not host_id]
|
||||
record_points(
|
||||
discord_users_list,
|
||||
settings.point_settings.participate_points,
|
||||
PointType.EVENT,
|
||||
is_member=True,
|
||||
)
|
||||
|
||||
if non_discord_users:
|
||||
non_discord_users_list: list[str] = non_discord_users.split("\n")
|
||||
record_points(
|
||||
non_discord_users_list,
|
||||
settings.point_settings.participate_points,
|
||||
PointType.EVENT,
|
||||
is_member=False,
|
||||
)
|
||||
|
||||
record_points([host_id], settings.point_settings.host_points, PointType.EVENT, is_member=True)
|
||||
@@ -0,0 +1,65 @@
|
||||
"""Contained commands and views for refresh commands."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.utils import MESSAGES_DIR, edit_clan_council_info, update_clan_messages
|
||||
|
||||
|
||||
class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||
"""Class holds refresh commands."""
|
||||
|
||||
def __init__(self, bot: commands.Bot) -> None:
|
||||
"""Default constructor for RefreshCog class. Does nothing."""
|
||||
super().__init__()
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@nextcord.slash_command(default_member_permissions=nextcord.Permissions(administrator=True))
|
||||
async def refresh(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for refresh. Never called."""
|
||||
|
||||
@refresh.subcommand(description="Force refresh all of the bot managed messages.")
|
||||
async def messages(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
description="Channel to refresh messages in.",
|
||||
required=False,
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Updates all messages.
|
||||
|
||||
Calls update_clan_messages() to update all messages.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the command.
|
||||
channel (nextcord.TextChannel): channel to refresh messages in.
|
||||
"""
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
if channel is None:
|
||||
channel_updates = [
|
||||
dir_name for dir_name in os.listdir(MESSAGES_DIR) if Path(f"{MESSAGES_DIR}/{dir_name}").is_dir()
|
||||
]
|
||||
else:
|
||||
channel_updates = [channel.name]
|
||||
|
||||
await update_clan_messages(interaction.guild, channel_updates)
|
||||
await interaction.followup.send("Messages have been refreshed.", ephemeral=True)
|
||||
|
||||
@refresh.subcommand(description="Updates the current council info message.")
|
||||
async def council_info(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Edits the clan council info message.
|
||||
|
||||
Calls edit_clan_council_info().
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the command.
|
||||
"""
|
||||
await edit_clan_council_info(interaction.guild)
|
||||
await interaction.response.send_message("Clan Council Info message updated.", ephemeral=True)
|
||||
@@ -0,0 +1,67 @@
|
||||
"""Commands for removing information in the database."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
from sqlalchemy import delete, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot.database.sql_data_classes import Presences, engine
|
||||
|
||||
|
||||
class RemoveCog(commands.Cog, name="Remove Commands"):
|
||||
"""Holds the view commands."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Default constructor for RemoveCog class. Does nothing."""
|
||||
|
||||
@nextcord.slash_command(
|
||||
default_member_permissions=nextcord.Permissions(administrator=True),
|
||||
)
|
||||
async def remove(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for set. Never called."""
|
||||
|
||||
@remove.subcommand(description="Remove a presence from the database.")
|
||||
async def presence(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
presence_str: str = nextcord.SlashOption(description="The presence to remove", required=True),
|
||||
) -> None:
|
||||
"""
|
||||
Deletes the given presence id from the database.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
presence_str (str): Is SlashOption. The presence to remove. Is the ID of the presence.
|
||||
"""
|
||||
presence_id = int(presence_str)
|
||||
with Session(engine) as session:
|
||||
stmt = delete(Presences).where(Presences.Id == presence_id)
|
||||
session.execute(stmt)
|
||||
session.commit()
|
||||
|
||||
await interaction.response.send_message("Presence deleted.", ephemeral=True)
|
||||
|
||||
@presence.on_autocomplete("presence_str")
|
||||
async def presence_autocomplete(self, interaction: nextcord.Interaction, presence_str: str) -> None:
|
||||
"""
|
||||
Collects all presences that start with the presence string.
|
||||
|
||||
Sends autocomplete dict {Presence Name, Presence Id}
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
presence_str (str): String to run autocomplete on.
|
||||
"""
|
||||
with Session(engine) as session:
|
||||
stmt = select(Presences)
|
||||
presences_dict: dict[str, str] = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
|
||||
|
||||
# if empty compare string
|
||||
if not presence_str:
|
||||
await interaction.response.send_autocomplete(dict(list(presences_dict.items())[:25]))
|
||||
return
|
||||
|
||||
autofilled_presences: dict[str, str] = {
|
||||
pres: pres_id for pres, pres_id in presences_dict.items() if presence_str.lower() in pres.lower()
|
||||
}
|
||||
await interaction.response.send_autocomplete(autofilled_presences[:25])
|
||||
@@ -1,35 +1,25 @@
|
||||
"""
|
||||
Contains commands and views for request commands.
|
||||
"""
|
||||
"""Contains commands and views for request commands."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import Presences, engine
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import Presences, engine
|
||||
|
||||
|
||||
class RequestCog(commands.Cog, name="Request Commands"):
|
||||
"""
|
||||
Class holds request commands.
|
||||
"""
|
||||
"""Class holds request commands."""
|
||||
|
||||
def __init__(self, bot) -> None:
|
||||
"""
|
||||
Default constructor for RequestCog class. Does nothing.
|
||||
"""
|
||||
def __init__(self, bot: commands.Bot) -> None:
|
||||
"""Default constructor for RequestCog class. Does nothing."""
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@nextcord.slash_command()
|
||||
async def request(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Parent slash command for help. Never called.
|
||||
"""
|
||||
async def request(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for request. Never called."""
|
||||
|
||||
@request.subcommand(
|
||||
description="Request to add a presence to the bot's presence list."
|
||||
)
|
||||
@request.subcommand(description="Request to add a presence to the bot's presence list.")
|
||||
async def add_presence(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
@@ -39,7 +29,7 @@ class RequestCog(commands.Cog, name="Request Commands"):
|
||||
max_length=100,
|
||||
description="The presence you want to add.",
|
||||
),
|
||||
):
|
||||
) -> None:
|
||||
"""
|
||||
Sends a message to admins to request to add a presence.
|
||||
|
||||
@@ -47,16 +37,10 @@ class RequestCog(commands.Cog, name="Request Commands"):
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
presence (str): The presence to add.
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
content = f'<@{interaction.user.id}> would like to add presence"{presence}."'
|
||||
content = f'<@{interaction.user.id}> would like to add presence "{presence}."'
|
||||
view = PresenceChange(presence)
|
||||
await self.bot.get_channel(config.params.admin_channel_id).send(
|
||||
content=content, view=view
|
||||
)
|
||||
await interaction.response.send_message(
|
||||
"Request sent to admins.", ephemeral=True
|
||||
)
|
||||
await self.bot.get_channel(settings.channel_ids.admin).send(content=content, view=view)
|
||||
await interaction.response.send_message("Request sent to admins.", ephemeral=True)
|
||||
|
||||
@request.subcommand(description="Request to change your Dakiny nickname")
|
||||
async def change_nickname(
|
||||
@@ -68,30 +52,22 @@ class RequestCog(commands.Cog, name="Request Commands"):
|
||||
max_length=32,
|
||||
description="Your requested new nickname.",
|
||||
),
|
||||
):
|
||||
) -> None:
|
||||
"""
|
||||
Sends a message to admins to request a nickname change.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
new_username(str): The username to change to.
|
||||
new_nickname(str): The username to change to.
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
content = f'<@{interaction.user.id}> would like to change their username to "{new_nickname}."'
|
||||
view = UsernameRequest(interaction.user.id, new_nickname)
|
||||
await self.bot.get_channel(config.params.admin_channel_id).send(
|
||||
content=content, view=view
|
||||
)
|
||||
await interaction.response.send_message(
|
||||
"Request sent to admins.", ephemeral=True
|
||||
)
|
||||
await self.bot.get_channel(settings.channel_ids.admin).send(content=content, view=view)
|
||||
await interaction.response.send_message("Request sent to admins.", ephemeral=True)
|
||||
|
||||
|
||||
class UsernameRequest(nextcord.ui.View):
|
||||
"""
|
||||
View provides approve and deny buttons and action for a username change request.
|
||||
"""
|
||||
"""View provides approve and deny buttons and action for a username change request."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -103,11 +79,11 @@ class UsernameRequest(nextcord.ui.View):
|
||||
self.new_nickname = new_nickname
|
||||
|
||||
@nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green)
|
||||
async def approve(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
):
|
||||
async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Approve button for a nickname change request. Changes the target's nickname to self.new_nickname.
|
||||
Approve button for a nickname change request.
|
||||
|
||||
Changes the target's nickname to self.new_nickname.
|
||||
Catches an error if the target as a higher role than the bot.
|
||||
Removes the view from the interaction message.
|
||||
|
||||
@@ -119,10 +95,7 @@ class UsernameRequest(nextcord.ui.View):
|
||||
if user is not None:
|
||||
try:
|
||||
await user.edit(nick=self.new_nickname)
|
||||
content = (
|
||||
interaction.message.content
|
||||
+ f"\nApproved by <@{interaction.user.id}>."
|
||||
)
|
||||
content = interaction.message.content + f"\nApproved by <@{interaction.user.id}>."
|
||||
await interaction.response.edit_message(content=content, view=None)
|
||||
except nextcord.errors.Forbidden:
|
||||
await interaction.response.send_message(
|
||||
@@ -133,17 +106,15 @@ class UsernameRequest(nextcord.ui.View):
|
||||
interaction.message.content
|
||||
+ "\n\nFailed. User has too high permissions for bot to change nickname."
|
||||
)
|
||||
await interaction.followup.edit_message(
|
||||
interaction.message.id, content=content, view=None
|
||||
)
|
||||
await interaction.followup.edit_message(interaction.message.id, content=content, view=None)
|
||||
else:
|
||||
await interaction.response.edit_message(
|
||||
content="An error occured while changing the user's nickname.",
|
||||
content="An error occurred while changing the user's nickname.",
|
||||
view=None,
|
||||
)
|
||||
|
||||
@nextcord.ui.button(label="Deny", style=nextcord.ButtonStyle.red)
|
||||
async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
|
||||
async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Deny button for a nickname request. Just removes the view and logs who denied the request.
|
||||
|
||||
@@ -156,9 +127,7 @@ class UsernameRequest(nextcord.ui.View):
|
||||
|
||||
|
||||
class PresenceChange(nextcord.ui.View):
|
||||
"""
|
||||
View provides approve and deny buttons and action for a username change request.
|
||||
"""
|
||||
"""View provides approve and deny buttons and action for a username change request."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -168,29 +137,26 @@ class PresenceChange(nextcord.ui.View):
|
||||
self.presence = presence
|
||||
|
||||
@nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green)
|
||||
async def approve(
|
||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||
):
|
||||
async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Approve button for a presence add request. Adds the presence to the database.
|
||||
Approve button for a presence add request.
|
||||
|
||||
Adds the presence to the database.
|
||||
Removes the view from the interaction message.
|
||||
|
||||
Args:
|
||||
button (nextcord.ui.Button): Unused.
|
||||
interaction (nextcord.Interaction): The interaction of the user clicking the button.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
session.add(Presences(Presence=self.presence))
|
||||
session.commit()
|
||||
|
||||
content = (
|
||||
interaction.message.content + f"\nApproved by <@{interaction.user.id}>."
|
||||
)
|
||||
content = interaction.message.content + f"\nApproved by <@{interaction.user.id}>."
|
||||
await interaction.response.edit_message(content=content, view=None)
|
||||
|
||||
@nextcord.ui.button(label="Deny", style=nextcord.ButtonStyle.red)
|
||||
async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
|
||||
async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None: # noqa: ARG002
|
||||
"""
|
||||
Deny button for a presence add request. Just removes the view and logs who denied the request.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"""
|
||||
Contains commands and views for set commands.
|
||||
"""
|
||||
"""Contains commands and views for set commands."""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
@@ -10,25 +8,19 @@ from sqlalchemy import delete, select
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot import birthday_list
|
||||
from database_setup.sql_data_classes import UserBirthday, engine
|
||||
from dakiny_bot.app import birthday_list
|
||||
from dakiny_bot.database.sql_data_classes import UserBirthday, engine
|
||||
|
||||
|
||||
class setCog(commands.Cog, name="Set Commands"):
|
||||
"""
|
||||
Class holds set commands.
|
||||
"""
|
||||
class SetCog(commands.Cog, name="Set Commands"):
|
||||
"""Class holds set commands."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
Default constructor for SetCog class. Does nothing.
|
||||
"""
|
||||
"""Default constructor for SetCog class. Does nothing."""
|
||||
|
||||
@nextcord.slash_command()
|
||||
async def set(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Parent slash command for set. Never called.
|
||||
"""
|
||||
async def set(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for set. Never called."""
|
||||
|
||||
@set.subcommand(description="Sets your birth month and day for the Birthday Fun. Use 0/0 to remove yourself.")
|
||||
async def birthday(
|
||||
@@ -36,7 +28,7 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
interaction: nextcord.Interaction,
|
||||
month: int = nextcord.SlashOption(required=True, min_value=0, max_value=12, description="Your birth month."),
|
||||
day: int = nextcord.SlashOption(required=True, min_value=0, max_value=31, description="Your birth day."),
|
||||
):
|
||||
) -> None:
|
||||
"""
|
||||
Sets a user's birthday in the database. Removes on input 0/0. If birthday is today, adds to the birthday_list.
|
||||
|
||||
@@ -45,7 +37,6 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
month (int, optional): The month a user was born. Is SlashOption.
|
||||
day (int, optional): The day a user was born. Is SlashOption.
|
||||
"""
|
||||
|
||||
# Must be deferred, apparently datetime takes a little bit on invalid dates.
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
@@ -58,9 +49,9 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
return
|
||||
|
||||
# check if valid day
|
||||
today = datetime.today()
|
||||
today = datetime.now(tz=UTC)
|
||||
try:
|
||||
birthday = datetime(today.year, month, day)
|
||||
birthday = datetime(today.year, month, day, tzinfo=UTC)
|
||||
except ValueError:
|
||||
await interaction.followup.send(f"Invalid date: {month}/{day}.", ephemeral=True)
|
||||
return
|
||||
@@ -0,0 +1,379 @@
|
||||
"""Contains commands and views for settings commands."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.utils import GUILDS
|
||||
|
||||
|
||||
class SettingsCog(commands.Cog, name="Settings Commands"):
|
||||
"""Class holds settings commands."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Default constructor for SettingsCog class. Does nothing."""
|
||||
|
||||
@nextcord.slash_command(guild_ids=GUILDS, default_member_permissions=nextcord.Permissions(administrator=True))
|
||||
async def settings(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for settings. Never called."""
|
||||
|
||||
@settings.subcommand()
|
||||
async def channel_ids(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Subcommand parent. Never called."""
|
||||
|
||||
@channel_ids.subcommand(description="Sets channel that bot sends verification requests to admins.")
|
||||
async def admin(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
required=False, description="Channel to set to. If left blank, uses current channel."
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings channel_ids.admin value to given channel id or current channel id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
channel (nextcord.TextChannel, optional): Channel to set in settings.
|
||||
"""
|
||||
channel_id = interaction.channel_id if channel is None else channel.id
|
||||
settings.channel_ids.admin = channel_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Admin verification channel set to <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@channel_ids.subcommand(description="Sets announcement channel.")
|
||||
async def announcement(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
required=False, description="Channel to set to. If left blank, uses current channel."
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings channel_ids.announcement value to given channel id or current channel id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
channel (nextcord.TextChannel, optional): Channel to set in settings.
|
||||
"""
|
||||
channel_id = interaction.channel_id if channel is None else channel.id
|
||||
settings.channel_ids.announcement = channel_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Announcement channel set to <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@channel_ids.subcommand(description="Sets clan info channel. Channel used for tracking current council.")
|
||||
async def clan_info(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
required=False, description="Channel to set to. If left blank, uses current channel."
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings channel_ids.clan_info value to given channel id or current channel id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
channel (nextcord.TextChannel, optional): Channel to set in settings.
|
||||
"""
|
||||
channel_id = interaction.channel_id if channel is None else channel.id
|
||||
settings.channel_ids.clan_info = channel_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Clan information channel set to <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@channel_ids.subcommand(
|
||||
description="Sets event post channel. Channel is where event tracking information is posted."
|
||||
)
|
||||
async def event_post(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
required=False, description="Channel to set to. If left blank, uses current channel."
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings channel_ids.event_post value to given channel id or current channel id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
channel (nextcord.TextChannel, optional): Channel to set in settings.
|
||||
"""
|
||||
channel_id = interaction.channel_id if channel is None else channel.id
|
||||
settings.channel_ids.event_post = channel_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event posting channel set to <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@channel_ids.subcommand(description="Sets general channel.")
|
||||
async def general(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
required=False, description="Channel to set to. If left blank, uses current channel."
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings channel_ids.general value to given channel id or current channel id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
channel (nextcord.TextChannel, optional): Channel to set in settings.
|
||||
"""
|
||||
channel_id = interaction.channel_id if channel is None else channel.id
|
||||
settings.channel_ids.general = channel_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"General channel set to <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@channel_ids.subcommand(description="Sets voting channel. Channel used as parent for voting threads.")
|
||||
async def voting(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel = nextcord.SlashOption(
|
||||
required=False, description="Channel to set to. If left blank, uses current channel."
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings channel_ids.voting value to given channel id or current channel id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
channel (nextcord.TextChannel, optional): Channel to set in settings.
|
||||
"""
|
||||
channel_id = interaction.channel_id if channel is None else channel.id
|
||||
settings.channel_ids.voting = channel_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Voting channel set to <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@settings.subcommand()
|
||||
async def point_settings(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Subcommand parent. Never called."""
|
||||
|
||||
@point_settings.subcommand(description="Sets Points value.")
|
||||
async def clan_points(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
points: int = nextcord.SlashOption(
|
||||
required=True, description="Number of Clan Points the recipient earns.", min_value=0
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.clan_points to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
points (int): Number of points to assign to PointSettings.points.
|
||||
"""
|
||||
settings.point_settings.clan_points = points
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Points set to {points}.", ephemeral=True)
|
||||
|
||||
@point_settings.subcommand(description="Sets Event Weekly Limit value for Clan Points.")
|
||||
async def clan_points_weekly_limit(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
points: int = nextcord.SlashOption(
|
||||
required=True, description="Number of Clan Points a clan member can earn in a week.", min_value=0
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.clan_points_weekly_limit to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
points (int): Number of points to set.
|
||||
"""
|
||||
settings.point_settings.clan_points_weekly_limit = points
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Clan Points Weekly Limit set to {points}.", ephemeral=True)
|
||||
|
||||
@point_settings.subcommand(description="Sets Event Weekly Limit value.")
|
||||
async def events_weekly_limit(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
points: int = nextcord.SlashOption(
|
||||
required=True, description="Number of Event Points a clan member can earn in a week.", min_value=0
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.events_weekly_limit to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
points (int): Number of points to set.
|
||||
"""
|
||||
settings.point_settings.events_weekly_limit = points
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event Weekly Limit set to {points}.", ephemeral=True)
|
||||
|
||||
@point_settings.subcommand(description="Sets Event Host Points value.")
|
||||
async def host_points(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
points: int = nextcord.SlashOption(
|
||||
required=True, description="Number of Event Points a host earns when hosting event.", min_value=0
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.host_points to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
points (int): Number of points to set.
|
||||
"""
|
||||
settings.point_settings.host_points = points
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event Host Points set to {points}.", ephemeral=True)
|
||||
|
||||
@point_settings.subcommand(description="Sets Event Participation Points value.")
|
||||
async def participate_points(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
points: int = nextcord.SlashOption(
|
||||
required=True,
|
||||
description="Number of Event Points a participant earns when attending an event.",
|
||||
min_value=0,
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.participate_points to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
points (int): Number of points to set.
|
||||
"""
|
||||
settings.point_settings.participate_points = points
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event Participation Points set to {points}.", ephemeral=True)
|
||||
|
||||
@point_settings.subcommand(description="Sets whether to verify a clan point entry.")
|
||||
async def verify_clan_points(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
do_verification: bool = nextcord.SlashOption( # noqa: FBT001
|
||||
required=True,
|
||||
description="Whether an event should be verified or not.",
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.verify_clan_points to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
do_verification (bool): If the bot should verify events.
|
||||
"""
|
||||
settings.point_settings.verify_clan_points = do_verification
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event verification set to {do_verification}.", ephemeral=True)
|
||||
|
||||
@point_settings.subcommand(description="Sets whether an event.")
|
||||
async def verify_events(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
do_verification: bool = nextcord.SlashOption( # noqa: FBT001
|
||||
required=True,
|
||||
description="Whether an event should be verified or not.",
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings point_settings.verify_events to the given number of points.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
do_verification (bool): If the bot should verify events.
|
||||
"""
|
||||
settings.point_settings.verify_events = do_verification
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event verification set to {do_verification}.", ephemeral=True)
|
||||
|
||||
@settings.subcommand()
|
||||
async def role_ids(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Subcommand parent. Never called."""
|
||||
|
||||
@role_ids.subcommand(description="Sets Clan Council role id.")
|
||||
async def clan_council(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
role: nextcord.Role = nextcord.SlashOption(required=True, description="Role to set."),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings role_ids.clan_council to the given role id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
role (nextcord.TextChannel): Role to set in settings.
|
||||
"""
|
||||
role_id = role.id
|
||||
settings.role_ids.clan_council = role_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Clan Council role set to <@&{role_id}>.", ephemeral=True)
|
||||
|
||||
@role_ids.subcommand(description="Sets Clan Council Elect role id.")
|
||||
async def clan_council_elect(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
role: nextcord.Role = nextcord.SlashOption(required=True, description="Role to set."),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings role_ids.clan_council_elect to the given role id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
role (nextcord.TextChannel): Role to set in settings.
|
||||
"""
|
||||
role_id = role.id
|
||||
settings.role_ids.clan_council_elect = role_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Clan Council Elect role set to <@&{role_id}>.", ephemeral=True)
|
||||
|
||||
@role_ids.subcommand(description="Sets Clan Member role id.")
|
||||
async def clan_member(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
role: nextcord.Role = nextcord.SlashOption(required=True, description="Role to set."),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings role_ids.clan_member to the given role id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
role (nextcord.TextChannel): Role to set in settings.
|
||||
"""
|
||||
role_id = role.id
|
||||
settings.role_ids.clan_member = role_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Clan Member role set to <@&{role_id}>.", ephemeral=True)
|
||||
|
||||
@role_ids.subcommand(description="Sets Event Host role id.")
|
||||
async def event_host(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
role: nextcord.Role = nextcord.SlashOption(required=True, description="Role to set."),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings role_ids.event_host to the given role id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
role (nextcord.TextChannel): Role to set in settings.
|
||||
"""
|
||||
role_id = role.id
|
||||
settings.role_ids.event_host = role_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"Event Host role set to <@&{role_id}>.", ephemeral=True)
|
||||
|
||||
@role_ids.subcommand(description="Sets High Council role id.")
|
||||
async def high_council(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
role: nextcord.Role = nextcord.SlashOption(required=True, description="Role to set."),
|
||||
) -> None:
|
||||
"""
|
||||
Sets DakinySettings role_ids.high_council to the given role id.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of command.
|
||||
role (nextcord.TextChannel): Role to set in settings.
|
||||
"""
|
||||
role_id = role.id
|
||||
settings.role_ids.high_council = role_id
|
||||
settings.save()
|
||||
await interaction.response.send_message(f"High Council role set to <@&{role_id}>.", ephemeral=True)
|
||||
@@ -0,0 +1,153 @@
|
||||
"""Commands for testing."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import application_checks, commands
|
||||
|
||||
from dakiny_bot.classes.election import Election
|
||||
from dakiny_bot.cogs.loops import daily_loop
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.utils import GUILDS, get_active_election_cycle, get_quarter_name
|
||||
|
||||
ME = 206602713511886849
|
||||
|
||||
|
||||
def is_me(): # noqa: ANN201
|
||||
"""Predicate that makes sure only I can run the test commands."""
|
||||
|
||||
def predicate(interaction: nextcord.Interaction) -> bool:
|
||||
return interaction.user.id == ME
|
||||
|
||||
return application_checks.check(predicate)
|
||||
|
||||
|
||||
class TestCog(commands.Cog, name="Test commands."):
|
||||
"""Class holds commands for testing."""
|
||||
|
||||
def __init__(self, bot: commands.Bot) -> None:
|
||||
"""Default constructor for HelpCog class. Does nothing."""
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@nextcord.slash_command(guild_ids=GUILDS)
|
||||
async def test(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for help. Never called."""
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def election_start(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Force starts election.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
cycle = Election(
|
||||
get_active_election_cycle(),
|
||||
self.bot.get_guild(settings.params.guild_id),
|
||||
)
|
||||
await cycle.election_start_action()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def voting_start(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Force starts voting.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
cycle = Election(
|
||||
get_active_election_cycle(),
|
||||
self.bot.get_guild(settings.params.guild_id),
|
||||
)
|
||||
await cycle.voting_start_action()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def voting_end(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Force ends voting.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
cycle = Election(
|
||||
get_active_election_cycle(),
|
||||
self.bot.get_guild(settings.params.guild_id),
|
||||
)
|
||||
await cycle.voting_end_action()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def highcouncil_vote(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Force starts highcouncil voting.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
cycle = Election(
|
||||
get_active_election_cycle(),
|
||||
self.bot.get_guild(settings.params.guild_id),
|
||||
)
|
||||
await cycle.highcouncil_election_start_action()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def election_reminder(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Forces election reminder.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
cycle = Election(
|
||||
get_active_election_cycle(),
|
||||
self.bot.get_guild(settings.params.guild_id),
|
||||
)
|
||||
await cycle.election_reminder()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def daily(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Forces daily function.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
dl = daily_loop.DailyLoop(self.bot)
|
||||
await dl.daily_loop()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def term_start(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Forces term start.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
cycle = Election(
|
||||
get_active_election_cycle(),
|
||||
self.bot.get_guild(settings.params.guild_id),
|
||||
)
|
||||
await cycle.term_start_action()
|
||||
await interaction.send("Test command sent.", ephemeral=True)
|
||||
|
||||
@test.subcommand()
|
||||
@is_me()
|
||||
async def get_quarter_name(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Tests getting the quarter name.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
name = get_quarter_name()
|
||||
await interaction.send(name)
|
||||
@@ -0,0 +1,109 @@
|
||||
"""Contains commands for time commands."""
|
||||
|
||||
from datetime import MAXYEAR, MINYEAR, UTC, datetime
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.utils import GUILDS
|
||||
|
||||
|
||||
class TimeCog(commands.Cog, name="Time Commands"):
|
||||
"""Class holds time commands."""
|
||||
|
||||
@nextcord.slash_command(guild_ids=GUILDS)
|
||||
async def time(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command. Never called."""
|
||||
|
||||
@time.subcommand(
|
||||
description="Get a discord timestamp of the given game time. If date information is left blank, uses current day." # noqa: E501
|
||||
)
|
||||
async def at( # noqa: PLR0913
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
hour: int = nextcord.SlashOption(
|
||||
description="The hour you want a timestamp of. Given in gametime/UTC.",
|
||||
min_value=0,
|
||||
max_value=23,
|
||||
required=True,
|
||||
),
|
||||
minute: int = nextcord.SlashOption(
|
||||
description="The minute you want a timestamp of. Given in gametime/UTC.",
|
||||
min_value=0,
|
||||
max_value=59,
|
||||
required=True,
|
||||
),
|
||||
year: int = nextcord.SlashOption(
|
||||
description="Year to make timestamp of.", required=False, min_value=MINYEAR, max_value=MAXYEAR
|
||||
),
|
||||
month: int = nextcord.SlashOption(
|
||||
description="Month to make timestamp of.", required=False, min_value=1, max_value=12
|
||||
),
|
||||
day: int = nextcord.SlashOption(
|
||||
description="Day to make timestamp of.", required=False, min_value=1, max_value=31
|
||||
),
|
||||
ephemeral: bool = nextcord.SlashOption( # noqa: FBT001
|
||||
description="Whether the replying message will be public or not.", required=False, default=True
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Replies with a discord timestamp of given UTC time.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the command.
|
||||
hour (int): The hour in UTC to make the timestamp of..
|
||||
minute (int): The minute in UTC to make the timestamp of..
|
||||
year (int): The year to make the timestamp of.
|
||||
month (int): The month to make the timestamp of.
|
||||
day (int): The day to make the timestamp of.
|
||||
ephemeral (bool): Whether the response is ephemeral or not.
|
||||
"""
|
||||
gametime_today: datetime = datetime.now(tz=UTC).replace(hour=hour, minute=minute)
|
||||
|
||||
if year is not None:
|
||||
gametime_today = gametime_today.replace(year=year)
|
||||
|
||||
if month is not None and day is not None:
|
||||
try:
|
||||
gametime_today = gametime_today.replace(month=month, day=day)
|
||||
except ValueError:
|
||||
await interaction.response.send_message(f"Day {day} is out of range for month {month}.", ephemeral=True)
|
||||
return
|
||||
else:
|
||||
if month is not None:
|
||||
try:
|
||||
gametime_today = gametime_today.replace(month=month)
|
||||
except ValueError:
|
||||
await interaction.response.send_message(
|
||||
f"Today ({gametime_today.day}) is out of range for month {month}.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
if day is not None:
|
||||
try:
|
||||
gametime_today = gametime_today.replace(day=day)
|
||||
except ValueError:
|
||||
await interaction.response.send_message(
|
||||
f"Day {day} is out of range for this month {gametime_today.month}.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
await interaction.response.send_message(content=f"<t:{int(gametime_today.timestamp())}:t>", ephemeral=ephemeral)
|
||||
|
||||
@time.subcommand(description="Get the current time in game.")
|
||||
async def gametime(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
ephemeral: bool = nextcord.SlashOption( # noqa: FBT001
|
||||
description="Whether the replying message will be public or not.", required=False, default=True
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Replies with the current time in game.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the command.
|
||||
ephemeral: (bool): Whether the response is ephemeral or not.
|
||||
"""
|
||||
gametime = datetime.now(tz=UTC)
|
||||
await interaction.response.send_message(content=f"{gametime.hour}:{gametime.minute}", ephemeral=ephemeral)
|
||||
@@ -0,0 +1,297 @@
|
||||
"""Commands for viewing information in the database."""
|
||||
|
||||
import nextcord
|
||||
import pandas as pd
|
||||
from nextcord.ext import commands
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot.database.sql_data_classes import (
|
||||
Points,
|
||||
Presences,
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from dakiny_bot.utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, VoteType
|
||||
|
||||
|
||||
class ViewCog(commands.Cog, name="View Commands"):
|
||||
"""Holds the view commands."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Default constructor for ViewCog class. Does nothing."""
|
||||
|
||||
@nextcord.slash_command(guild_ids=GUILDS)
|
||||
async def view(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for set. Never called."""
|
||||
|
||||
@view.subcommand(description="Show event points.")
|
||||
async def event_points(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
quarter_name: str = nextcord.SlashOption(
|
||||
description="The quarter to view",
|
||||
required=False,
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
View the event points.
|
||||
|
||||
Builds a message with the event points for the quarter that matches with quarter_name.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
quarter_name (str, optional): Same of quarter to autofill with. Is SlashOption.
|
||||
"""
|
||||
# just in case
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
with Session(engine) as session:
|
||||
if quarter_name:
|
||||
ppdf = pd.read_sql_query(
|
||||
sql=session.query(Points).where(Points.QuarterName.startswith(quarter_name)).statement,
|
||||
con=engine,
|
||||
)
|
||||
else:
|
||||
ppdf = pd.read_sql_query(
|
||||
sql=session.query(Points).statement,
|
||||
con=engine,
|
||||
)
|
||||
|
||||
if ppdf.empty:
|
||||
await interaction.followup.send(f'Quarter "{quarter_name}" is invalid.', ephemeral=True)
|
||||
return
|
||||
|
||||
quarters = ppdf.groupby("QuarterName")
|
||||
content = create_points_string(interaction, quarters, PointType.EVENT)
|
||||
|
||||
if len(content) > MAX_DISCORD_MESSAGE_LENGTH:
|
||||
await interaction.followup.send("Message length is too long, please select search to limit results.")
|
||||
return
|
||||
|
||||
await interaction.followup.send(content=content, ephemeral=True)
|
||||
|
||||
@view.subcommand(description="Show event points.")
|
||||
async def clan_points(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
quarter_name: str = nextcord.SlashOption(
|
||||
description="The quarter to view",
|
||||
required=False,
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
View the clan points.
|
||||
|
||||
Builds a message with the clan points for the quarter that matches with quarter_name.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
quarter_name (str, optional): Same of quarter to autofill with. Is SlashOption.
|
||||
"""
|
||||
# just in case
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
with Session(engine) as session:
|
||||
if quarter_name:
|
||||
ppdf = pd.read_sql_query(
|
||||
sql=session.query(Points).where(Points.QuarterName.startswith(quarter_name)).statement,
|
||||
con=engine,
|
||||
)
|
||||
else:
|
||||
ppdf = pd.read_sql_query(
|
||||
sql=session.query(Points).statement,
|
||||
con=engine,
|
||||
)
|
||||
|
||||
if ppdf.empty:
|
||||
await interaction.followup.send(f'Quarter "{quarter_name}" is invalid.', ephemeral=True)
|
||||
return
|
||||
|
||||
quarters = ppdf.groupby("QuarterName")
|
||||
content = create_points_string(interaction, quarters, PointType.CLAN)
|
||||
|
||||
if len(content) > MAX_DISCORD_MESSAGE_LENGTH:
|
||||
await interaction.followup.send("Message length is too long, please select search to limit results.")
|
||||
return
|
||||
|
||||
await interaction.followup.send(content=content, ephemeral=True)
|
||||
|
||||
@view.subcommand(description="Show all possible presence choices.")
|
||||
async def presences(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
search: str = nextcord.SlashOption(
|
||||
description="A word or string to search for in the presences.",
|
||||
required=False,
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
Gathers all presences from the database and responds with a message showing them.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Integration): User's interaction with the command.
|
||||
search (str): string to search for in presences. Is SlashOption.
|
||||
"""
|
||||
# might take a while depending on number of presences
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(Presences.Presence)
|
||||
presences = session.scalars(stmt)
|
||||
|
||||
if search:
|
||||
message = "\n".join([presence for presence in presences if search.lower() in presence.lower()])
|
||||
else:
|
||||
message = "\n".join(list(presences))
|
||||
|
||||
await interaction.followup.send(content=message, ephemeral=True)
|
||||
|
||||
@view.subcommand(description="Shows all voters and who they voted for in a given election.")
|
||||
async def votes(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
election_name: str = nextcord.SlashOption(
|
||||
required=True, description="The election you want to view votes for."
|
||||
),
|
||||
election_type: str = nextcord.SlashOption(
|
||||
required=True,
|
||||
description="The election type. Council, Discord Manager, or Clan Leader.",
|
||||
choices=VoteType,
|
||||
),
|
||||
) -> None:
|
||||
"""
|
||||
View all voters and who they voted for.
|
||||
|
||||
Takes in an election name and sends a response message to the user with a list of people who voted in that
|
||||
election and who they voted for. Notes those tho abstained. Tells a user if the election is invalid. Uses
|
||||
autocompletion to assist with getting elections.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): User's interaction with the command.
|
||||
election_name (str): Is SlashOption. The name of the election to view votes for.
|
||||
election_type(str): Is SlashOption. The type of election to search for. Choice from StrEnum VoteType.
|
||||
"""
|
||||
stmt = select(Votes).where(Votes.ElectionName == election_name).where(Votes.Type == election_type)
|
||||
|
||||
with Session(engine) as session:
|
||||
# Check if election exists.
|
||||
if session.scalar(stmt) is None:
|
||||
await interaction.response.send_message(f"Invalid election: {election_name}.", ephemeral=True)
|
||||
return
|
||||
|
||||
votes = session.scalars(stmt)
|
||||
content = ""
|
||||
for vote in votes:
|
||||
content += (
|
||||
f"<@{vote.VoterId}> voted for <@{vote.VotedForId}>.\n"
|
||||
if vote.VotedForId is not None
|
||||
else f"<@{vote.VoterId}> abstained from voted.\n"
|
||||
)
|
||||
|
||||
await interaction.response.send_message(content=content, ephemeral=True)
|
||||
|
||||
@votes.on_autocomplete("election_name")
|
||||
async def election_autocomplete(self, interaction: nextcord.Interaction, election_name: str) -> None:
|
||||
"""
|
||||
Collects all elections that start with the election string.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
election_name (str): String to run autocomplete on.
|
||||
"""
|
||||
with Session(engine) as session:
|
||||
stmt = select(Votes.ElectionName).distinct()
|
||||
elections = session.scalars(stmt)
|
||||
|
||||
# if empty compare string
|
||||
if not election_name:
|
||||
await interaction.response.send_autocomplete(list(elections)[:25])
|
||||
return
|
||||
|
||||
autofilled_elections: list[str] = [
|
||||
election for election in elections if election.lower().startswith(election_name.lower())
|
||||
]
|
||||
await interaction.response.send_autocomplete(autofilled_elections[:25])
|
||||
|
||||
@event_points.on_autocomplete("quarter_name")
|
||||
@clan_points.on_autocomplete("quarter_name")
|
||||
async def event_points_autocomplete(self, interaction: nextcord.Interaction, quarter_name: str) -> None:
|
||||
"""
|
||||
Collects all elections that start with the election string.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
quarter_name (str): String to run autocomplete on.
|
||||
"""
|
||||
with Session(engine) as session:
|
||||
stmt = select(Points.QuarterName).distinct()
|
||||
quarters = session.scalars(stmt)
|
||||
|
||||
# if empty compare string
|
||||
if not quarter_name:
|
||||
await interaction.response.send_autocomplete(list(quarters)[:25])
|
||||
return
|
||||
|
||||
autofilled_quarters: list[str] = [
|
||||
quarter for quarter in quarters if quarter.lower().startswith(quarter_name.lower())
|
||||
]
|
||||
await interaction.response.send_autocomplete(autofilled_quarters[:25])
|
||||
|
||||
|
||||
def create_points_string(interaction: nextcord.Interaction, quarters: any, point_type: PointType) -> str:
|
||||
"""
|
||||
Creates the string to show how many clan/event points users have.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Discord interaction of the command.
|
||||
quarters (any): Pandas objects grouped by quarters.
|
||||
point_type (PointType): The type of points to create the message for.
|
||||
|
||||
Returns:
|
||||
str: The string with the message content.
|
||||
"""
|
||||
content: str = ""
|
||||
for quarter in quarters.groups:
|
||||
content += f"**{quarter}**\n"
|
||||
unsorted_all = quarters.get_group(quarter).groupby("DiscordMember")
|
||||
members = unsorted_all.get_group(name=True)
|
||||
|
||||
# there can be no non-discord members sometimes.
|
||||
try:
|
||||
sorted_non_members = unsorted_all.get_group(name=False).sort_values(by="UserId")
|
||||
except KeyError:
|
||||
sorted_non_members = None
|
||||
sorted_members = members.sort_values(
|
||||
by="UserId",
|
||||
key=lambda user_ids: ([member_lambda_string(interaction.guild, user_id) for user_id in user_ids]),
|
||||
)
|
||||
sorted_all = pd.concat([sorted_members, sorted_non_members], ignore_index=True, sort=False)
|
||||
for row in sorted_all.itertuples():
|
||||
points = row.EventPoints if point_type == PointType.EVENT else row.ClanPoints
|
||||
discord_member = row.DiscordMember
|
||||
if points > 0:
|
||||
content += f"<@{row.UserId}>: {points}\n" if discord_member else f"{row.UserId}: {points}\n"
|
||||
content += "\n"
|
||||
return content
|
||||
|
||||
|
||||
def member_lambda_string(guild: nextcord.Guild, user_id: int) -> str:
|
||||
"""
|
||||
Finds a user in a guild and returns the display name.
|
||||
|
||||
Returns the user id in string form if user is no longer in guild.
|
||||
I don't know if I like this name very much.
|
||||
|
||||
Args:
|
||||
guild (nextcord.Guild): Guild object to find the user in.
|
||||
user_id (int): User id to get display name of.
|
||||
|
||||
Returns:
|
||||
str: String to use for sorting.
|
||||
"""
|
||||
try:
|
||||
return guild.get_member(int(user_id)).display_name.lower()
|
||||
except AttributeError:
|
||||
# The user is no longer a part of the guild
|
||||
return str(user_id)
|
||||
@@ -0,0 +1,12 @@
|
||||
"""Initializing code for all loops."""
|
||||
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot.cogs.loops.bot_presence import BotPresence
|
||||
from dakiny_bot.cogs.loops.daily_loop import DailyLoop
|
||||
|
||||
|
||||
def setup(bot: commands.Bot) -> None:
|
||||
"""Adds functions to bot."""
|
||||
bot.add_cog(BotPresence(bot))
|
||||
bot.add_cog(DailyLoop(bot))
|
||||
@@ -1,13 +1,11 @@
|
||||
"""
|
||||
Functions for controlling the bot's presence. Also contains the loop.
|
||||
"""
|
||||
"""Functions for controlling the bot's presence. Also contains the loop."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands, tasks
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from database_setup.sql_data_classes import Presences, engine
|
||||
from dakiny_bot.database.sql_data_classes import Presences, engine
|
||||
|
||||
|
||||
class BotPresence(commands.Cog, name="Bot Presence"):
|
||||
@@ -17,32 +15,24 @@ class BotPresence(commands.Cog, name="Bot Presence"):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_guild_join(
|
||||
self, guild: nextcord.Guild
|
||||
): # pylint: disable=unused-argument
|
||||
async def on_guild_join(self, guild: nextcord.Guild) -> None: # noqa: ARG002
|
||||
"""Listener for Guild Join. Updated presence on guild join."""
|
||||
await self.change_presence()
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
async def on_ready(self) -> None:
|
||||
"""Starts the loop when bot is ready."""
|
||||
await self.bot.wait_until_ready()
|
||||
# pylint doesn't recognize that periodic_change_presense is subclassed from tasks.loop.
|
||||
self.periodic_change_presence.start() # pylint: disable=no-member
|
||||
self.periodic_change_presence.start()
|
||||
|
||||
@tasks.loop(minutes=5)
|
||||
async def periodic_change_presence(self):
|
||||
async def periodic_change_presence(self) -> None:
|
||||
"""Loops every 5 minutes and changes presence."""
|
||||
await self.change_presence()
|
||||
|
||||
async def change_presence(self):
|
||||
async def change_presence(self) -> None:
|
||||
"""Randomly chooses a presence and updates bot's presence."""
|
||||
|
||||
with Session(engine) as session:
|
||||
presence = session.scalar(
|
||||
select(Presences.Presence).order_by(func.random())
|
||||
)
|
||||
presence = session.scalar(select(Presences.Presence).order_by(func.random()))
|
||||
|
||||
await self.bot.change_presence(
|
||||
activity=nextcord.CustomActivity(name="Custom Status", state=presence)
|
||||
)
|
||||
await self.bot.change_presence(activity=nextcord.CustomActivity(presence))
|
||||
@@ -0,0 +1,135 @@
|
||||
"""Defines the daily loop that runs the Dakiny bot functions."""
|
||||
|
||||
import random
|
||||
from datetime import UTC, datetime, time
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from nextcord.ext import commands, tasks
|
||||
from pytz import timezone
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot.app import birthday_list
|
||||
from dakiny_bot.classes.election import Election
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
from dakiny_bot.database.sql_data_classes import UserBirthday, engine
|
||||
from dakiny_bot.logger import dakiny_logger
|
||||
from dakiny_bot.utils import get_active_election_cycle
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import nextcord
|
||||
|
||||
KANDY = 239547993106284544
|
||||
|
||||
IGNORE_CAKEDAY = [266378407682506754]
|
||||
|
||||
|
||||
class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
"""Class for performing daily functions."""
|
||||
|
||||
def __init__(self, bot: commands.Bot) -> None:
|
||||
self.bot = bot
|
||||
self.current_election = None
|
||||
self.update_birthdays()
|
||||
|
||||
# pylint doesn't recognize that daily_loop is subclassed from tasks.loop.
|
||||
self.daily_loop.start() # pylint: disable=no-member
|
||||
|
||||
@tasks.loop(time=time(hour=0, tzinfo=timezone("UTC")))
|
||||
async def daily_loop(self) -> None:
|
||||
"""
|
||||
Runs daily.
|
||||
|
||||
Checks if the current election is None. If so, checks if there is an active election. If there is
|
||||
an active election, runs the check_date() function for the election to perform actions. Finally checks if the
|
||||
election is over to delete the current election object.
|
||||
"""
|
||||
dakiny_logger.debug("Daily loop. Current election: %s.", self.current_election)
|
||||
if self.current_election is None:
|
||||
self.current_election = self.get_election()
|
||||
dakiny_logger.debug("Current election: %s.", self.current_election)
|
||||
|
||||
if self.current_election is not None:
|
||||
await self.current_election.check_date()
|
||||
if self.current_election.election_over:
|
||||
self.current_election = None
|
||||
|
||||
self.update_birthdays()
|
||||
|
||||
if KANDY in birthday_list:
|
||||
# inform kandy that it is her "birthday"
|
||||
kandy: nextcord.User = await self.bot.fetch_user(KANDY)
|
||||
await kandy.send('Happy "Birthday"!')
|
||||
|
||||
await self.cakedays()
|
||||
|
||||
@daily_loop.before_loop
|
||||
async def before_loop(self) -> None:
|
||||
"""Actions run before the loop starts. Want to wait for bot to be ready and get the current cycle."""
|
||||
await self.bot.wait_until_ready()
|
||||
|
||||
# Bot needs to know guilds to get the current cycle.
|
||||
self.current_election = self.get_election()
|
||||
|
||||
def get_election(self) -> Election:
|
||||
"""
|
||||
Creates an object for the current election cycle if one is active.
|
||||
|
||||
An election is considered active between the election start and the term start.
|
||||
|
||||
Returns:
|
||||
Election: Current election cycle, None if there is no election happening.
|
||||
"""
|
||||
cycle = get_active_election_cycle()
|
||||
dakiny_logger.debug("Current cycle: %s.", cycle)
|
||||
|
||||
# prevent exception from using cycle as an Int in an array
|
||||
if cycle is None:
|
||||
dakiny_logger.info("Cycle was None. Returning without an election.")
|
||||
return None
|
||||
|
||||
election = Election(cycle, self.bot.get_guild(settings.params.guild_id))
|
||||
|
||||
dakiny_logger.debug("Election active: %s", election.active)
|
||||
|
||||
return election if election.active else None
|
||||
|
||||
def update_birthdays(self) -> None:
|
||||
"""Goes through database to collect all birthdays that are today. Adds user's id to birthday list."""
|
||||
birthday_list.clear()
|
||||
|
||||
# kandy's 1% chance
|
||||
if random.randint(0, 99) == 0: # noqa: S311 isn't cryptography related.
|
||||
birthday_list.append(KANDY)
|
||||
|
||||
today = datetime.now(tz=UTC).date()
|
||||
birthday = f"{today.month}/{today.day}"
|
||||
|
||||
stmt = select(UserBirthday.UserId).where(UserBirthday.Birthday == birthday)
|
||||
with Session(engine) as session:
|
||||
to_add = session.scalars(stmt)
|
||||
birthday_list.extend(to_add.all())
|
||||
|
||||
async def cakedays(self) -> None:
|
||||
"""
|
||||
Loops through the guild's humans checking for joined_at dates that match today's date.
|
||||
|
||||
Sends a message saying happy cakeday.
|
||||
"""
|
||||
today = datetime.now(tz=UTC).date()
|
||||
guild: nextcord.Guild = self.bot.get_guild(settings.params.guild_id)
|
||||
announce_channel: nextcord.TextChannel = guild.get_channel(settings.channel_ids.general)
|
||||
|
||||
cakedays: list[nextcord.Member] = [
|
||||
human
|
||||
for human in guild.humans
|
||||
if human.joined_at.month == today.month
|
||||
and human.joined_at.day == today.day
|
||||
and human.id not in IGNORE_CAKEDAY
|
||||
]
|
||||
|
||||
for member in cakedays:
|
||||
years = today.year - member.joined_at.year
|
||||
year_str = "years" if years > 1 else "year"
|
||||
msg = f"Happy Cake day! <@{member.id}> joined the discord {years} {year_str} ago!"
|
||||
await announce_channel.send(msg)
|
||||
@@ -1,11 +1,10 @@
|
||||
"""
|
||||
Defines cog for on message listener.
|
||||
"""
|
||||
"""Defines cog for on message listener."""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from dakiny_bot import birthday_list
|
||||
from dakiny_bot.app import birthday_list
|
||||
from dakiny_bot.DakinySettings import settings
|
||||
|
||||
|
||||
class SubmissionListener(commands.Cog, name="Message Listener"):
|
||||
@@ -15,10 +14,18 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message: nextcord.Message):
|
||||
async def on_message(self, message: nextcord.Message) -> None:
|
||||
"""Listener for message creation. Adds score and attachments to submission."""
|
||||
# don't want to process any messages from bot.
|
||||
if message.author.id == self.bot.user.id:
|
||||
if message.author.id == self.bot.user.id: # pyright: ignore[reportOptionalMemberAccess]
|
||||
return
|
||||
|
||||
# Ban all members who message in this channel. Everyone in guild is a member, so shouldn't miss a ban
|
||||
# due to message.author not being a nextcord.Member object.
|
||||
if message.channel.id == settings.channel_ids.ban and isinstance(message.author, nextcord.Member):
|
||||
await message.author.ban(
|
||||
delete_message_seconds=30 * 60, reason="Probable spam. The ban channel was messaged."
|
||||
)
|
||||
return
|
||||
|
||||
await birthday_action(message)
|
||||
@@ -26,18 +33,17 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
||||
|
||||
# This function will be called when this extension is loaded.
|
||||
# It is necessary to add these functions to the bot.
|
||||
def setup(bot: commands.Bot):
|
||||
"""Adds function to bot"""
|
||||
def setup(bot: commands.Bot) -> None:
|
||||
"""Adds function to bot."""
|
||||
bot.add_cog(SubmissionListener(bot))
|
||||
|
||||
|
||||
async def birthday_action(message: nextcord.Message) -> None:
|
||||
"""
|
||||
Checks a message's auther and mentions to see if they are in the birthday list.
|
||||
Checks a message's author and mentions to see if they are in the birthday list.
|
||||
|
||||
Args:
|
||||
message (nextcord.Message): The message to check for a birthday person.
|
||||
"""
|
||||
|
||||
if message.author.id in birthday_list or bool(set(message.raw_mentions) & set(birthday_list)):
|
||||
await message.add_reaction("🎂")
|
||||
@@ -0,0 +1 @@
|
||||
"""Module controls connection to Dakiny bot database."""
|
||||
@@ -0,0 +1,13 @@
|
||||
"""Small script to create the database if it doesn't already exist."""
|
||||
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
|
||||
if not Path("database/dakiny.db").exists():
|
||||
with sqlite3.connect("database/dakiny.db") as con:
|
||||
cur = con.cursor()
|
||||
|
||||
with Path("dakiny_bot/database/database.sql").open() as file:
|
||||
database_script = file.read()
|
||||
cur.executescript(database_script)
|
||||
con.commit()
|
||||
@@ -0,0 +1,64 @@
|
||||
CREATE TABLE ElectionInformation(
|
||||
ElectionName varchar(30) not null unique,
|
||||
ThreadId bigint unsigned not null,
|
||||
CouncilVoteMsgId bigint unsigned,
|
||||
HighCouncilVoteMsgId bigint unsigned,
|
||||
CouncilNominationMsgId bigint unsigned,
|
||||
HighCouncilNominationMsgId bigint unsigned,
|
||||
PRIMARY KEY (ElectionName)
|
||||
);
|
||||
|
||||
CREATE TABLE CouncilMembers(
|
||||
ElectionName varchar(30) not null,
|
||||
MemberId bigint unsigned not null,
|
||||
SpeechMsgId bigint unsigned not null,
|
||||
Elected boolean DEFAULT false,
|
||||
DiscordManager boolean DEFAULT false,
|
||||
ClanLeader boolean DEFAULT false,
|
||||
DiscordManagerSpeechId bigint unsigned,
|
||||
ClanLeaderSpeechId bigint unsigned,
|
||||
FOREIGN KEY (ElectionName) REFERENCES ElectionInformation(ElectionName),
|
||||
PRIMARY KEY (ElectionName, MemberId)
|
||||
);
|
||||
|
||||
CREATE TABLE Votes(
|
||||
ElectionName varchar(30) not null,
|
||||
VoterId bigint unsigned not null,
|
||||
VotedForId bigint unsigned,
|
||||
Type varchar(14) not null DEFAULT 'council' check("Type" in ('council', 'discordmanager', 'clanleader')),
|
||||
FOREIGN KEY (ElectionName) REFERENCES ElectionInformation(ElectionName),
|
||||
PRIMARY KEY (ElectionName, VoterId, Type)
|
||||
);
|
||||
|
||||
CREATE TABLE UserBirthday (
|
||||
UserId bigint unsigned not null,
|
||||
Birthday varchar(5) not null,
|
||||
PRIMARY KEY (UserId)
|
||||
);
|
||||
|
||||
CREATE TABLE Presences (
|
||||
Id integer PRIMARY KEY,
|
||||
Presence varchar(100) not null
|
||||
);
|
||||
|
||||
CREATE TABLE Points (
|
||||
QuarterName varchar(30) not null,
|
||||
UserId varchar(32) not null,
|
||||
DiscordMember boolean not null,
|
||||
EventPoints int unsigned DEFAULT 0,
|
||||
ClanPoints int unsigned DEFAULT 0,
|
||||
PRIMARY KEY (QuarterName, UserId)
|
||||
);
|
||||
|
||||
CREATE TABLE Messages (
|
||||
Path varchar(100) PRIMARY KEY,
|
||||
Id bigint unsigned not null
|
||||
);
|
||||
|
||||
CREATE TABLE PointsLimit (
|
||||
UserId varchar(32) not null,
|
||||
EventPoints int unsigned DEFAULT 0,
|
||||
ClanPoints int unsigned DEFAULT 0,
|
||||
Week varchar(7) not null,
|
||||
PRIMARY KEY (UserId, Week)
|
||||
);
|
||||
@@ -1,6 +1,5 @@
|
||||
"""
|
||||
Simple file to set up the sqlalchemy connection to database.
|
||||
"""
|
||||
"""Simple file to set up the sqlalchemy connection to database."""
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.automap import automap_base
|
||||
|
||||
@@ -11,8 +10,11 @@ Base = automap_base()
|
||||
Base.prepare(autoload_with=engine)
|
||||
|
||||
# define the classes
|
||||
ElectionInformation = Base.classes.ElectionInformation
|
||||
Points = Base.classes.Points
|
||||
PointsLimit = Base.classes.PointsLimit
|
||||
CouncilMembers = Base.classes.CouncilMembers
|
||||
Votes = Base.classes.Votes
|
||||
UserBirthday = Base.classes.UserBirthday
|
||||
ElectionInformation = Base.classes.ElectionInformation
|
||||
Messages = Base.classes.Messages
|
||||
Presences = Base.classes.Presences
|
||||
UserBirthday = Base.classes.UserBirthday
|
||||
Votes = Base.classes.Votes
|
||||
@@ -0,0 +1,13 @@
|
||||
"""Creates logger for Dakiny bot."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
dakiny_logger = logging.getLogger("default")
|
||||
dakiny_logger.setLevel(logging.DEBUG if os.getenv("DEBUG") == "true" else logging.INFO)
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setFormatter(
|
||||
logging.Formatter("%(asctime)s:%(levelname)s [%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s")
|
||||
)
|
||||
dakiny_logger.addHandler(handler)
|
||||
@@ -0,0 +1,566 @@
|
||||
"""File contains util functions."""
|
||||
|
||||
import calendar
|
||||
import os
|
||||
from collections.abc import Sequence
|
||||
from datetime import UTC, datetime
|
||||
from enum import StrEnum
|
||||
from pathlib import Path
|
||||
|
||||
import aiofiles
|
||||
import nextcord
|
||||
from sqlalchemy import select, true, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot.database.sql_data_classes import (
|
||||
CouncilMembers,
|
||||
Messages,
|
||||
Points,
|
||||
PointsLimit,
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from dakiny_bot.logger import dakiny_logger
|
||||
|
||||
from .DakinySettings import settings
|
||||
|
||||
NOMINEE_SPLITTER = "========================================\n\n"
|
||||
REPO_DIR = "./dakiny-messages"
|
||||
MESSAGES_DIR = f"{REPO_DIR}/messages"
|
||||
TEMPLATES_DIR = f"{REPO_DIR}/message_templates"
|
||||
MAX_DISCORD_MESSAGE_LENGTH = 2000
|
||||
GUILDS = [1000247361639030804, 239758371358638080]
|
||||
|
||||
VoteType = StrEnum("VoteType", ["COUNCIL", "DISCORDMANAGER", "CLANLEADER"])
|
||||
PointType = StrEnum("PointType", ["CLAN", "EVENT"])
|
||||
|
||||
|
||||
def get_datetime(month_day: str) -> datetime:
|
||||
"""
|
||||
Takes in a string month and day and returns a datetime object of that Month/Day this year.
|
||||
|
||||
Args:
|
||||
month_day (str): Month/Day in that format.
|
||||
|
||||
Returns:
|
||||
datetime: Datetime representation of Month/Day.
|
||||
"""
|
||||
today = datetime.now(tz=UTC).date()
|
||||
year = today.year
|
||||
month = int(month_day.split("/")[0])
|
||||
day = int(month_day.split("/")[1])
|
||||
|
||||
# ensure that year rolls over if current month is December and the next month is less than 12.
|
||||
if today.month == calendar.DECEMBER and month < calendar.OCTOBER:
|
||||
year += 1
|
||||
|
||||
if today.month == calendar.JANUARY and month > calendar.MARCH:
|
||||
year -= 1
|
||||
try:
|
||||
return datetime(year, month, day, tzinfo=UTC)
|
||||
except ValueError:
|
||||
dakiny_logger.warning("Invalid month day: %s.", month_day)
|
||||
|
||||
|
||||
def get_election_name() -> str:
|
||||
"""
|
||||
Builds the unique name of the current election cycle.
|
||||
|
||||
Returns:
|
||||
str: the name of the election cycle
|
||||
"""
|
||||
cycle = get_active_election_cycle()
|
||||
current_cycle = settings.election_cycles[cycle]
|
||||
return f"vote-{get_datetime(current_cycle.term_start).year}-{current_cycle.name}"
|
||||
|
||||
|
||||
def get_quarter_name() -> str:
|
||||
"""
|
||||
Builds the name of the current cycle/quarter.
|
||||
|
||||
Returns:
|
||||
str: the name of the cycle.
|
||||
"""
|
||||
cycle = get_quarter_cycle()
|
||||
current_cycle = settings.election_cycles[cycle]
|
||||
|
||||
return f"{get_datetime(current_cycle.term_start).year}-{current_cycle.name}"
|
||||
|
||||
|
||||
def get_active_election_cycle() -> int:
|
||||
"""
|
||||
Returns index for active election. An election is considered active between the election start and the term start.
|
||||
|
||||
Returns:
|
||||
int: cycle index for active election. None for no active cycle
|
||||
"""
|
||||
today = datetime.now(tz=UTC)
|
||||
dakiny_logger.debug("Today is %s", today)
|
||||
|
||||
for cycle, election in enumerate(settings.election_cycles):
|
||||
if (
|
||||
today.date() >= get_datetime(election.election_start).date()
|
||||
and today.date() <= get_datetime(election.term_start).date()
|
||||
):
|
||||
dakiny_logger.debug("Cycle is %d", cycle)
|
||||
return cycle
|
||||
|
||||
# It isn't a current election, get the quarter
|
||||
return get_quarter_cycle()
|
||||
|
||||
|
||||
def get_quarter_cycle() -> int:
|
||||
"""
|
||||
Returns the index for the current cycle/quarter. Defined as between term start and end.
|
||||
|
||||
Can return None if entire year isn't covered by cycles.
|
||||
|
||||
Returns:
|
||||
int: cycle index for current cycle.
|
||||
"""
|
||||
today = datetime.now(tz=UTC)
|
||||
dakiny_logger.debug("Today is %s", today)
|
||||
for cycle, election in enumerate(settings.election_cycles):
|
||||
if (
|
||||
today.date() >= get_datetime(election.term_start).date()
|
||||
and today.date() <= get_datetime(election.term_end).date()
|
||||
):
|
||||
dakiny_logger.debug("Cycle is %d", cycle)
|
||||
return cycle
|
||||
|
||||
dakiny_logger.debug("Quarter cycle is None.")
|
||||
return None
|
||||
|
||||
|
||||
def build_votes_str(guild: nextcord.Guild) -> str:
|
||||
"""
|
||||
Creates a string that contains all nominees and their votes to be sent as a discord message.
|
||||
|
||||
Args:
|
||||
guild (nextcord.Guild): The guild object. Used to get display names for sorting.
|
||||
|
||||
Returns:
|
||||
str: String that contains all nominees and their votes.
|
||||
"""
|
||||
votes: dict[int, int] = {}
|
||||
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(CouncilMembers).where(CouncilMembers.ElectionName == election_name)
|
||||
|
||||
for nominee in sorted(
|
||||
session.scalars(stmt),
|
||||
key=lambda nominee: guild.get_member(nominee.MemberId).display_name.lower(),
|
||||
):
|
||||
votes[nominee.MemberId] = 0
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionName == election_name).where(Votes.Type == VoteType.COUNCIL)
|
||||
|
||||
for vote in session.scalars(stmt):
|
||||
if vote.VotedForId is not None:
|
||||
votes[vote.VotedForId] += 1
|
||||
|
||||
votes_str: str = "===================="
|
||||
votes_str += user_vote_str(votes)
|
||||
|
||||
return votes_str
|
||||
|
||||
|
||||
def build_highcouncil_votes_str(guild: nextcord.Guild) -> str:
|
||||
"""
|
||||
Creates a string that contains all high council nominees and their votes to be sent as a discord message.
|
||||
|
||||
Args:
|
||||
guild (nextcord.Guild): The guild object. Used to get display names for sorting.
|
||||
|
||||
Returns:
|
||||
str: String that contains all nominees and their votes.
|
||||
"""
|
||||
cl_votes: dict[int, int] = {}
|
||||
dm_votes: dict[int, int] = {}
|
||||
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.filter(CouncilMembers.ClanLeaderSpeechId.is_not(None))
|
||||
)
|
||||
|
||||
for nominee in sorted(
|
||||
session.scalars(stmt),
|
||||
key=lambda nominee: guild.get_member(nominee.MemberId).display_name.lower(),
|
||||
):
|
||||
cl_votes[nominee.MemberId] = 0
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionName == election_name).where(Votes.Type == VoteType.CLANLEADER)
|
||||
|
||||
for vote in session.scalars(stmt):
|
||||
if vote.VotedForId is not None:
|
||||
cl_votes[vote.VotedForId] += 1
|
||||
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.filter(CouncilMembers.DiscordManagerSpeechId.is_not(None))
|
||||
)
|
||||
|
||||
for nominee in sorted(
|
||||
session.scalars(stmt),
|
||||
key=lambda nominee: guild.get_member(nominee.MemberId).display_name.lower(),
|
||||
):
|
||||
dm_votes[nominee.MemberId] = 0
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionName == election_name).where(Votes.Type == VoteType.DISCORDMANAGER)
|
||||
|
||||
for vote in session.scalars(stmt):
|
||||
if vote.VotedForId is not None:
|
||||
dm_votes[vote.VotedForId] += 1
|
||||
|
||||
# build the votes string
|
||||
votes_str: str = "Clan Leader Votes\n===================="
|
||||
votes_str += user_vote_str(cl_votes)
|
||||
|
||||
votes_str += "\n\nDiscord Manager Votes\n===================="
|
||||
votes_str += user_vote_str(dm_votes)
|
||||
|
||||
return votes_str
|
||||
|
||||
|
||||
def user_vote_str(votes: dict[int, int]) -> str:
|
||||
"""
|
||||
Creates the string representing how many votes each user has.
|
||||
|
||||
Args:
|
||||
votes (dict[int, int]): Dict of all users and how many votes they have.
|
||||
|
||||
Returns:
|
||||
str: The string showing names and number of votes.
|
||||
"""
|
||||
ret_str: str = ""
|
||||
|
||||
for user_id, num_votes in votes.items():
|
||||
ret_str += f"\n<@{user_id}>: {'☑️' * num_votes}"
|
||||
return ret_str
|
||||
|
||||
|
||||
def decorate_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Clan Council Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def decorate_cl_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Clan Leader Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def decorate_dm_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Discord Manager Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def record_points(users: Sequence[str], add_points: int, point_type: PointType, *, is_member: bool) -> None:
|
||||
"""
|
||||
Adds points to all users listed.
|
||||
|
||||
Checks if they don't exist in order to make a new entry, otherwise
|
||||
adds points to the existing value. Can be used for hosting or participating in events or for the clan
|
||||
points.
|
||||
|
||||
Args:
|
||||
users (Sequence[int]): users that participated and need points.
|
||||
add_points (int): number of points to add
|
||||
point_type (PointType): which point type to add to
|
||||
is_member (bool): whether the users are a discord member or not
|
||||
"""
|
||||
quarter_name = get_quarter_name()
|
||||
with Session(engine) as session:
|
||||
for user in users:
|
||||
stmt = select(Points).where(Points.UserId == user).where(Points.QuarterName == quarter_name)
|
||||
|
||||
points_obj = session.scalar(stmt)
|
||||
add_points = get_allowed_points(session, point_type, user, add_points)
|
||||
add_clan_points = add_points if point_type == PointType.CLAN else 0
|
||||
add_event_points = add_points if point_type == PointType.EVENT else 0
|
||||
if points_obj is None:
|
||||
new_points = Points(
|
||||
QuarterName=quarter_name,
|
||||
UserId=user,
|
||||
DiscordMember=is_member,
|
||||
EventPoints=add_event_points,
|
||||
ClanPoints=add_clan_points,
|
||||
)
|
||||
session.add(new_points)
|
||||
else:
|
||||
points_obj.EventPoints += add_event_points
|
||||
points_obj.ClanPoints += add_clan_points
|
||||
|
||||
session.commit()
|
||||
|
||||
|
||||
def get_allowed_points(session: Session, point_type: PointType, user: str, points: int) -> int:
|
||||
"""
|
||||
Gets the maximum number of points a user can be given.
|
||||
|
||||
Searches how many points they have been given
|
||||
this week and subtracts that from the weekly limit. If under, returns up to "points" number of points (will not
|
||||
go over points_limit) otherwise returns 0. Updates the limit object or creates a new one if one isn't found.
|
||||
|
||||
Args:
|
||||
session (Session): Open connection to database.
|
||||
point_type (PointType): Which type of points to check the limit for.
|
||||
user (str): user to be given points. Used to check a user's limit.
|
||||
points (int): maximum number of points to give to user.
|
||||
|
||||
Returns:
|
||||
int: how many points are allowed to be given to the user.
|
||||
"""
|
||||
# check for limit
|
||||
today = datetime.now(tz=UTC).date()
|
||||
this_week = f"{today.isocalendar().year}-{today.isocalendar().week}"
|
||||
points_limit = (
|
||||
settings.point_settings.events_weekly_limit
|
||||
if point_type == PointType.EVENT
|
||||
else settings.point_settings.clan_points_weekly_limit
|
||||
)
|
||||
stmt = select(PointsLimit).where(PointsLimit.UserId == user).where(PointsLimit.Week == this_week)
|
||||
|
||||
# if under limit, can add up to however many points would make the current limit equal to the
|
||||
# allowed limit.
|
||||
limit_obj = session.scalar(stmt)
|
||||
if limit_obj is None:
|
||||
clan_points = points if point_type == PointType.CLAN else 0
|
||||
event_points = points if point_type == PointType.EVENT else 0
|
||||
new_limit = PointsLimit(UserId=user, Week=this_week, EventPoints=event_points, ClanPoints=clan_points)
|
||||
add_points = points
|
||||
session.add(new_limit)
|
||||
else:
|
||||
curr_points = limit_obj.EventPoints if point_type == PointType.EVENT else limit_obj.ClanPoints
|
||||
add_points = points if curr_points + points <= points_limit else (max(0, points_limit - curr_points))
|
||||
if point_type == PointType.EVENT:
|
||||
limit_obj.EventPoints += add_points
|
||||
else:
|
||||
limit_obj.ClanPoints += add_points
|
||||
|
||||
session.commit()
|
||||
|
||||
return add_points
|
||||
|
||||
|
||||
async def update_clan_messages(guild: nextcord.Guild, channel_updates: Sequence[str]) -> None:
|
||||
"""
|
||||
Updates all clan messages to contents in MESSAGES_DIR.
|
||||
|
||||
Does not to any git work. Is expected to be called after git is pulled.
|
||||
|
||||
For every directory, sort the files by number then edits/sends the message.
|
||||
|
||||
Channel fetching/management is handled by another function.
|
||||
Message editing and sending is handled by another function.
|
||||
|
||||
Args:
|
||||
guild (nextcord.Guild): Guild object that all channels and messages belong to.
|
||||
channel_updates: (Sequence[str]): a sequence of the channels to update.
|
||||
"""
|
||||
dirs = [dir_name for dir_name in channel_updates if Path(f"{MESSAGES_DIR}/{dir_name}").is_dir()]
|
||||
|
||||
with Session(engine) as session:
|
||||
for dir_name in dirs:
|
||||
dir_path = f"{MESSAGES_DIR}/{dir_name}"
|
||||
channel = await get_clan_message_channel(session, dir_name, guild)
|
||||
sorted_files = sorted(
|
||||
os.listdir(dir_path),
|
||||
key=lambda filename: int(filename.split(".")[0]),
|
||||
)
|
||||
|
||||
for file_name in sorted_files:
|
||||
message_name = f"{dir_name}/{file_name}"
|
||||
file_path = f"{dir_path}/{file_name}"
|
||||
async with aiofiles.open(file_path, encoding="utf8") as reader:
|
||||
await edit_clan_message(
|
||||
session, channel, message_name, await reader.read(MAX_DISCORD_MESSAGE_LENGTH)
|
||||
)
|
||||
|
||||
|
||||
async def get_clan_message_channel(session: Session, channel_name: str, guild: nextcord.Guild) -> nextcord.TextChannel:
|
||||
"""
|
||||
Used to obtain a channel from the guild object.
|
||||
|
||||
Searches database for an id to get the channel. If that is not
|
||||
found, then searches through all channels in the guild to find one with a matching name. If that also doesn't
|
||||
turn up a channel, then creates it. Adds an entry into database for last two paths.
|
||||
Assumes that there is an open session to the database.
|
||||
|
||||
Args:
|
||||
session (Session): Open connection to database.
|
||||
channel_name (str): Name of channel to obtain.
|
||||
guild (nextcord.Guild): Guild object to get channel from.
|
||||
|
||||
Returns:
|
||||
nextcord.TextChannel: Channel object with name channel_name.
|
||||
"""
|
||||
stmt = select(Messages.Id).where(Messages.Path == channel_name)
|
||||
channel_id = session.scalar(stmt)
|
||||
if channel_id is None:
|
||||
ret_channel = None
|
||||
# channel is not tracked. see if it exists
|
||||
channels = await guild.fetch_channels()
|
||||
for channel in channels:
|
||||
if channel.name == channel_name and channel.__class__ is nextcord.TextChannel:
|
||||
ret_channel = channel
|
||||
|
||||
if ret_channel is None:
|
||||
# channel doesn't exist, we must create it
|
||||
ret_channel = await guild.create_text_channel(
|
||||
channel_name,
|
||||
reason="Creating channel as required for by design of Dakiny-Messages repo.",
|
||||
)
|
||||
|
||||
# record channel information
|
||||
new_item = Messages(Path=channel_name, Id=ret_channel.id)
|
||||
session.add(new_item)
|
||||
session.commit()
|
||||
return ret_channel
|
||||
|
||||
try:
|
||||
return await guild.fetch_channel(channel_id)
|
||||
except nextcord.NotFound:
|
||||
# the channel was deleted for some reason
|
||||
ret_channel = await guild.create_text_channel(
|
||||
channel_name,
|
||||
reason="Creating channel as required for by design of Dakiny-Messages repo.",
|
||||
)
|
||||
stmt = update(Messages).where(Messages.Path == channel_name).values(Id=ret_channel.id)
|
||||
session.execute(stmt)
|
||||
session.commit()
|
||||
return ret_channel
|
||||
|
||||
|
||||
async def edit_clan_message(
|
||||
session: Session,
|
||||
channel: nextcord.TextChannel,
|
||||
message_name: str,
|
||||
message_content: str,
|
||||
) -> None:
|
||||
"""
|
||||
Obtains a message id from database.
|
||||
|
||||
If no id, then need to send a new message and record the id.
|
||||
If there is a message, then edit the message. If that message is not found in discord, then need to
|
||||
send a new message and record the id in the database.
|
||||
|
||||
Args:
|
||||
session (Session): Open connection to database.
|
||||
channel (nextcord.TextChannel): Channel object that message belongs to.
|
||||
message_name (str): Name of the message. Corresponds to the file that contains message content.
|
||||
message_content (str): Content of the message to edit/send.
|
||||
"""
|
||||
stmt = select(Messages.Id).where(Messages.Path == message_name)
|
||||
msg_id = session.scalar(stmt)
|
||||
if msg_id is None:
|
||||
# don't have a message for this file
|
||||
msg = await channel.send(message_content)
|
||||
new_message = Messages(Path=message_name, Id=msg.id)
|
||||
session.add(new_message)
|
||||
session.commit()
|
||||
else:
|
||||
try:
|
||||
msg: nextcord.Message = await channel.fetch_message(msg_id)
|
||||
await msg.edit(message_content)
|
||||
except nextcord.NotFound:
|
||||
msg = await channel.send(message_content)
|
||||
stmt = update(Messages).where(Messages.Path == message_name).values(Id=msg.id)
|
||||
session.execute(stmt)
|
||||
session.commit()
|
||||
|
||||
|
||||
async def edit_clan_council_info(guild: nextcord.Guild) -> None:
|
||||
"""
|
||||
Gets the winners of the elections and updates the permanent message that states the current council.
|
||||
|
||||
Args:
|
||||
guild (nextcord.Guild): Guild object that to use to get channel.
|
||||
"""
|
||||
clan_info_channel: nextcord.TextChannel = await guild.fetch_channel(settings.channel_ids.clan_info)
|
||||
|
||||
election_name = get_election_name()
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.DiscordManager == true())
|
||||
)
|
||||
discord_manager = session.scalar(stmt)
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.ClanLeader == true())
|
||||
)
|
||||
clan_leader = session.scalar(stmt)
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
.where(CouncilMembers.ElectionName == election_name)
|
||||
.where(CouncilMembers.Elected == true())
|
||||
)
|
||||
|
||||
council_member_ids = sorted(
|
||||
session.scalars(stmt), key=lambda user_id: guild.get_member(user_id).display_name.lower()
|
||||
)
|
||||
|
||||
council_members_strs = [
|
||||
f"<@{user_id}>" for user_id in council_member_ids if user_id not in (discord_manager, clan_leader)
|
||||
]
|
||||
|
||||
quarter = get_quarter_name()
|
||||
|
||||
async with aiofiles.open(f"{TEMPLATES_DIR}/council_members.txt", encoding="utf8") as file:
|
||||
message = await file.read()
|
||||
message = message.format(
|
||||
quarter=quarter,
|
||||
council="\n".join(council_members_strs),
|
||||
clan_leader=clan_leader,
|
||||
discord_manager=discord_manager,
|
||||
)
|
||||
|
||||
await edit_clan_message(session, clan_info_channel, "council_members.txt", message)
|
||||
@@ -1,15 +0,0 @@
|
||||
"""
|
||||
Small script to create the database if it doesn't already exist.
|
||||
"""
|
||||
|
||||
import sqlite3
|
||||
from os.path import exists
|
||||
|
||||
if not exists("database/dakiny.db"):
|
||||
with sqlite3.connect("database/dakiny.db") as con:
|
||||
cur = con.cursor()
|
||||
|
||||
with open("database_setup/database.sql", mode="r", encoding="utf-8") as file:
|
||||
database_script = file.read()
|
||||
cur.executescript(database_script)
|
||||
con.commit()
|
||||
@@ -1,41 +0,0 @@
|
||||
CREATE TABLE ElectionInformation(
|
||||
ElectionCycle varchar(30) not null unique,
|
||||
ThreadId bigint unsigned not null,
|
||||
CouncilVoteMsgId bigint unsigned,
|
||||
HighCouncilVoteMsgId bigint unsigned,
|
||||
CouncilNominationMsgId bigint unsigned,
|
||||
HighCouncilNominationMsgId bigint unsigned,
|
||||
PRIMARY KEY (ElectionCycle)
|
||||
);
|
||||
|
||||
CREATE TABLE CouncilMembers(
|
||||
ElectionCycle varchar(30) not null,
|
||||
MemberId bigint unsigned not null,
|
||||
SpeechMsgId bigint unsigned not null,
|
||||
Elected boolean DEFAULT false,
|
||||
DiscordManager boolean DEFAULT false,
|
||||
ClanLeader boolean DEFAULT false,
|
||||
DiscordManagerSpeechId bigint unsigned,
|
||||
ClanLeaderSpeechId bigint unsigned,
|
||||
FOREIGN KEY (ElectionCycle) REFERENCES ElectionInformation(ElectionCycle),
|
||||
PRIMARY KEY (ElectionCycle, MemberId)
|
||||
);
|
||||
|
||||
CREATE TABLE Votes(
|
||||
ElectionCycle varchar(30) not null,
|
||||
VoterId bigint unsigned not null,
|
||||
VotedForId bigint unsigned,
|
||||
FOREIGN KEY (ElectionCycle) REFERENCES ElectionInformation(ElectionCycle),
|
||||
PRIMARY KEY (ElectionCycle, VoterId)
|
||||
);
|
||||
|
||||
CREATE TABLE UserBirthday (
|
||||
UserId bigint unsigned not null,
|
||||
Birthday varchar(5) not null,
|
||||
PRIMARY KEY (UserId)
|
||||
);
|
||||
|
||||
CREATE TABLE Presences (
|
||||
Id integer PRIMARY KEY,
|
||||
Presence varchar(100) not null
|
||||
);
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
[project]
|
||||
authors = [{ name = "imcompiling", email = "[email protected]" }]
|
||||
requires-python = "<4.0,>=3.13"
|
||||
dependencies = [
|
||||
"gitpython<4.0.0,>=3.1.43",
|
||||
"fastapi<1.0.0,>=0.111.0",
|
||||
"nextcord<3.0.0,>=2.6.0",
|
||||
"pandas<3.0.0,>=2.2.2",
|
||||
"pytz<2025.3,>=2025.2",
|
||||
"sqlalchemy<3.0.0,>=2.0.30",
|
||||
"aiofiles<24.0.0,>=23.2.1",
|
||||
"setuptools<80.10.3,>=80.10.2",
|
||||
"dataclass-wizard[yaml]>=0.22.3,<1.0.0",
|
||||
"uvicorn>=0.34.0",
|
||||
"audioop-lts>=0.2.1",
|
||||
]
|
||||
name = "dakiny-bot"
|
||||
version = "0.1.0"
|
||||
description = "Dakiny's Discord Bot."
|
||||
readme = "README.md"
|
||||
|
||||
[dependency-groups]
|
||||
dev = ["ruff<1.0.0,>=0.6.9"]
|
||||
|
||||
[tool.ruff]
|
||||
# Exclude a variety of commonly ignored directories.
|
||||
exclude = [
|
||||
".bzr",
|
||||
".direnv",
|
||||
".eggs",
|
||||
".git",
|
||||
".git-rewrite",
|
||||
".hg",
|
||||
".ipynb_checkpoints",
|
||||
".mypy_cache",
|
||||
".nox",
|
||||
".pants.d",
|
||||
".pyenv",
|
||||
".pytest_cache",
|
||||
".pytype",
|
||||
".ruff_cache",
|
||||
".svn",
|
||||
".tox",
|
||||
".venv",
|
||||
".vscode",
|
||||
"__pypackages__",
|
||||
"_build",
|
||||
"buck-out",
|
||||
"build",
|
||||
"dist",
|
||||
"node_modules",
|
||||
"site-packages",
|
||||
"venv",
|
||||
"dakiny-messages", # Don't need to lint this git repo.
|
||||
]
|
||||
|
||||
# Same as Black.
|
||||
line-length = 120
|
||||
indent-width = 4
|
||||
|
||||
# Assume Python 3.8
|
||||
target-version = "py312"
|
||||
|
||||
[tool.ruff.lint]
|
||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||
# McCabe complexity (`C901`) by default.
|
||||
select = ["ALL"]
|
||||
ignore = [
|
||||
"B008", # I build SlashOptions as arguments.
|
||||
"COM812",
|
||||
"COM819",
|
||||
"D107", # don't want docstrings on init functions
|
||||
"D203",
|
||||
"D206",
|
||||
"D212",
|
||||
"D300",
|
||||
"E111",
|
||||
"E114",
|
||||
"E117",
|
||||
"ISC001",
|
||||
"ISC002",
|
||||
"PD011", # doesn't like me using '.values' on embeds....
|
||||
"Q000",
|
||||
"Q001",
|
||||
"Q002",
|
||||
"Q003",
|
||||
"W191",
|
||||
]
|
||||
|
||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||
fixable = ["ALL"]
|
||||
unfixable = []
|
||||
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "google"
|
||||
|
||||
[tool.ruff.lint.flake8-annotations]
|
||||
mypy-init-return = true
|
||||
|
||||
[tool.ruff.format]
|
||||
# Like Black, use double quotes for strings.
|
||||
quote-style = "double"
|
||||
|
||||
# Like Black, indent with spaces, rather than tabs.
|
||||
indent-style = "space"
|
||||
|
||||
# Like Black, respect magic trailing commas.
|
||||
skip-magic-trailing-comma = false
|
||||
|
||||
# Like Black, automatically detect the appropriate line ending.
|
||||
line-ending = "auto"
|
||||
|
||||
# Enable auto-formatting of code examples in docstrings. Markdown,
|
||||
# reStructuredText code/literal blocks and doctests are all supported.
|
||||
#
|
||||
# This is currently disabled by default, but it is planned for this
|
||||
# to be opt-out in the future.
|
||||
docstring-code-format = true
|
||||
|
||||
# Set the line length limit used when formatting code snippets in
|
||||
# docstrings.
|
||||
#
|
||||
# This only has an effect when the `docstring-code-format` setting is
|
||||
# enabled.
|
||||
docstring-code-line-length = "dynamic"
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"lockFileMaintenance": {
|
||||
"automerge": true
|
||||
},
|
||||
"major": {
|
||||
"automerge": false,
|
||||
"automergeType": "pr"
|
||||
},
|
||||
"minor": {
|
||||
"automerge": true,
|
||||
"automergeType": "branch"
|
||||
},
|
||||
"patch": {
|
||||
"automerge": true,
|
||||
"automergeType": "branch"
|
||||
},
|
||||
"pin": {
|
||||
"automerge": true,
|
||||
"automergeType": "branch"
|
||||
},
|
||||
"ignoreTests": true,
|
||||
"dockerfile": {
|
||||
"minor": {
|
||||
"automerge": false,
|
||||
"automergeType": "pr"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
nextcord==2.4.2
|
||||
python-dotenv==1.0.0
|
||||
pytz==2022.7.1
|
||||
hydra-core==1.3.2
|
||||
sqlalchemy<2.0
|
||||
@@ -1 +0,0 @@
|
||||
python-3.10.4
|
||||
@@ -1,264 +0,0 @@
|
||||
"""
|
||||
File contains util functions.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import CouncilMembers, Votes, engine
|
||||
|
||||
NOMINEE_SPLITTER = "========================================\n\n"
|
||||
|
||||
|
||||
def get_datetime(day: str) -> datetime:
|
||||
"""
|
||||
Takes in a string month and day and returns a datetime object of that Month/Day this year.
|
||||
|
||||
Args:
|
||||
day (str): Month/Day in that format.
|
||||
|
||||
Returns:
|
||||
datetime: Datetime representation of Month/Day.
|
||||
"""
|
||||
year = datetime.today().year
|
||||
month = int(day.split("/")[0])
|
||||
day = int(day.split("/")[1])
|
||||
|
||||
# ensure that year rolls over if current month is December and the next month is less than 12.
|
||||
if datetime.today().month == 12 & month < 12:
|
||||
year += 1
|
||||
|
||||
return datetime(year, month, day)
|
||||
|
||||
|
||||
def get_election_cycle_name(config: DakinyConfig) -> str:
|
||||
"""
|
||||
Builds the unique name of the current election cycle
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): the config used to know the election cycle.
|
||||
|
||||
Returns:
|
||||
str: the name of the election cycle
|
||||
"""
|
||||
cycle = get_current_cycle(config)
|
||||
current_cycle = config.election_cycles[cycle]
|
||||
|
||||
return (
|
||||
f"vote-{get_datetime(current_cycle.election_start).year}-{current_cycle.name}"
|
||||
)
|
||||
|
||||
|
||||
def get_dm_election_name(config: DakinyConfig) -> str:
|
||||
"""
|
||||
creates the name of the discord manager election
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): Config sent to get_election_cycle_name
|
||||
|
||||
Returns:
|
||||
str: the name of the election
|
||||
"""
|
||||
|
||||
return f"{get_election_cycle_name(config)}-dm"
|
||||
|
||||
|
||||
def get_cl_election_name(config: DakinyConfig) -> str:
|
||||
"""
|
||||
creates the name of the clan leader election
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): Config sent to get_election_cycle_name
|
||||
|
||||
Returns:
|
||||
str: the name of the election
|
||||
"""
|
||||
|
||||
return f"{get_election_cycle_name(config)}-cl"
|
||||
|
||||
|
||||
def get_current_cycle(config: DakinyConfig) -> int:
|
||||
"""
|
||||
Returns index for active election. An election is considered active between the election start and the term start.
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): Config object to use
|
||||
|
||||
Returns:
|
||||
int: cycle index for active election. -1 for no active cycle
|
||||
"""
|
||||
|
||||
today = datetime.today()
|
||||
|
||||
for cycle, election in enumerate(config.election_cycles):
|
||||
if (
|
||||
today.date() >= get_datetime(election.election_start).date()
|
||||
and today.date() <= get_datetime(election.term_start).date()
|
||||
):
|
||||
return cycle
|
||||
|
||||
return -1
|
||||
|
||||
|
||||
def build_votes_str(config: DakinyConfig) -> str:
|
||||
"""
|
||||
Creates a string that contains all nominees and their votes to be sent as a discord message.
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): Daking config object
|
||||
|
||||
Returns:
|
||||
str: String that contains all nominees and their votes.
|
||||
"""
|
||||
|
||||
votes: dict[int, int] = {}
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(CouncilMembers).where(
|
||||
CouncilMembers.ElectionCycle == get_election_cycle_name(config)
|
||||
)
|
||||
|
||||
for nominee in session.scalars(stmt):
|
||||
votes[nominee.MemberId] = 0
|
||||
|
||||
stmt = select(Votes).where(
|
||||
Votes.ElectionCycle == get_election_cycle_name(config)
|
||||
)
|
||||
|
||||
for vote in session.scalars(stmt):
|
||||
if vote.VotedForId is not None:
|
||||
votes[vote.VotedForId] += 1
|
||||
|
||||
votes_str: str = "===================="
|
||||
votes_str += user_vote_str(votes)
|
||||
|
||||
return votes_str
|
||||
|
||||
|
||||
def build_highcouncil_votes_str(config: DakinyConfig) -> str:
|
||||
"""
|
||||
Creates a string that contains all high council nominees and their votes to be sent as a discord message.
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): Daking config object
|
||||
|
||||
Returns:
|
||||
str: String that contains all nominees and their votes.
|
||||
"""
|
||||
|
||||
cl_votes: dict[int, int] = {}
|
||||
dm_votes: dict[int, int] = {}
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == get_election_cycle_name(config))
|
||||
.filter(CouncilMembers.ClanLeaderSpeechId.is_not(None))
|
||||
)
|
||||
|
||||
for nominee in session.scalars(stmt):
|
||||
cl_votes[nominee.MemberId] = 0
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionCycle == get_cl_election_name(config))
|
||||
|
||||
for vote in session.scalars(stmt):
|
||||
if vote.VotedForId is not None:
|
||||
cl_votes[vote.VotedForId] += 1
|
||||
|
||||
stmt = (
|
||||
select(CouncilMembers)
|
||||
.where(CouncilMembers.ElectionCycle == get_election_cycle_name(config))
|
||||
.filter(CouncilMembers.DiscordManagerSpeechId.is_not(None))
|
||||
)
|
||||
|
||||
for nominee in session.scalars(stmt):
|
||||
dm_votes[nominee.MemberId] = 0
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionCycle == get_dm_election_name(config))
|
||||
|
||||
for vote in session.scalars(stmt):
|
||||
if vote.VotedForId is not None:
|
||||
dm_votes[vote.VotedForId] += 1
|
||||
|
||||
# build the votes string
|
||||
votes_str: str = "Clan Leader Votes\n===================="
|
||||
votes_str += user_vote_str(cl_votes)
|
||||
|
||||
votes_str += "\n\nDiscord Manager Votes\n===================="
|
||||
votes_str += user_vote_str(dm_votes)
|
||||
|
||||
return votes_str
|
||||
|
||||
|
||||
def user_vote_str(votes: dict[int, int]) -> str:
|
||||
"""
|
||||
Creates the string representing how many votes each user has.
|
||||
|
||||
Args:
|
||||
votes (dict[int, int]): Dict of all users and how many votes they have.
|
||||
|
||||
Returns:
|
||||
str: The string showing names and number of votes.
|
||||
"""
|
||||
ret_str: str = ""
|
||||
|
||||
for user_id, num_votes in votes.items():
|
||||
ret_str += f"\n<@{user_id}>: {'☑️' * num_votes}"
|
||||
return ret_str
|
||||
|
||||
|
||||
def decorate_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Clan Council Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def decorate_cl_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Clan Leader Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def decorate_dm_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Discord Manager Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
@@ -0,0 +1,637 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.13, <4.0"
|
||||
|
||||
[[package]]
|
||||
name = "aiofiles"
|
||||
version = "23.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/af/41/cfed10bc64d774f497a86e5ede9248e1d062db675504b41c320954d99641/aiofiles-23.2.1.tar.gz", hash = "sha256:84ec2218d8419404abcb9f0c02df3f34c6e0a68ed41072acfb1cef5cbc29051a", size = 32072, upload-time = "2023-08-09T15:23:11.564Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c5/19/5af6804c4cc0fed83f47bff6e413a98a36618e7d40185cd36e69737f3b0e/aiofiles-23.2.1-py3-none-any.whl", hash = "sha256:19297512c647d4b27a2cf7c34caa7e405c0d60b5560618a29a9fe027b18b0107", size = 15727, upload-time = "2023-08-09T15:23:09.774Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aiohappyeyeballs"
|
||||
version = "2.4.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7f/55/e4373e888fdacb15563ef6fa9fa8c8252476ea071e96fb46defac9f18bf2/aiohappyeyeballs-2.4.4.tar.gz", hash = "sha256:5fdd7d87889c63183afc18ce9271f9b0a7d32c2303e394468dd45d514a757745", size = 21977, upload-time = "2024-11-30T18:44:00.701Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b9/74/fbb6559de3607b3300b9be3cc64e97548d55678e44623db17820dbd20002/aiohappyeyeballs-2.4.4-py3-none-any.whl", hash = "sha256:a980909d50efcd44795c4afeca523296716d50cd756ddca6af8c65b996e27de8", size = 14756, upload-time = "2024-11-30T18:43:39.849Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aiohttp"
|
||||
version = "3.11.11"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "aiohappyeyeballs" },
|
||||
{ name = "aiosignal" },
|
||||
{ name = "attrs" },
|
||||
{ name = "frozenlist" },
|
||||
{ name = "multidict" },
|
||||
{ name = "propcache" },
|
||||
{ name = "yarl" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fe/ed/f26db39d29cd3cb2f5a3374304c713fe5ab5a0e4c8ee25a0c45cc6adf844/aiohttp-3.11.11.tar.gz", hash = "sha256:bb49c7f1e6ebf3821a42d81d494f538107610c3a705987f53068546b0e90303e", size = 7669618, upload-time = "2024-12-18T21:20:50.191Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/49/d1/d8af164f400bad432b63e1ac857d74a09311a8334b0481f2f64b158b50eb/aiohttp-3.11.11-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:541d823548ab69d13d23730a06f97460f4238ad2e5ed966aaf850d7c369782d9", size = 697982, upload-time = "2024-12-18T21:19:28.454Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/d1/faad3bf9fa4bfd26b95c69fc2e98937d52b1ff44f7e28131855a98d23a17/aiohttp-3.11.11-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:929f3ed33743a49ab127c58c3e0a827de0664bfcda566108989a14068f820194", size = 460662, upload-time = "2024-12-18T21:19:31.077Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/db/61/0d71cc66d63909dabc4590f74eba71f91873a77ea52424401c2498d47536/aiohttp-3.11.11-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0882c2820fd0132240edbb4a51eb8ceb6eef8181db9ad5291ab3332e0d71df5f", size = 452950, upload-time = "2024-12-18T21:19:33.108Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/07/db/6d04bc7fd92784900704e16b745484ef45b77bd04e25f58f6febaadf7983/aiohttp-3.11.11-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b63de12e44935d5aca7ed7ed98a255a11e5cb47f83a9fded7a5e41c40277d104", size = 1665178, upload-time = "2024-12-18T21:19:36.556Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/54/5c/e95ade9ae29f375411884d9fd98e50535bf9fe316c9feb0f30cd2ac8f508/aiohttp-3.11.11-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aa54f8ef31d23c506910c21163f22b124facb573bff73930735cf9fe38bf7dff", size = 1717939, upload-time = "2024-12-18T21:19:40.081Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6f/1c/1e7d5c5daea9e409ed70f7986001b8c9e3a49a50b28404498d30860edab6/aiohttp-3.11.11-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a344d5dc18074e3872777b62f5f7d584ae4344cd6006c17ba12103759d407af3", size = 1775125, upload-time = "2024-12-18T21:19:43.578Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/66/890987e44f7d2f33a130e37e01a164168e6aff06fce15217b6eaf14df4f6/aiohttp-3.11.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b7fb429ab1aafa1f48578eb315ca45bd46e9c37de11fe45c7f5f4138091e2f1", size = 1677176, upload-time = "2024-12-18T21:19:46.239Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/dc/e2ba57d7a52df6cdf1072fd5fa9c6301a68e1cd67415f189805d3eeb031d/aiohttp-3.11.11-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c341c7d868750e31961d6d8e60ff040fb9d3d3a46d77fd85e1ab8e76c3e9a5c4", size = 1603192, upload-time = "2024-12-18T21:19:48.341Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6c/9e/8d08a57de79ca3a358da449405555e668f2c8871a7777ecd2f0e3912c272/aiohttp-3.11.11-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ed9ee95614a71e87f1a70bc81603f6c6760128b140bc4030abe6abaa988f1c3d", size = 1618296, upload-time = "2024-12-18T21:19:50.479Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/56/51/89822e3ec72db352c32e7fc1c690370e24e231837d9abd056490f3a49886/aiohttp-3.11.11-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:de8d38f1c2810fa2a4f1d995a2e9c70bb8737b18da04ac2afbf3971f65781d87", size = 1616524, upload-time = "2024-12-18T21:19:52.542Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/fa/e2e6d9398f462ffaa095e84717c1732916a57f1814502929ed67dd7568ef/aiohttp-3.11.11-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a9b7371665d4f00deb8f32208c7c5e652059b0fda41cf6dbcac6114a041f1cc2", size = 1685471, upload-time = "2024-12-18T21:19:54.683Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ae/5f/6bb976e619ca28a052e2c0ca7b0251ccd893f93d7c24a96abea38e332bf6/aiohttp-3.11.11-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:620598717fce1b3bd14dd09947ea53e1ad510317c85dda2c9c65b622edc96b12", size = 1715312, upload-time = "2024-12-18T21:19:56.824Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/79/c1/756a7e65aa087c7fac724d6c4c038f2faaa2a42fe56dbc1dd62a33ca7213/aiohttp-3.11.11-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bf8d9bfee991d8acc72d060d53860f356e07a50f0e0d09a8dfedea1c554dd0d5", size = 1672783, upload-time = "2024-12-18T21:19:59.314Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/73/ba/a6190ebb02176c7f75e6308da31f5d49f6477b651a3dcfaaaca865a298e2/aiohttp-3.11.11-cp313-cp313-win32.whl", hash = "sha256:9d73ee3725b7a737ad86c2eac5c57a4a97793d9f442599bea5ec67ac9f4bdc3d", size = 410229, upload-time = "2024-12-18T21:20:02.469Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b8/62/c9fa5bafe03186a0e4699150a7fed9b1e73240996d0d2f0e5f70f3fdf471/aiohttp-3.11.11-cp313-cp313-win_amd64.whl", hash = "sha256:c7a06301c2fb096bdb0bd25fe2011531c1453b9f2c163c8031600ec73af1cc99", size = 436081, upload-time = "2024-12-18T21:20:04.557Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aiosignal"
|
||||
version = "1.3.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "frozenlist" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ba/b5/6d55e80f6d8a08ce22b982eafa278d823b541c925f11ee774b0b9c43473d/aiosignal-1.3.2.tar.gz", hash = "sha256:a8c255c66fafb1e499c9351d0bf32ff2d8a0321595ebac3b93713656d2436f54", size = 19424, upload-time = "2024-12-13T17:10:40.86Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/6a/bc7e17a3e87a2985d3e8f4da4cd0f481060eb78fb08596c42be62c90a4d9/aiosignal-1.3.2-py2.py3-none-any.whl", hash = "sha256:45cde58e409a301715980c2b01d0c28bdde3770d8290b5eb2173759d9acb31a5", size = 7597, upload-time = "2024-12-13T17:10:38.469Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "annotated-types"
|
||||
version = "0.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyio"
|
||||
version = "4.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "idna" },
|
||||
{ name = "sniffio" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f6/40/318e58f669b1a9e00f5c4453910682e2d9dd594334539c7b7817dabb765f/anyio-4.7.0.tar.gz", hash = "sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48", size = 177076, upload-time = "2024-12-05T15:42:09.056Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a0/7a/4daaf3b6c08ad7ceffea4634ec206faeff697526421c20f07628c7372156/anyio-4.7.0-py3-none-any.whl", hash = "sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352", size = 93052, upload-time = "2024-12-05T15:42:06.492Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "attrs"
|
||||
version = "24.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/48/c8/6260f8ccc11f0917360fc0da435c5c9c7504e3db174d5a12a1494887b045/attrs-24.3.0.tar.gz", hash = "sha256:8f5c07333d543103541ba7be0e2ce16eeee8130cb0b3f9238ab904ce1e85baff", size = 805984, upload-time = "2024-12-16T06:59:29.899Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/89/aa/ab0f7891a01eeb2d2e338ae8fecbe57fcebea1a24dbb64d45801bfab481d/attrs-24.3.0-py3-none-any.whl", hash = "sha256:ac96cd038792094f438ad1f6ff80837353805ac950cd2aa0e0625ef19850c308", size = 63397, upload-time = "2024-12-16T06:59:26.977Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "audioop-lts"
|
||||
version = "0.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/dd/3b/69ff8a885e4c1c42014c2765275c4bd91fe7bc9847e9d8543dbcbb09f820/audioop_lts-0.2.1.tar.gz", hash = "sha256:e81268da0baa880431b68b1308ab7257eb33f356e57a5f9b1f915dfb13dd1387", size = 30204, upload-time = "2024-08-04T21:14:43.957Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/01/91/a219253cc6e92db2ebeaf5cf8197f71d995df6f6b16091d1f3ce62cb169d/audioop_lts-0.2.1-cp313-abi3-macosx_10_13_universal2.whl", hash = "sha256:fd1345ae99e17e6910f47ce7d52673c6a1a70820d78b67de1b7abb3af29c426a", size = 46252, upload-time = "2024-08-04T21:13:56.209Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/f6/3cb21e0accd9e112d27cee3b1477cd04dafe88675c54ad8b0d56226c1e0b/audioop_lts-0.2.1-cp313-abi3-macosx_10_13_x86_64.whl", hash = "sha256:e175350da05d2087e12cea8e72a70a1a8b14a17e92ed2022952a4419689ede5e", size = 27183, upload-time = "2024-08-04T21:13:59.966Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ea/7e/f94c8a6a8b2571694375b4cf94d3e5e0f529e8e6ba280fad4d8c70621f27/audioop_lts-0.2.1-cp313-abi3-macosx_11_0_arm64.whl", hash = "sha256:4a8dd6a81770f6ecf019c4b6d659e000dc26571b273953cef7cd1d5ce2ff3ae6", size = 26726, upload-time = "2024-08-04T21:14:00.846Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/f8/a0e8e7a033b03fae2b16bc5aa48100b461c4f3a8a38af56d5ad579924a3a/audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d1cd3c0b6f2ca25c7d2b1c3adeecbe23e65689839ba73331ebc7d893fcda7ffe", size = 80718, upload-time = "2024-08-04T21:14:01.989Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/ea/a98ebd4ed631c93b8b8f2368862cd8084d75c77a697248c24437c36a6f7e/audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff3f97b3372c97782e9c6d3d7fdbe83bce8f70de719605bd7ee1839cd1ab360a", size = 88326, upload-time = "2024-08-04T21:14:03.509Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/33/79/e97a9f9daac0982aa92db1199339bd393594d9a4196ad95ae088635a105f/audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a351af79edefc2a1bd2234bfd8b339935f389209943043913a919df4b0f13300", size = 80539, upload-time = "2024-08-04T21:14:04.679Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b2/d3/1051d80e6f2d6f4773f90c07e73743a1e19fcd31af58ff4e8ef0375d3a80/audioop_lts-0.2.1-cp313-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2aeb6f96f7f6da80354330470b9134d81b4cf544cdd1c549f2f45fe964d28059", size = 78577, upload-time = "2024-08-04T21:14:09.038Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/1d/54f4c58bae8dc8c64a75071c7e98e105ddaca35449376fcb0180f6e3c9df/audioop_lts-0.2.1-cp313-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c589f06407e8340e81962575fcffbba1e92671879a221186c3d4662de9fe804e", size = 82074, upload-time = "2024-08-04T21:14:09.99Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/36/89/2e78daa7cebbea57e72c0e1927413be4db675548a537cfba6a19040d52fa/audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:fbae5d6925d7c26e712f0beda5ed69ebb40e14212c185d129b8dfbfcc335eb48", size = 84210, upload-time = "2024-08-04T21:14:11.468Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a5/57/3ff8a74df2ec2fa6d2ae06ac86e4a27d6412dbb7d0e0d41024222744c7e0/audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_i686.whl", hash = "sha256:d2d5434717f33117f29b5691fbdf142d36573d751716249a288fbb96ba26a281", size = 85664, upload-time = "2024-08-04T21:14:12.394Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/16/01/21cc4e5878f6edbc8e54be4c108d7cb9cb6202313cfe98e4ece6064580dd/audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:f626a01c0a186b08f7ff61431c01c055961ee28769591efa8800beadd27a2959", size = 93255, upload-time = "2024-08-04T21:14:13.707Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/28/7f7418c362a899ac3b0bf13b1fde2d4ffccfdeb6a859abd26f2d142a1d58/audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_s390x.whl", hash = "sha256:05da64e73837f88ee5c6217d732d2584cf638003ac72df124740460531e95e47", size = 87760, upload-time = "2024-08-04T21:14:14.74Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/d8/577a8be87dc7dd2ba568895045cee7d32e81d85a7e44a29000fe02c4d9d4/audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:56b7a0a4dba8e353436f31a932f3045d108a67b5943b30f85a5563f4d8488d77", size = 84992, upload-time = "2024-08-04T21:14:19.155Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/9a/4699b0c4fcf89936d2bfb5425f55f1a8b86dff4237cfcc104946c9cd9858/audioop_lts-0.2.1-cp313-abi3-win32.whl", hash = "sha256:6e899eb8874dc2413b11926b5fb3857ec0ab55222840e38016a6ba2ea9b7d5e3", size = 26059, upload-time = "2024-08-04T21:14:20.438Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3a/1c/1f88e9c5dd4785a547ce5fd1eb83fff832c00cc0e15c04c1119b02582d06/audioop_lts-0.2.1-cp313-abi3-win_amd64.whl", hash = "sha256:64562c5c771fb0a8b6262829b9b4f37a7b886c01b4d3ecdbae1d629717db08b4", size = 30412, upload-time = "2024-08-04T21:14:21.342Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c4/e9/c123fd29d89a6402ad261516f848437472ccc602abb59bba522af45e281b/audioop_lts-0.2.1-cp313-abi3-win_arm64.whl", hash = "sha256:c45317debeb64002e980077642afbd977773a25fa3dfd7ed0c84dccfc1fafcb0", size = 23578, upload-time = "2024-08-04T21:14:22.193Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/99/bb664a99561fd4266687e5cb8965e6ec31ba4ff7002c3fce3dc5ef2709db/audioop_lts-0.2.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:3827e3fce6fee4d69d96a3d00cd2ab07f3c0d844cb1e44e26f719b34a5b15455", size = 46827, upload-time = "2024-08-04T21:14:23.034Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c4/e3/f664171e867e0768ab982715e744430cf323f1282eb2e11ebfb6ee4c4551/audioop_lts-0.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:161249db9343b3c9780ca92c0be0d1ccbfecdbccac6844f3d0d44b9c4a00a17f", size = 27479, upload-time = "2024-08-04T21:14:23.922Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/0d/2a79231ff54eb20e83b47e7610462ad6a2bea4e113fae5aa91c6547e7764/audioop_lts-0.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5b7b4ff9de7a44e0ad2618afdc2ac920b91f4a6d3509520ee65339d4acde5abf", size = 27056, upload-time = "2024-08-04T21:14:28.061Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/86/46/342471398283bb0634f5a6df947806a423ba74b2e29e250c7ec0e3720e4f/audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:72e37f416adb43b0ced93419de0122b42753ee74e87070777b53c5d2241e7fab", size = 87802, upload-time = "2024-08-04T21:14:29.586Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/56/44/7a85b08d4ed55517634ff19ddfbd0af05bf8bfd39a204e4445cd0e6f0cc9/audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:534ce808e6bab6adb65548723c8cbe189a3379245db89b9d555c4210b4aaa9b6", size = 95016, upload-time = "2024-08-04T21:14:30.481Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/2a/45edbca97ea9ee9e6bbbdb8d25613a36e16a4d1e14ae01557392f15cc8d3/audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d2de9b6fb8b1cf9f03990b299a9112bfdf8b86b6987003ca9e8a6c4f56d39543", size = 87394, upload-time = "2024-08-04T21:14:31.883Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/14/ae/832bcbbef2c510629593bf46739374174606e25ac7d106b08d396b74c964/audioop_lts-0.2.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f24865991b5ed4b038add5edbf424639d1358144f4e2a3e7a84bc6ba23e35074", size = 84874, upload-time = "2024-08-04T21:14:32.751Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/26/1c/8023c3490798ed2f90dfe58ec3b26d7520a243ae9c0fc751ed3c9d8dbb69/audioop_lts-0.2.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bdb3b7912ccd57ea53197943f1bbc67262dcf29802c4a6df79ec1c715d45a78", size = 88698, upload-time = "2024-08-04T21:14:34.147Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/db/5379d953d4918278b1f04a5a64b2c112bd7aae8f81021009da0dcb77173c/audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:120678b208cca1158f0a12d667af592e067f7a50df9adc4dc8f6ad8d065a93fb", size = 90401, upload-time = "2024-08-04T21:14:35.276Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/99/6e/3c45d316705ab1aec2e69543a5b5e458d0d112a93d08994347fafef03d50/audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:54cd4520fc830b23c7d223693ed3e1b4d464997dd3abc7c15dce9a1f9bd76ab2", size = 91864, upload-time = "2024-08-04T21:14:36.158Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/58/6a371d8fed4f34debdb532c0b00942a84ebf3e7ad368e5edc26931d0e251/audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:d6bd20c7a10abcb0fb3d8aaa7508c0bf3d40dfad7515c572014da4b979d3310a", size = 98796, upload-time = "2024-08-04T21:14:37.185Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ee/77/d637aa35497e0034ff846fd3330d1db26bc6fd9dd79c406e1341188b06a2/audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:f0ed1ad9bd862539ea875fb339ecb18fcc4148f8d9908f4502df28f94d23491a", size = 94116, upload-time = "2024-08-04T21:14:38.145Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/60/7afc2abf46bbcf525a6ebc0305d85ab08dc2d1e2da72c48dbb35eee5b62c/audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e1af3ff32b8c38a7d900382646e91f2fc515fd19dea37e9392275a5cbfdbff63", size = 91520, upload-time = "2024-08-04T21:14:39.128Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/65/6d/42d40da100be1afb661fd77c2b1c0dfab08af1540df57533621aea3db52a/audioop_lts-0.2.1-cp313-cp313t-win32.whl", hash = "sha256:f51bb55122a89f7a0817d7ac2319744b4640b5b446c4c3efcea5764ea99ae509", size = 26482, upload-time = "2024-08-04T21:14:40.269Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/01/09/f08494dca79f65212f5b273aecc5a2f96691bf3307cac29acfcf84300c01/audioop_lts-0.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:f0f2f336aa2aee2bce0b0dcc32bbba9178995454c7b979cf6ce086a8801e14c7", size = 30780, upload-time = "2024-08-04T21:14:41.128Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/35/be73b6015511aa0173ec595fc579133b797ad532996f2998fd6b8d1bbe6b/audioop_lts-0.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:78bfb3703388c780edf900be66e07de5a3d4105ca8e8720c5c4d67927e0b15d0", size = 23918, upload-time = "2024-08-04T21:14:42.803Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.1.8"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593, upload-time = "2024-12-21T18:38:44.339Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2", size = 98188, upload-time = "2024-12-21T18:38:41.666Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dakiny-bot"
|
||||
version = "0.1.0"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "aiofiles" },
|
||||
{ name = "audioop-lts" },
|
||||
{ name = "dataclass-wizard", extra = ["yaml"] },
|
||||
{ name = "fastapi" },
|
||||
{ name = "gitpython" },
|
||||
{ name = "nextcord" },
|
||||
{ name = "pandas" },
|
||||
{ name = "pytz" },
|
||||
{ name = "setuptools" },
|
||||
{ name = "sqlalchemy" },
|
||||
{ name = "uvicorn" },
|
||||
]
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "ruff" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "aiofiles", specifier = ">=23.2.1,<24.0.0" },
|
||||
{ name = "audioop-lts", specifier = ">=0.2.1" },
|
||||
{ name = "dataclass-wizard", extras = ["yaml"], specifier = ">=0.22.3,<1.0.0" },
|
||||
{ name = "fastapi", specifier = ">=0.111.0,<1.0.0" },
|
||||
{ name = "gitpython", specifier = ">=3.1.43,<4.0.0" },
|
||||
{ name = "nextcord", specifier = ">=2.6.0,<3.0.0" },
|
||||
{ name = "pandas", specifier = ">=2.2.2,<3.0.0" },
|
||||
{ name = "pytz", specifier = ">=2025.2,<2025.3" },
|
||||
{ name = "setuptools", specifier = ">=80.10.2,<80.10.3" },
|
||||
{ name = "sqlalchemy", specifier = ">=2.0.30,<3.0.0" },
|
||||
{ name = "uvicorn", specifier = ">=0.34.0" },
|
||||
]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [{ name = "ruff", specifier = ">=0.6.9,<1.0.0" }]
|
||||
|
||||
[[package]]
|
||||
name = "dataclass-wizard"
|
||||
version = "0.33.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/0a/2a/6ae6638cd5ca919b73d393cdb4a4e53c8c3dcacc003a79d9480ecad46798/dataclass-wizard-0.33.0.tar.gz", hash = "sha256:10edbac626c390ed1f3be4f972303bc2c25c162fd453d55adfe22b05b263ee6d", size = 269911, upload-time = "2024-12-17T21:46:57.38Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f8/e6/fa8b6615f988a271b1ab990f0086f90c936608762f02d02db9164cfd7ff9/dataclass_wizard-0.33.0-py2.py3-none-any.whl", hash = "sha256:d257d65a707f6ea76140ad5442189ffe6fc68e1d678dc6b3fa25754e3106160d", size = 164545, upload-time = "2024-12-17T21:46:53.835Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
yaml = [
|
||||
{ name = "pyyaml" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastapi"
|
||||
version = "0.115.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "starlette" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/93/72/d83b98cd106541e8f5e5bfab8ef2974ab45a62e8a6c5b5e6940f26d2ed4b/fastapi-0.115.6.tar.gz", hash = "sha256:9ec46f7addc14ea472958a96aae5b5de65f39721a46aaf5705c480d9a8b76654", size = 301336, upload-time = "2024-12-03T22:46:01.629Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/52/b3/7e4df40e585df024fac2f80d1a2d579c854ac37109675db2b0cc22c0bb9e/fastapi-0.115.6-py3-none-any.whl", hash = "sha256:e9240b29e36fa8f4bb7290316988e90c381e5092e0cbe84e7818cc3713bcf305", size = 94843, upload-time = "2024-12-03T22:45:59.368Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "frozenlist"
|
||||
version = "1.5.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/8f/ed/0f4cec13a93c02c47ec32d81d11c0c1efbadf4a471e3f3ce7cad366cbbd3/frozenlist-1.5.0.tar.gz", hash = "sha256:81d5af29e61b9c8348e876d442253723928dce6433e0e76cd925cd83f1b4b817", size = 39930, upload-time = "2024-10-23T09:48:29.903Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/da/3b/915f0bca8a7ea04483622e84a9bd90033bab54bdf485479556c74fd5eaf5/frozenlist-1.5.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7a1a048f9215c90973402e26c01d1cff8a209e1f1b53f72b95c13db61b00f953", size = 91538, upload-time = "2024-10-23T09:47:21.176Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c7/d1/a7c98aad7e44afe5306a2b068434a5830f1470675f0e715abb86eb15f15b/frozenlist-1.5.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:dd47a5181ce5fcb463b5d9e17ecfdb02b678cca31280639255ce9d0e5aa67af0", size = 52849, upload-time = "2024-10-23T09:47:22.439Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3a/c8/76f23bf9ab15d5f760eb48701909645f686f9c64fbb8982674c241fbef14/frozenlist-1.5.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1431d60b36d15cda188ea222033eec8e0eab488f39a272461f2e6d9e1a8e63c2", size = 50583, upload-time = "2024-10-23T09:47:23.44Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1f/22/462a3dd093d11df623179d7754a3b3269de3b42de2808cddef50ee0f4f48/frozenlist-1.5.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6482a5851f5d72767fbd0e507e80737f9c8646ae7fd303def99bfe813f76cf7f", size = 265636, upload-time = "2024-10-23T09:47:24.82Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/80/cf/e075e407fc2ae7328155a1cd7e22f932773c8073c1fc78016607d19cc3e5/frozenlist-1.5.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:44c49271a937625619e862baacbd037a7ef86dd1ee215afc298a417ff3270608", size = 270214, upload-time = "2024-10-23T09:47:26.156Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a1/58/0642d061d5de779f39c50cbb00df49682832923f3d2ebfb0fedf02d05f7f/frozenlist-1.5.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:12f78f98c2f1c2429d42e6a485f433722b0061d5c0b0139efa64f396efb5886b", size = 273905, upload-time = "2024-10-23T09:47:27.741Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/66/3fe0f5f8f2add5b4ab7aa4e199f767fd3b55da26e3ca4ce2cc36698e50c4/frozenlist-1.5.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ce3aa154c452d2467487765e3adc730a8c153af77ad84096bc19ce19a2400840", size = 250542, upload-time = "2024-10-23T09:47:28.938Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f6/b8/260791bde9198c87a465224e0e2bb62c4e716f5d198fc3a1dacc4895dbd1/frozenlist-1.5.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9b7dc0c4338e6b8b091e8faf0db3168a37101943e687f373dce00959583f7439", size = 267026, upload-time = "2024-10-23T09:47:30.283Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2e/a4/3d24f88c527f08f8d44ade24eaee83b2627793fa62fa07cbb7ff7a2f7d42/frozenlist-1.5.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:45e0896250900b5aa25180f9aec243e84e92ac84bd4a74d9ad4138ef3f5c97de", size = 257690, upload-time = "2024-10-23T09:47:32.388Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/de/9a/d311d660420b2beeff3459b6626f2ab4fb236d07afbdac034a4371fe696e/frozenlist-1.5.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:561eb1c9579d495fddb6da8959fd2a1fca2c6d060d4113f5844b433fc02f2641", size = 253893, upload-time = "2024-10-23T09:47:34.274Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/23/e491aadc25b56eabd0f18c53bb19f3cdc6de30b2129ee0bc39cd387cd560/frozenlist-1.5.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:df6e2f325bfee1f49f81aaac97d2aa757c7646534a06f8f577ce184afe2f0a9e", size = 267006, upload-time = "2024-10-23T09:47:35.499Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/c4/ab918ce636a35fb974d13d666dcbe03969592aeca6c3ab3835acff01f79c/frozenlist-1.5.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:140228863501b44b809fb39ec56b5d4071f4d0aa6d216c19cbb08b8c5a7eadb9", size = 276157, upload-time = "2024-10-23T09:47:37.522Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/29/3b7a0bbbbe5a34833ba26f686aabfe982924adbdcafdc294a7a129c31688/frozenlist-1.5.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7707a25d6a77f5d27ea7dc7d1fc608aa0a478193823f88511ef5e6b8a48f9d03", size = 264642, upload-time = "2024-10-23T09:47:38.75Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/42/0595b3dbffc2e82d7fe658c12d5a5bafcd7516c6bf2d1d1feb5387caa9c1/frozenlist-1.5.0-cp313-cp313-win32.whl", hash = "sha256:31a9ac2b38ab9b5a8933b693db4939764ad3f299fcaa931a3e605bc3460e693c", size = 44914, upload-time = "2024-10-23T09:47:40.145Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/17/c4/b7db1206a3fea44bf3b838ca61deb6f74424a8a5db1dd53ecb21da669be6/frozenlist-1.5.0-cp313-cp313-win_amd64.whl", hash = "sha256:11aabdd62b8b9c4b84081a3c246506d1cddd2dd93ff0ad53ede5defec7886b28", size = 51167, upload-time = "2024-10-23T09:47:41.812Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/c8/a5be5b7550c10858fcf9b0ea054baccab474da77d37f1e828ce043a3a5d4/frozenlist-1.5.0-py3-none-any.whl", hash = "sha256:d994863bba198a4a518b467bb971c56e1db3f180a25c6cf7bb1949c267f748c3", size = 11901, upload-time = "2024-10-23T09:48:28.851Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitdb"
|
||||
version = "4.0.11"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "smmap" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/19/0d/bbb5b5ee188dec84647a4664f3e11b06ade2bde568dbd489d9d64adef8ed/gitdb-4.0.11.tar.gz", hash = "sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b", size = 394469, upload-time = "2023-10-20T07:43:19.146Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/5b/8f0c4a5bb9fd491c277c21eff7ccae71b47d43c4446c9d0c6cff2fe8c2c4/gitdb-4.0.11-py3-none-any.whl", hash = "sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4", size = 62721, upload-time = "2023-10-20T07:43:16.712Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitpython"
|
||||
version = "3.1.43"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "gitdb" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b6/a1/106fd9fa2dd989b6fb36e5893961f82992cf676381707253e0bf93eb1662/GitPython-3.1.43.tar.gz", hash = "sha256:35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c", size = 214149, upload-time = "2024-03-31T08:07:34.154Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/bd/cc3a402a6439c15c3d4294333e13042b915bbeab54edc457c723931fed3f/GitPython-3.1.43-py3-none-any.whl", hash = "sha256:eec7ec56b92aad751f9912a73404bc02ba212a23adb2c7098ee668417051a1ff", size = 207337, upload-time = "2024-03-31T08:07:31.194Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h11"
|
||||
version = "0.14.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f5/38/3af3d3633a34a3316095b39c8e8fb4853a28a536e55d347bd8d8e9a14b03/h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d", size = 100418, upload-time = "2022-09-25T15:40:01.519Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761", size = 58259, upload-time = "2022-09-25T15:39:59.68Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.10"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490, upload-time = "2024-09-15T18:07:39.745Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multidict"
|
||||
version = "6.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d6/be/504b89a5e9ca731cd47487e91c469064f8ae5af93b7259758dcfc2b9c848/multidict-6.1.0.tar.gz", hash = "sha256:22ae2ebf9b0c69d206c003e2f6a914ea33f0a932d4aa16f236afc049d9958f4a", size = 64002, upload-time = "2024-09-09T23:49:38.163Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/22/67/1c7c0f39fe069aa4e5d794f323be24bf4d33d62d2a348acdb7991f8f30db/multidict-6.1.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:d569388c381b24671589335a3be6e1d45546c2988c2ebe30fdcada8457a31008", size = 48771, upload-time = "2024-09-09T23:48:24.594Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/25/c186ee7b212bdf0df2519eacfb1981a017bda34392c67542c274651daf23/multidict-6.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:052e10d2d37810b99cc170b785945421141bf7bb7d2f8799d431e7db229c385f", size = 29533, upload-time = "2024-09-09T23:48:26.187Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/67/5e/04575fd837e0958e324ca035b339cea174554f6f641d3fb2b4f2e7ff44a2/multidict-6.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f90c822a402cb865e396a504f9fc8173ef34212a342d92e362ca498cad308e28", size = 29595, upload-time = "2024-09-09T23:48:27.305Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d3/b2/e56388f86663810c07cfe4a3c3d87227f3811eeb2d08450b9e5d19d78876/multidict-6.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b225d95519a5bf73860323e633a664b0d85ad3d5bede6d30d95b35d4dfe8805b", size = 130094, upload-time = "2024-09-09T23:48:28.544Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6c/ee/30ae9b4186a644d284543d55d491fbd4239b015d36b23fea43b4c94f7052/multidict-6.1.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:23bfd518810af7de1116313ebd9092cb9aa629beb12f6ed631ad53356ed6b86c", size = 134876, upload-time = "2024-09-09T23:48:30.098Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/84/c7/70461c13ba8ce3c779503c70ec9d0345ae84de04521c1f45a04d5f48943d/multidict-6.1.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c09fcfdccdd0b57867577b719c69e347a436b86cd83747f179dbf0cc0d4c1f3", size = 133500, upload-time = "2024-09-09T23:48:31.793Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/9f/002af221253f10f99959561123fae676148dd730e2daa2cd053846a58507/multidict-6.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf6bea52ec97e95560af5ae576bdac3aa3aae0b6758c6efa115236d9e07dae44", size = 131099, upload-time = "2024-09-09T23:48:33.193Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/82/42/d1c7a7301d52af79d88548a97e297f9d99c961ad76bbe6f67442bb77f097/multidict-6.1.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57feec87371dbb3520da6192213c7d6fc892d5589a93db548331954de8248fd2", size = 120403, upload-time = "2024-09-09T23:48:34.942Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/68/f3/471985c2c7ac707547553e8f37cff5158030d36bdec4414cb825fbaa5327/multidict-6.1.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0c3f390dc53279cbc8ba976e5f8035eab997829066756d811616b652b00a23a3", size = 125348, upload-time = "2024-09-09T23:48:36.222Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/67/2c/e6df05c77e0e433c214ec1d21ddd203d9a4770a1f2866a8ca40a545869a0/multidict-6.1.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:59bfeae4b25ec05b34f1956eaa1cb38032282cd4dfabc5056d0a1ec4d696d3aa", size = 119673, upload-time = "2024-09-09T23:48:37.588Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c5/cd/bc8608fff06239c9fb333f9db7743a1b2eafe98c2666c9a196e867a3a0a4/multidict-6.1.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:b2f59caeaf7632cc633b5cf6fc449372b83bbdf0da4ae04d5be36118e46cc0aa", size = 129927, upload-time = "2024-09-09T23:48:39.128Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/44/8e/281b69b7bc84fc963a44dc6e0bbcc7150e517b91df368a27834299a526ac/multidict-6.1.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:37bb93b2178e02b7b618893990941900fd25b6b9ac0fa49931a40aecdf083fe4", size = 128711, upload-time = "2024-09-09T23:48:40.55Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/a4/63e7cd38ed29dd9f1881d5119f272c898ca92536cdb53ffe0843197f6c85/multidict-6.1.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4e9f48f58c2c523d5a06faea47866cd35b32655c46b443f163d08c6d0ddb17d6", size = 125519, upload-time = "2024-09-09T23:48:42.446Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/38/e0/4f5855037a72cd8a7a2f60a3952d9aa45feedb37ae7831642102604e8a37/multidict-6.1.0-cp313-cp313-win32.whl", hash = "sha256:3a37ffb35399029b45c6cc33640a92bef403c9fd388acce75cdc88f58bd19a81", size = 26426, upload-time = "2024-09-09T23:48:43.936Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/a5/17ee3a4db1e310b7405f5d25834460073a8ccd86198ce044dfaf69eac073/multidict-6.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:e9aa71e15d9d9beaad2c6b9319edcdc0a49a43ef5c0a4c8265ca9ee7d6c67774", size = 28531, upload-time = "2024-09-09T23:48:45.122Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/99/b7/b9e70fde2c0f0c9af4cc5277782a89b66d35948ea3369ec9f598358c3ac5/multidict-6.1.0-py3-none-any.whl", hash = "sha256:48e171e52d1c4d33888e529b999e5900356b9ae588c2f09a52dcefb158b27506", size = 10051, upload-time = "2024-09-09T23:49:36.506Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nextcord"
|
||||
version = "2.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f2/0e/347795cec6bc841ed426bc5e112380335869e9ba0922c5ed7ec7bb8ab1a5/nextcord-2.6.0.tar.gz", hash = "sha256:ccf461157be682cbceaa474e8df4afa302351b8d6ced632f9ccb7aa647b092e7", size = 932913, upload-time = "2023-09-23T16:29:52.347Z" }
|
||||
|
||||
[[package]]
|
||||
name = "numpy"
|
||||
version = "2.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f2/a5/fdbf6a7871703df6160b5cf3dd774074b086d278172285c52c2758b76305/numpy-2.2.1.tar.gz", hash = "sha256:45681fd7128c8ad1c379f0ca0776a8b0c6583d2f69889ddac01559dfe4390918", size = 20227662, upload-time = "2024-12-21T22:49:36.523Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/20/d6/91a26e671c396e0c10e327b763485ee295f5a5a7a48c553f18417e5a0ed5/numpy-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f1d09e520217618e76396377c81fba6f290d5f926f50c35f3a5f72b01a0da780", size = 20896464, upload-time = "2024-12-21T22:37:01.393Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/40/5792ccccd91d45e87d9e00033abc4f6ca8a828467b193f711139ff1f1cd9/numpy-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3ecc47cd7f6ea0336042be87d9e7da378e5c7e9b3c8ad0f7c966f714fc10d821", size = 14111350, upload-time = "2024-12-21T22:37:35.152Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/2a/fb0a27f846cb857cef0c4c92bef89f133a3a1abb4e16bba1c4dace2e9b49/numpy-2.2.1-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:f419290bc8968a46c4933158c91a0012b7a99bb2e465d5ef5293879742f8797e", size = 5111629, upload-time = "2024-12-21T22:37:51.291Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/e5/8e81bb9d84db88b047baf4e8b681a3e48d6390bc4d4e4453eca428ecbb49/numpy-2.2.1-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:5b6c390bfaef8c45a260554888966618328d30e72173697e5cabe6b285fb2348", size = 6645865, upload-time = "2024-12-21T22:38:03.738Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/1a/a90ceb191dd2f9e2897c69dde93ccc2d57dd21ce2acbd7b0333e8eea4e8d/numpy-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:526fc406ab991a340744aad7e25251dd47a6720a685fa3331e5c59fef5282a59", size = 14043508, upload-time = "2024-12-21T22:38:41.854Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/5a/e572284c86a59dec0871a49cd4e5351e20b9c751399d5f1d79628c0542cb/numpy-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f74e6fdeb9a265624ec3a3918430205dff1df7e95a230779746a6af78bc615af", size = 16094100, upload-time = "2024-12-21T22:39:12.904Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0c/2c/a79d24f364788386d85899dd280a94f30b0950be4b4a545f4fa4ed1d4ca7/numpy-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:53c09385ff0b72ba79d8715683c1168c12e0b6e84fb0372e97553d1ea91efe51", size = 15239691, upload-time = "2024-12-21T22:39:48.32Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cf/79/1e20fd1c9ce5a932111f964b544facc5bb9bde7865f5b42f00b4a6a9192b/numpy-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f3eac17d9ec51be534685ba877b6ab5edc3ab7ec95c8f163e5d7b39859524716", size = 17856571, upload-time = "2024-12-21T22:40:22.575Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/be/5b/cc155e107f75d694f562bdc84a26cc930569f3dfdfbccb3420b626065777/numpy-2.2.1-cp313-cp313-win32.whl", hash = "sha256:9ad014faa93dbb52c80d8f4d3dcf855865c876c9660cb9bd7553843dd03a4b1e", size = 6270841, upload-time = "2024-12-21T22:45:15.101Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/44/be/0e5cd009d2162e4138d79a5afb3b5d2341f0fe4777ab6e675aa3d4a42e21/numpy-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:164a829b6aacf79ca47ba4814b130c4020b202522a93d7bff2202bfb33b61c60", size = 12606618, upload-time = "2024-12-21T22:45:47.227Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/87/04ddf02dd86fb17c7485a5f87b605c4437966d53de1e3745d450343a6f56/numpy-2.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:4dfda918a13cc4f81e9118dea249e192ab167a0bb1966272d5503e39234d694e", size = 20921004, upload-time = "2024-12-21T22:40:58.532Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6e/3e/d0e9e32ab14005425d180ef950badf31b862f3839c5b927796648b11f88a/numpy-2.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:733585f9f4b62e9b3528dd1070ec4f52b8acf64215b60a845fa13ebd73cd0712", size = 14119910, upload-time = "2024-12-21T22:41:41.298Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b5/5b/aa2d1905b04a8fb681e08742bb79a7bddfc160c7ce8e1ff6d5c821be0236/numpy-2.2.1-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:89b16a18e7bba224ce5114db863e7029803c179979e1af6ad6a6b11f70545008", size = 5153612, upload-time = "2024-12-21T22:41:52.23Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ce/35/6831808028df0648d9b43c5df7e1051129aa0d562525bacb70019c5f5030/numpy-2.2.1-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:676f4eebf6b2d430300f1f4f4c2461685f8269f94c89698d832cdf9277f30b84", size = 6668401, upload-time = "2024-12-21T22:42:05.378Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b1/38/10ef509ad63a5946cc042f98d838daebfe7eaf45b9daaf13df2086b15ff9/numpy-2.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:27f5cdf9f493b35f7e41e8368e7d7b4bbafaf9660cba53fb21d2cd174ec09631", size = 14014198, upload-time = "2024-12-21T22:42:36.414Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/df/f8/c80968ae01df23e249ee0a4487fae55a4c0fe2f838dfe9cc907aa8aea0fa/numpy-2.2.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c1ad395cf254c4fbb5b2132fee391f361a6e8c1adbd28f2cd8e79308a615fe9d", size = 16076211, upload-time = "2024-12-21T22:43:10.125Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/09/69/05c169376016a0b614b432967ac46ff14269eaffab80040ec03ae1ae8e2c/numpy-2.2.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:08ef779aed40dbc52729d6ffe7dd51df85796a702afbf68a4f4e41fafdc8bda5", size = 15220266, upload-time = "2024-12-21T22:43:44.16Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/ff/94a4ce67ea909f41cf7ea712aebbe832dc67decad22944a1020bb398a5ee/numpy-2.2.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:26c9c4382b19fcfbbed3238a14abf7ff223890ea1936b8890f058e7ba35e8d71", size = 17852844, upload-time = "2024-12-21T22:44:19.029Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/72/8a5dbce4020dfc595592333ef2fbb0a187d084ca243b67766d29d03e0096/numpy-2.2.1-cp313-cp313t-win32.whl", hash = "sha256:93cf4e045bae74c90ca833cba583c14b62cb4ba2cba0abd2b141ab52548247e2", size = 6326007, upload-time = "2024-12-21T22:44:34.097Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7b/9c/4fce9cf39dde2562584e4cfd351a0140240f82c0e3569ce25a250f47037d/numpy-2.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:bff7d8ec20f5f42607599f9994770fa65d76edca264a87b5e4ea5629bce12268", size = 12693107, upload-time = "2024-12-21T22:44:57.542Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pandas"
|
||||
version = "2.2.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "numpy" },
|
||||
{ name = "python-dateutil" },
|
||||
{ name = "pytz" },
|
||||
{ name = "tzdata" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9c/d6/9f8431bacc2e19dca897724cd097b1bb224a6ad5433784a44b587c7c13af/pandas-2.2.3.tar.gz", hash = "sha256:4f18ba62b61d7e192368b84517265a99b4d7ee8912f8708660fb4a366cc82667", size = 4399213, upload-time = "2024-09-20T13:10:04.827Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/64/22/3b8f4e0ed70644e85cfdcd57454686b9057c6c38d2f74fe4b8bc2527214a/pandas-2.2.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f00d1345d84d8c86a63e476bb4955e46458b304b9575dcf71102b5c705320015", size = 12477643, upload-time = "2024-09-20T13:09:25.522Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e4/93/b3f5d1838500e22c8d793625da672f3eec046b1a99257666c94446969282/pandas-2.2.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3508d914817e153ad359d7e069d752cdd736a247c322d932eb89e6bc84217f28", size = 11281573, upload-time = "2024-09-20T13:09:28.012Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/94/6c79b07f0e5aab1dcfa35a75f4817f5c4f677931d4234afcd75f0e6a66ca/pandas-2.2.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:22a9d949bfc9a502d320aa04e5d02feab689d61da4e7764b62c30b991c42c5f0", size = 15196085, upload-time = "2024-09-20T19:02:10.451Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/31/aa8da88ca0eadbabd0a639788a6da13bb2ff6edbbb9f29aa786450a30a91/pandas-2.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3a255b2c19987fbbe62a9dfd6cff7ff2aa9ccab3fc75218fd4b7530f01efa24", size = 12711809, upload-time = "2024-09-20T13:09:30.814Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ee/7c/c6dbdb0cb2a4344cacfb8de1c5808ca885b2e4dcfde8008266608f9372af/pandas-2.2.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:800250ecdadb6d9c78eae4990da62743b857b470883fa27f652db8bdde7f6659", size = 16356316, upload-time = "2024-09-20T19:02:13.825Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/57/b7/8b757e7d92023b832869fa8881a992696a0bfe2e26f72c9ae9f255988d42/pandas-2.2.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6374c452ff3ec675a8f46fd9ab25c4ad0ba590b71cf0656f8b6daa5202bca3fb", size = 14022055, upload-time = "2024-09-20T13:09:33.462Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3b/bc/4b18e2b8c002572c5a441a64826252ce5da2aa738855747247a971988043/pandas-2.2.3-cp313-cp313-win_amd64.whl", hash = "sha256:61c5ad4043f791b61dd4752191d9f07f0ae412515d59ba8f005832a532f8736d", size = 11481175, upload-time = "2024-09-20T13:09:35.871Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/a3/a5d88146815e972d40d19247b2c162e88213ef51c7c25993942c39dbf41d/pandas-2.2.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:3b71f27954685ee685317063bf13c7709a7ba74fc996b84fc6821c59b0f06468", size = 12615650, upload-time = "2024-09-20T13:09:38.685Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9c/8c/f0fd18f6140ddafc0c24122c8a964e48294acc579d47def376fef12bcb4a/pandas-2.2.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:38cf8125c40dae9d5acc10fa66af8ea6fdf760b2714ee482ca691fc66e6fcb18", size = 11290177, upload-time = "2024-09-20T13:09:41.141Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ed/f9/e995754eab9c0f14c6777401f7eece0943840b7a9fc932221c19d1abee9f/pandas-2.2.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ba96630bc17c875161df3818780af30e43be9b166ce51c9a18c1feae342906c2", size = 14651526, upload-time = "2024-09-20T19:02:16.905Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/b0/98d6ae2e1abac4f35230aa756005e8654649d305df9a28b16b9ae4353bff/pandas-2.2.3-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1db71525a1538b30142094edb9adc10be3f3e176748cd7acc2240c2f2e5aa3a4", size = 11871013, upload-time = "2024-09-20T13:09:44.39Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cc/57/0f72a10f9db6a4628744c8e8f0df4e6e21de01212c7c981d31e50ffc8328/pandas-2.2.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:15c0e1e02e93116177d29ff83e8b1619c93ddc9c49083f237d4312337a61165d", size = 15711620, upload-time = "2024-09-20T19:02:20.639Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/5f/b38085618b950b79d2d9164a711c52b10aefc0ae6833b96f626b7021b2ed/pandas-2.2.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:ad5b65698ab28ed8d7f18790a0dc58005c7629f227be9ecc1072aa74c0c1d43a", size = 13098436, upload-time = "2024-09-20T13:09:48.112Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "propcache"
|
||||
version = "0.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/20/c8/2a13f78d82211490855b2fb303b6721348d0787fdd9a12ac46d99d3acde1/propcache-0.2.1.tar.gz", hash = "sha256:3f77ce728b19cb537714499928fe800c3dda29e8d9428778fc7c186da4c09a64", size = 41735, upload-time = "2024-12-01T18:29:16.437Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0f/2a/329e0547cf2def8857157f9477669043e75524cc3e6251cef332b3ff256f/propcache-0.2.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:aca405706e0b0a44cc6bfd41fbe89919a6a56999157f6de7e182a990c36e37bc", size = 77002, upload-time = "2024-12-01T18:28:29.025Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/2d/c4df5415e2382f840dc2ecbca0eeb2293024bc28e57a80392f2012b4708c/propcache-0.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:12d1083f001ace206fe34b6bdc2cb94be66d57a850866f0b908972f90996b3e9", size = 44639, upload-time = "2024-12-01T18:28:30.199Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/5a/21aaa4ea2f326edaa4e240959ac8b8386ea31dedfdaa636a3544d9e7a408/propcache-0.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:d93f3307ad32a27bda2e88ec81134b823c240aa3abb55821a8da553eed8d9439", size = 44049, upload-time = "2024-12-01T18:28:31.308Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4e/3e/021b6cd86c0acc90d74784ccbb66808b0bd36067a1bf3e2deb0f3845f618/propcache-0.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ba278acf14471d36316159c94a802933d10b6a1e117b8554fe0d0d9b75c9d536", size = 224819, upload-time = "2024-12-01T18:28:32.755Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/57/c2fdeed1b3b8918b1770a133ba5c43ad3d78e18285b0c06364861ef5cc38/propcache-0.2.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4e6281aedfca15301c41f74d7005e6e3f4ca143584ba696ac69df4f02f40d629", size = 229625, upload-time = "2024-12-01T18:28:34.083Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9d/81/70d4ff57bf2877b5780b466471bebf5892f851a7e2ca0ae7ffd728220281/propcache-0.2.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5b750a8e5a1262434fb1517ddf64b5de58327f1adc3524a5e44c2ca43305eb0b", size = 232934, upload-time = "2024-12-01T18:28:35.434Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/b9/bb51ea95d73b3fb4100cb95adbd4e1acaf2cbb1fd1083f5468eeb4a099a8/propcache-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf72af5e0fb40e9babf594308911436c8efde3cb5e75b6f206c34ad18be5c052", size = 227361, upload-time = "2024-12-01T18:28:36.777Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/20/3c6d696cd6fd70b29445960cc803b1851a1131e7a2e4ee261ee48e002bcd/propcache-0.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b2d0a12018b04f4cb820781ec0dffb5f7c7c1d2a5cd22bff7fb055a2cb19ebce", size = 213904, upload-time = "2024-12-01T18:28:38.041Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a1/cb/1593bfc5ac6d40c010fa823f128056d6bc25b667f5393781e37d62f12005/propcache-0.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e800776a79a5aabdb17dcc2346a7d66d0777e942e4cd251defeb084762ecd17d", size = 212632, upload-time = "2024-12-01T18:28:39.401Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/5c/e95617e222be14a34c709442a0ec179f3207f8a2b900273720501a70ec5e/propcache-0.2.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:4160d9283bd382fa6c0c2b5e017acc95bc183570cd70968b9202ad6d8fc48dce", size = 207897, upload-time = "2024-12-01T18:28:40.996Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8e/3b/56c5ab3dc00f6375fbcdeefdede5adf9bee94f1fab04adc8db118f0f9e25/propcache-0.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:30b43e74f1359353341a7adb783c8f1b1c676367b011709f466f42fda2045e95", size = 208118, upload-time = "2024-12-01T18:28:42.38Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/86/25/d7ef738323fbc6ebcbce33eb2a19c5e07a89a3df2fded206065bd5e868a9/propcache-0.2.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:58791550b27d5488b1bb52bc96328456095d96206a250d28d874fafe11b3dfaf", size = 217851, upload-time = "2024-12-01T18:28:43.655Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/77/763e6cef1852cf1ba740590364ec50309b89d1c818e3256d3929eb92fabf/propcache-0.2.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:0f022d381747f0dfe27e99d928e31bc51a18b65bb9e481ae0af1380a6725dd1f", size = 222630, upload-time = "2024-12-01T18:28:45.663Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4f/e9/0f86be33602089c701696fbed8d8c4c07b6ee9605c5b7536fd27ed540c5b/propcache-0.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:297878dc9d0a334358f9b608b56d02e72899f3b8499fc6044133f0d319e2ec30", size = 216269, upload-time = "2024-12-01T18:28:47.602Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cc/02/5ac83217d522394b6a2e81a2e888167e7ca629ef6569a3f09852d6dcb01a/propcache-0.2.1-cp313-cp313-win32.whl", hash = "sha256:ddfab44e4489bd79bda09d84c430677fc7f0a4939a73d2bba3073036f487a0a6", size = 39472, upload-time = "2024-12-01T18:28:48.983Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f4/33/d6f5420252a36034bc8a3a01171bc55b4bff5df50d1c63d9caa50693662f/propcache-0.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:556fc6c10989f19a179e4321e5d678db8eb2924131e64652a51fe83e4c3db0e1", size = 43363, upload-time = "2024-12-01T18:28:50.025Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/41/b6/c5319caea262f4821995dca2107483b94a3345d4607ad797c76cb9c36bcc/propcache-0.2.1-py3-none-any.whl", hash = "sha256:52277518d6aae65536e9cea52d4e7fd2f7a66f4aa2d30ed3f2fcea620ace3c54", size = 11818, upload-time = "2024-12-01T18:29:14.716Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.10.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/70/7e/fb60e6fee04d0ef8f15e4e01ff187a196fa976eb0f0ab524af4599e5754c/pydantic-2.10.4.tar.gz", hash = "sha256:82f12e9723da6de4fe2ba888b5971157b3be7ad914267dea8f05f82b28254f06", size = 762094, upload-time = "2024-12-18T17:09:24.84Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f3/26/3e1bbe954fde7ee22a6e7d31582c642aad9e84ffe4b5fb61e63b87cd326f/pydantic-2.10.4-py3-none-any.whl", hash = "sha256:597e135ea68be3a37552fb524bc7d0d66dcf93d395acd93a00682f1efcb8ee3d", size = 431765, upload-time = "2024-12-18T17:09:21.953Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.27.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fc/01/f3e5ac5e7c25833db5eb555f7b7ab24cd6f8c322d3a3ad2d67a952dc0abc/pydantic_core-2.27.2.tar.gz", hash = "sha256:eb026e5a4c1fee05726072337ff51d1efb6f59090b7da90d30ea58625b1ffb39", size = 413443, upload-time = "2024-12-18T11:31:54.917Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/41/b1/9bc383f48f8002f99104e3acff6cba1231b29ef76cfa45d1506a5cad1f84/pydantic_core-2.27.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7d14bd329640e63852364c306f4d23eb744e0f8193148d4044dd3dacdaacbd8b", size = 1892709, upload-time = "2024-12-18T11:29:03.193Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/10/6c/e62b8657b834f3eb2961b49ec8e301eb99946245e70bf42c8817350cbefc/pydantic_core-2.27.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:82f91663004eb8ed30ff478d77c4d1179b3563df6cdb15c0817cd1cdaf34d154", size = 1811273, upload-time = "2024-12-18T11:29:05.306Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ba/15/52cfe49c8c986e081b863b102d6b859d9defc63446b642ccbbb3742bf371/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71b24c7d61131bb83df10cc7e687433609963a944ccf45190cfc21e0887b08c9", size = 1823027, upload-time = "2024-12-18T11:29:07.294Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b1/1c/b6f402cfc18ec0024120602bdbcebc7bdd5b856528c013bd4d13865ca473/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa8e459d4954f608fa26116118bb67f56b93b209c39b008277ace29937453dc9", size = 1868888, upload-time = "2024-12-18T11:29:09.249Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/7b/8cb75b66ac37bc2975a3b7de99f3c6f355fcc4d89820b61dffa8f1e81677/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce8918cbebc8da707ba805b7fd0b382816858728ae7fe19a942080c24e5b7cd1", size = 2037738, upload-time = "2024-12-18T11:29:11.23Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/f1/786d8fe78970a06f61df22cba58e365ce304bf9b9f46cc71c8c424e0c334/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eda3f5c2a021bbc5d976107bb302e0131351c2ba54343f8a496dc8783d3d3a6a", size = 2685138, upload-time = "2024-12-18T11:29:16.396Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/74/d12b2cd841d8724dc8ffb13fc5cef86566a53ed358103150209ecd5d1999/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd8086fa684c4775c27f03f062cbb9eaa6e17f064307e86b21b9e0abc9c0f02e", size = 1997025, upload-time = "2024-12-18T11:29:20.25Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a0/6e/940bcd631bc4d9a06c9539b51f070b66e8f370ed0933f392db6ff350d873/pydantic_core-2.27.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8d9b3388db186ba0c099a6d20f0604a44eabdeef1777ddd94786cdae158729e4", size = 2004633, upload-time = "2024-12-18T11:29:23.877Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/50/cc/a46b34f1708d82498c227d5d80ce615b2dd502ddcfd8376fc14a36655af1/pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7a66efda2387de898c8f38c0cf7f14fca0b51a8ef0b24bfea5849f1b3c95af27", size = 1999404, upload-time = "2024-12-18T11:29:25.872Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ca/2d/c365cfa930ed23bc58c41463bae347d1005537dc8db79e998af8ba28d35e/pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:18a101c168e4e092ab40dbc2503bdc0f62010e95d292b27827871dc85450d7ee", size = 2130130, upload-time = "2024-12-18T11:29:29.252Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f4/d7/eb64d015c350b7cdb371145b54d96c919d4db516817f31cd1c650cae3b21/pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ba5dd002f88b78a4215ed2f8ddbdf85e8513382820ba15ad5ad8955ce0ca19a1", size = 2157946, upload-time = "2024-12-18T11:29:31.338Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a4/99/bddde3ddde76c03b65dfd5a66ab436c4e58ffc42927d4ff1198ffbf96f5f/pydantic_core-2.27.2-cp313-cp313-win32.whl", hash = "sha256:1ebaf1d0481914d004a573394f4be3a7616334be70261007e47c2a6fe7e50130", size = 1834387, upload-time = "2024-12-18T11:29:33.481Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/71/47/82b5e846e01b26ac6f1893d3c5f9f3a2eb6ba79be26eef0b759b4fe72946/pydantic_core-2.27.2-cp313-cp313-win_amd64.whl", hash = "sha256:953101387ecf2f5652883208769a79e48db18c6df442568a0b5ccd8c2723abee", size = 1990453, upload-time = "2024-12-18T11:29:35.533Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/b2/b2b50d5ecf21acf870190ae5d093602d95f66c9c31f9d5de6062eb329ad1/pydantic_core-2.27.2-cp313-cp313-win_arm64.whl", hash = "sha256:ac4dbfd1691affb8f48c2c13241a2e3b60ff23247cbcf981759c768b6633cf8b", size = 1885186, upload-time = "2024-12-18T11:29:37.649Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dateutil"
|
||||
version = "2.9.0.post0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "six" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytz"
|
||||
version = "2025.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f8/bf/abbd3cdfb8fbc7fb3d4d38d320f2441b1e7cbe29be4f23797b4a2b5d8aac/pytz-2025.2.tar.gz", hash = "sha256:360b9e3dbb49a209c21ad61809c7fb453643e048b38924c765813546746e81c3", size = 320884, upload-time = "2025-03-25T02:25:00.538Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/81/c4/34e93fe5f5429d7570ec1fa436f1986fb1f00c3e0f43a589fe2bbcd22c3f/pytz-2025.2-py2.py3-none-any.whl", hash = "sha256:5ddf76296dd8c44c26eb8f4b6f35488f3ccbf6fbbd7adee0b7262d43f0ec2f00", size = 509225, upload-time = "2025-03-25T02:24:58.468Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyyaml"
|
||||
version = "6.0.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/54/ed/79a089b6be93607fa5cdaedf301d7dfb23af5f25c398d5ead2525b063e17/pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e", size = 130631, upload-time = "2024-08-06T20:33:50.674Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/e3/3af305b830494fa85d95f6d95ef7fa73f2ee1cc8ef5b495c7c3269fb835f/PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba", size = 181309, upload-time = "2024-08-06T20:32:43.4Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/45/9f/3b1c20a0b7a3200524eb0076cc027a970d320bd3a6592873c85c92a08731/PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:50187695423ffe49e2deacb8cd10510bc361faac997de9efef88badc3bb9e2d1", size = 171679, upload-time = "2024-08-06T20:32:44.801Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/9a/337322f27005c33bcb656c655fa78325b730324c78620e8328ae28b64d0c/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ffe8360bab4910ef1b9e87fb812d8bc0a308b0d0eef8c8f44e0254ab3b07133", size = 733428, upload-time = "2024-08-06T20:32:46.432Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a3/69/864fbe19e6c18ea3cc196cbe5d392175b4cf3d5d0ac1403ec3f2d237ebb5/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:17e311b6c678207928d649faa7cb0d7b4c26a0ba73d41e99c4fff6b6c3276484", size = 763361, upload-time = "2024-08-06T20:32:51.188Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/24/b7721e4845c2f162d26f50521b825fb061bc0a5afcf9a386840f23ea19fa/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b189594dbe54f75ab3a1acec5f1e3faa7e8cf2f1e08d9b561cb41b845f69d5", size = 759523, upload-time = "2024-08-06T20:32:53.019Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2b/b2/e3234f59ba06559c6ff63c4e10baea10e5e7df868092bf9ab40e5b9c56b6/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:41e4e3953a79407c794916fa277a82531dd93aad34e29c2a514c2c0c5fe971cc", size = 726660, upload-time = "2024-08-06T20:32:54.708Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/0f/25911a9f080464c59fab9027482f822b86bf0608957a5fcc6eaac85aa515/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652", size = 751597, upload-time = "2024-08-06T20:32:56.985Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/14/0d/e2c3b43bbce3cf6bd97c840b46088a3031085179e596d4929729d8d68270/PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183", size = 140527, upload-time = "2024-08-06T20:33:03.001Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fa/de/02b54f42487e3d3c6efb3f89428677074ca7bf43aae402517bc7cca949f3/PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563", size = 156446, upload-time = "2024-08-06T20:33:04.33Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.8.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/34/37/9c02181ef38d55b77d97c68b78e705fd14c0de0e5d085202bb2b52ce5be9/ruff-0.8.4.tar.gz", hash = "sha256:0d5f89f254836799af1615798caa5f80b7f935d7a670fad66c5007928e57ace8", size = 3402103, upload-time = "2024-12-19T13:36:26.286Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/05/67/f480bf2f2723b2e49af38ed2be75ccdb2798fca7d56279b585c8f553aaab/ruff-0.8.4-py3-none-linux_armv6l.whl", hash = "sha256:58072f0c06080276804c6a4e21a9045a706584a958e644353603d36ca1eb8a60", size = 10546415, upload-time = "2024-12-19T13:35:24.958Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/7a/5aba20312c73f1ce61814e520d1920edf68ca3b9c507bd84d8546a8ecaa8/ruff-0.8.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ffb60904651c00a1e0b8df594591770018a0f04587f7deeb3838344fe3adabac", size = 10346113, upload-time = "2024-12-19T13:35:29.922Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/f4/c41de22b3728486f0aa95383a44c42657b2db4062f3234ca36fc8cf52d8b/ruff-0.8.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6ddf5d654ac0d44389f6bf05cee4caeefc3132a64b58ea46738111d687352296", size = 9943564, upload-time = "2024-12-19T13:35:33.455Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0e/f0/afa0d2191af495ac82d4cbbfd7a94e3df6f62a04ca412033e073b871fc6d/ruff-0.8.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e248b1f0fa2749edd3350a2a342b67b43a2627434c059a063418e3d375cfe643", size = 10805522, upload-time = "2024-12-19T13:35:36.514Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/57/5d1e9a0fd0c228e663894e8e3a8e7063e5ee90f8e8e60cf2085f362bfa1a/ruff-0.8.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bf197b98ed86e417412ee3b6c893f44c8864f816451441483253d5ff22c0e81e", size = 10306763, upload-time = "2024-12-19T13:35:39.257Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/df/f069fdb02e408be8aac6853583572a2873f87f866fe8515de65873caf6b8/ruff-0.8.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c41319b85faa3aadd4d30cb1cffdd9ac6b89704ff79f7664b853785b48eccdf3", size = 11359574, upload-time = "2024-12-19T13:35:44.519Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d3/04/37c27494cd02e4a8315680debfc6dfabcb97e597c07cce0044db1f9dfbe2/ruff-0.8.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:9f8402b7c4f96463f135e936d9ab77b65711fcd5d72e5d67597b543bbb43cf3f", size = 12094851, upload-time = "2024-12-19T13:35:48.975Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/81/b1/c5d7fb68506cab9832d208d03ea4668da9a9887a4a392f4f328b1bf734ad/ruff-0.8.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e4e56b3baa9c23d324ead112a4fdf20db9a3f8f29eeabff1355114dd96014604", size = 11655539, upload-time = "2024-12-19T13:35:52.865Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/38/8f8f2c8898dc8a7a49bc340cf6f00226917f0f5cb489e37075bcb2ce3671/ruff-0.8.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:736272574e97157f7edbbb43b1d046125fce9e7d8d583d5d65d0c9bf2c15addf", size = 12912805, upload-time = "2024-12-19T13:35:57.234Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/06/dd/fa6660c279f4eb320788876d0cff4ea18d9af7d9ed7216d7bd66877468d0/ruff-0.8.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5fe710ab6061592521f902fca7ebcb9fabd27bc7c57c764298b1c1f15fff720", size = 11205976, upload-time = "2024-12-19T13:36:01.27Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/d7/de94cc89833b5de455750686c17c9e10f4e1ab7ccdc5521b8fe911d1477e/ruff-0.8.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:13e9ec6d6b55f6da412d59953d65d66e760d583dd3c1c72bf1f26435b5bfdbae", size = 10792039, upload-time = "2024-12-19T13:36:04.459Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/15/3e4906559248bdbb74854af684314608297a05b996062c9d72e0ef7c7097/ruff-0.8.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:97d9aefef725348ad77d6db98b726cfdb075a40b936c7984088804dfd38268a7", size = 10400088, upload-time = "2024-12-19T13:36:08.362Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/21/9ed4c0e8133cb4a87a18d470f534ad1a8a66d7bec493bcb8bda2d1a5d5be/ruff-0.8.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ab78e33325a6f5374e04c2ab924a3367d69a0da36f8c9cb6b894a62017506111", size = 10900814, upload-time = "2024-12-19T13:36:12.877Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/5d/122a65a18955bd9da2616b69bc839351f8baf23b2805b543aa2f0aed72b5/ruff-0.8.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8ef06f66f4a05c3ddbc9121a8b0cecccd92c5bf3dd43b5472ffe40b8ca10f0f8", size = 11268828, upload-time = "2024-12-19T13:36:15.718Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/43/a9/1676ee9106995381e3d34bccac5bb28df70194167337ed4854c20f27c7ba/ruff-0.8.4-py3-none-win32.whl", hash = "sha256:552fb6d861320958ca5e15f28b20a3d071aa83b93caee33a87b471f99a6c0835", size = 8805621, upload-time = "2024-12-19T13:36:18.551Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/10/98/ed6b56a30ee76771c193ff7ceeaf1d2acc98d33a1a27b8479cbdb5c17a23/ruff-0.8.4-py3-none-win_amd64.whl", hash = "sha256:f21a1143776f8656d7f364bd264a9d60f01b7f52243fbe90e7670c0dfe0cf65d", size = 9660086, upload-time = "2024-12-19T13:36:21.323Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/13/9f/026e18ca7d7766783d779dae5e9c656746c6ede36ef73c6d934aaf4a6dec/ruff-0.8.4-py3-none-win_arm64.whl", hash = "sha256:9183dd615d8df50defa8b1d9a074053891ba39025cf5ae88e8bcb52edcc4bf08", size = 9074500, upload-time = "2024-12-19T13:36:23.92Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "setuptools"
|
||||
version = "80.10.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/76/95/faf61eb8363f26aa7e1d762267a8d602a1b26d4f3a1e758e92cb3cb8b054/setuptools-80.10.2.tar.gz", hash = "sha256:8b0e9d10c784bf7d262c4e5ec5d4ec94127ce206e8738f29a437945fbc219b70", size = 1200343, upload-time = "2026-01-25T22:38:17.252Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/94/b8/f1f62a5e3c0ad2ff1d189590bfa4c46b4f3b6e49cef6f26c6ee4e575394d/setuptools-80.10.2-py3-none-any.whl", hash = "sha256:95b30ddfb717250edb492926c92b5221f7ef3fbcc2b07579bcd4a27da21d0173", size = 1064234, upload-time = "2026-01-25T22:38:15.216Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
version = "1.17.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smmap"
|
||||
version = "5.0.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/88/04/b5bf6d21dc4041000ccba7eb17dd3055feb237e7ffc2c20d3fae3af62baa/smmap-5.0.1.tar.gz", hash = "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62", size = 22291, upload-time = "2023-09-17T11:35:05.241Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a7/a5/10f97f73544edcdef54409f1d839f6049a0d79df68adbc1ceb24d1aaca42/smmap-5.0.1-py3-none-any.whl", hash = "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da", size = 24282, upload-time = "2023-09-17T11:35:03.253Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sniffio"
|
||||
version = "1.3.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372, upload-time = "2024-02-25T23:20:04.057Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlalchemy"
|
||||
version = "2.0.36"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/50/65/9cbc9c4c3287bed2499e05033e207473504dc4df999ce49385fb1f8b058a/sqlalchemy-2.0.36.tar.gz", hash = "sha256:7f2767680b6d2398aea7082e45a774b2b0767b5c8d8ffb9c8b683088ea9b29c5", size = 9574485, upload-time = "2024-10-15T19:41:44.446Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/78/5c/236398ae3678b3237726819b484f15f5c038a9549da01703a771f05a00d6/SQLAlchemy-2.0.36-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b5cc79df7f4bc3d11e4b542596c03826063092611e481fcf1c9dfee3c94355ef", size = 2087651, upload-time = "2024-10-16T00:43:59.168Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/14/55c47420c0d23fb67a35af8be4719199b81c59f3084c28d131a7767b0b0b/SQLAlchemy-2.0.36-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3c01117dd36800f2ecaa238c65365b7b16497adc1522bf84906e5710ee9ba0e8", size = 2078132, upload-time = "2024-10-16T00:44:01.279Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/97/1e843b36abff8c4a7aa2e37f9bea364f90d021754c2de94d792c2d91405b/SQLAlchemy-2.0.36-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9bc633f4ee4b4c46e7adcb3a9b5ec083bf1d9a97c1d3854b92749d935de40b9b", size = 3164559, upload-time = "2024-10-15T21:31:18.961Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7b/c5/07f18a897b997f6d6b234fab2bf31dccf66d5d16a79fe329aefc95cd7461/SQLAlchemy-2.0.36-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e46ed38affdfc95d2c958de328d037d87801cfcbea6d421000859e9789e61c2", size = 3177897, upload-time = "2024-10-15T20:16:35.048Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/cd/e16f3cbefd82b5c40b33732da634ec67a5f33b587744c7ab41699789d492/SQLAlchemy-2.0.36-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b2985c0b06e989c043f1dc09d4fe89e1616aadd35392aea2844f0458a989eacf", size = 3111289, upload-time = "2024-10-15T21:31:21.11Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/85/5b8a3b0bc29c9928aa62b5c91fcc8335f57c1de0a6343873b5f372e3672b/SQLAlchemy-2.0.36-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4a121d62ebe7d26fec9155f83f8be5189ef1405f5973ea4874a26fab9f1e262c", size = 3139491, upload-time = "2024-10-15T20:16:38.048Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a1/95/81babb6089938680dfe2cd3f88cd3fd39cccd1543b7cb603b21ad881bff1/SQLAlchemy-2.0.36-cp313-cp313-win32.whl", hash = "sha256:0572f4bd6f94752167adfd7c1bed84f4b240ee6203a95e05d1e208d488d0d436", size = 2060439, upload-time = "2024-10-15T20:16:36.182Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/ce/5f7428df55660d6879d0522adc73a3364970b5ef33ec17fa125c5dbcac1d/SQLAlchemy-2.0.36-cp313-cp313-win_amd64.whl", hash = "sha256:8c78ac40bde930c60e0f78b3cd184c580f89456dd87fc08f9e3ee3ce8765ce88", size = 2084574, upload-time = "2024-10-15T20:16:38.686Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b8/49/21633706dd6feb14cd3f7935fc00b60870ea057686035e1a99ae6d9d9d53/SQLAlchemy-2.0.36-py3-none-any.whl", hash = "sha256:fddbe92b4760c6f5d48162aef14824add991aeda8ddadb3c31d56eb15ca69f8e", size = 1883787, upload-time = "2024-10-15T20:04:30.265Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "starlette"
|
||||
version = "0.41.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/1a/4c/9b5764bd22eec91c4039ef4c55334e9187085da2d8a2df7bd570869aae18/starlette-0.41.3.tar.gz", hash = "sha256:0e4ab3d16522a255be6b28260b938eae2482f98ce5cc934cb08dce8dc3ba5835", size = 2574159, upload-time = "2024-11-18T19:45:04.283Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/96/00/2b325970b3060c7cecebab6d295afe763365822b1306a12eeab198f74323/starlette-0.41.3-py3-none-any.whl", hash = "sha256:44cedb2b7c77a9de33a8b74b2b90e9f50d11fcf25d8270ea525ad71a25374ff7", size = 73225, upload-time = "2024-11-18T19:45:02.027Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.12.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8", size = 85321, upload-time = "2024-06-07T18:52:15.995Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", size = 37438, upload-time = "2024-06-07T18:52:13.582Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tzdata"
|
||||
version = "2024.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e1/34/943888654477a574a86a98e9896bae89c7aa15078ec29f490fef2f1e5384/tzdata-2024.2.tar.gz", hash = "sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc", size = 193282, upload-time = "2024-09-23T18:56:46.89Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/ab/7e5f53c3b9d14972843a647d8d7a853969a58aecc7559cb3267302c94774/tzdata-2024.2-py2.py3-none-any.whl", hash = "sha256:a48093786cdcde33cad18c2555e8532f34422074448fbc874186f0abd79565cd", size = 346586, upload-time = "2024-09-23T18:56:45.478Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvicorn"
|
||||
version = "0.34.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
{ name = "h11" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/4b/4d/938bd85e5bf2edeec766267a5015ad969730bb91e31b44021dfe8b22df6c/uvicorn-0.34.0.tar.gz", hash = "sha256:404051050cd7e905de2c9a7e61790943440b3416f49cb409f965d9dcd0fa73e9", size = 76568, upload-time = "2024-12-15T13:33:30.42Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/61/14/33a3a1352cfa71812a3a21e8c9bfb83f60b0011f5e36f2b1399d51928209/uvicorn-0.34.0-py3-none-any.whl", hash = "sha256:023dc038422502fa28a09c7a30bf2b6991512da7dcdb8fd35fe57cfc154126f4", size = 62315, upload-time = "2024-12-15T13:33:27.467Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yarl"
|
||||
version = "1.18.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "idna" },
|
||||
{ name = "multidict" },
|
||||
{ name = "propcache" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b7/9d/4b94a8e6d2b51b599516a5cb88e5bc99b4d8d4583e468057eaa29d5f0918/yarl-1.18.3.tar.gz", hash = "sha256:ac1801c45cbf77b6c99242eeff4fffb5e4e73a800b5c4ad4fc0be5def634d2e1", size = 181062, upload-time = "2024-12-01T20:35:23.292Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/30/c7/c790513d5328a8390be8f47be5d52e141f78b66c6c48f48d241ca6bd5265/yarl-1.18.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:90adb47ad432332d4f0bc28f83a5963f426ce9a1a8809f5e584e704b82685dcb", size = 140789, upload-time = "2024-12-01T20:34:11.414Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/aa/a2f84e93554a578463e2edaaf2300faa61c8701f0898725842c704ba5444/yarl-1.18.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:913829534200eb0f789d45349e55203a091f45c37a2674678744ae52fae23efa", size = 94144, upload-time = "2024-12-01T20:34:13.485Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/fc/d68d8f83714b221a85ce7866832cba36d7c04a68fa6a960b908c2c84f325/yarl-1.18.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ef9f7768395923c3039055c14334ba4d926f3baf7b776c923c93d80195624782", size = 91974, upload-time = "2024-12-01T20:34:15.234Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/56/4e/d2563d8323a7e9a414b5b25341b3942af5902a2263d36d20fb17c40411e2/yarl-1.18.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88a19f62ff30117e706ebc9090b8ecc79aeb77d0b1f5ec10d2d27a12bc9f66d0", size = 333587, upload-time = "2024-12-01T20:34:17.358Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/c9/cfec0bc0cac8d054be223e9f2c7909d3e8442a856af9dbce7e3442a8ec8d/yarl-1.18.3-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e17c9361d46a4d5addf777c6dd5eab0715a7684c2f11b88c67ac37edfba6c482", size = 344386, upload-time = "2024-12-01T20:34:19.842Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/5d/4c532190113b25f1364d25f4c319322e86232d69175b91f27e3ebc2caf9a/yarl-1.18.3-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1a74a13a4c857a84a845505fd2d68e54826a2cd01935a96efb1e9d86c728e186", size = 345421, upload-time = "2024-12-01T20:34:21.975Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/23/d1/6cdd1632da013aa6ba18cee4d750d953104a5e7aac44e249d9410a972bf5/yarl-1.18.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41f7ce59d6ee7741af71d82020346af364949314ed3d87553763a2df1829cc58", size = 339384, upload-time = "2024-12-01T20:34:24.717Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9a/c4/6b3c39bec352e441bd30f432cda6ba51681ab19bb8abe023f0d19777aad1/yarl-1.18.3-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f52a265001d830bc425f82ca9eabda94a64a4d753b07d623a9f2863fde532b53", size = 326689, upload-time = "2024-12-01T20:34:26.886Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/23/30/07fb088f2eefdc0aa4fc1af4e3ca4eb1a3aadd1ce7d866d74c0f124e6a85/yarl-1.18.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:82123d0c954dc58db301f5021a01854a85bf1f3bb7d12ae0c01afc414a882ca2", size = 345453, upload-time = "2024-12-01T20:34:29.605Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/63/09/d54befb48f9cd8eec43797f624ec37783a0266855f4930a91e3d5c7717f8/yarl-1.18.3-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:2ec9bbba33b2d00999af4631a3397d1fd78290c48e2a3e52d8dd72db3a067ac8", size = 341872, upload-time = "2024-12-01T20:34:31.454Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/91/26/fd0ef9bf29dd906a84b59f0cd1281e65b0c3e08c6aa94b57f7d11f593518/yarl-1.18.3-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:fbd6748e8ab9b41171bb95c6142faf068f5ef1511935a0aa07025438dd9a9bc1", size = 347497, upload-time = "2024-12-01T20:34:34.004Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/b5/14ac7a256d0511b2ac168d50d4b7d744aea1c1aa20c79f620d1059aab8b2/yarl-1.18.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:877d209b6aebeb5b16c42cbb377f5f94d9e556626b1bfff66d7b0d115be88d0a", size = 359981, upload-time = "2024-12-01T20:34:36.624Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ca/b3/d493221ad5cbd18bc07e642894030437e405e1413c4236dd5db6e46bcec9/yarl-1.18.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:b464c4ab4bfcb41e3bfd3f1c26600d038376c2de3297760dfe064d2cb7ea8e10", size = 366229, upload-time = "2024-12-01T20:34:38.657Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/56/6a3e2a5d9152c56c346df9b8fb8edd2c8888b1e03f96324d457e5cf06d34/yarl-1.18.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8d39d351e7faf01483cc7ff7c0213c412e38e5a340238826be7e0e4da450fdc8", size = 360383, upload-time = "2024-12-01T20:34:40.501Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/b7/4b3c7c7913a278d445cc6284e59b2e62fa25e72758f888b7a7a39eb8423f/yarl-1.18.3-cp313-cp313-win32.whl", hash = "sha256:61ee62ead9b68b9123ec24bc866cbef297dd266175d53296e2db5e7f797f902d", size = 310152, upload-time = "2024-12-01T20:34:42.814Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/d5/688db678e987c3e0fb17867970700b92603cadf36c56e5fb08f23e822a0c/yarl-1.18.3-cp313-cp313-win_amd64.whl", hash = "sha256:578e281c393af575879990861823ef19d66e2b1d0098414855dd367e234f5b3c", size = 315723, upload-time = "2024-12-01T20:34:44.699Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/4b/a06e0ec3d155924f77835ed2d167ebd3b211a7b0853da1cf8d8414d784ef/yarl-1.18.3-py3-none-any.whl", hash = "sha256:b57f4f58099328dfb26c6a771d09fb20dbbae81d20cfb66141251ea063bd101b", size = 45109, upload-time = "2024-12-01T20:35:20.834Z" },
|
||||
]
|
||||
Reference in New Issue
Block a user