Compare commits

..
Author SHA1 Message Date
renovate-bot be7bffb866 Update dependency pandas to v3 2026-09-20 00:02:01 +00:00
renovate-bot aaef1f249f Update ghcr.io/astral-sh/uv Docker tag to v0.9.28
build_latest / build (push) Successful in 47s
2026-02-01 00:01:18 +00:00
renovate-bot 4936013697 Update dependency setuptools to <80.10.3,>=80.10.2
build_latest / build (push) Has been cancelled
2026-02-01 00:01:11 +00:00
renovate-bot 945f5766d5 Update dependency setuptools to <80.10.2,>=80.10.1
build_latest / build (push) Successful in 1m25s
2026-01-25 00:01:57 +00:00
renovate-bot 8727c0d6f6 Update ghcr.io/astral-sh/uv Docker tag to v0.9.26
build_latest / build (push) Successful in 48s
2026-01-18 00:00:53 +00:00
renovate-bot 64e2c10b39 Update ghcr.io/astral-sh/uv Docker tag to v0.9.24
build_latest / build (push) Successful in 42s
2026-01-11 00:00:50 +00:00
renovate-bot 3d44c5c905 Update ghcr.io/astral-sh/uv Docker tag to v0.9.21
build_latest / build (push) Successful in 1m4s
2026-01-04 00:01:02 +00:00
renovate-bot 6653bb9bdd Update ghcr.io/astral-sh/uv Docker tag to v0.9.18
build_latest / build (push) Successful in 43s
2025-12-21 00:00:56 +00:00
renovate-bot f5b45b8cab Update ghcr.io/astral-sh/uv Docker tag to v0.9.17
build_latest / build (push) Successful in 45s
2025-12-14 00:00:58 +00:00
renovate-bot 412a81db6e Update ghcr.io/astral-sh/uv Docker tag to v0.9.16
build_latest / build (push) Successful in 49s
2025-12-07 00:00:58 +00:00
renovate-bot 8069176128 Update ghcr.io/astral-sh/uv Docker tag to v0.9.13
build_latest / build (push) Successful in 46s
2025-11-30 00:00:56 +00:00
renovate-bot 5b5e699f7a Update ghcr.io/astral-sh/uv Docker tag to v0.9.11
build_latest / build (push) Successful in 36s
2025-11-23 00:00:46 +00:00
renovate-bot 3b0535663a Update ghcr.io/astral-sh/uv Docker tag to v0.9.9
build_latest / build (push) Successful in 40s
2025-11-16 00:00:45 +00:00
renovate-bot 6fd61c79cc Update ghcr.io/astral-sh/uv Docker tag to v0.9.8
build_latest / build (push) Successful in 40s
2025-11-09 00:00:46 +00:00
imcompiling c2c2b132e1 Merge pull request 'Update ghcr.io/astral-sh/uv Docker tag to v0.9.5' (#107) from renovate/ghcr.io-astral-sh-uv-0.x into main
build_latest / build (push) Successful in 42s
Reviewed-on: #107
2025-11-01 17:01:06 -04:00
renovate-bot 66f3d797fd Update ghcr.io/astral-sh/uv Docker tag to v0.9.5 2025-10-26 00:00:38 +00:00
renovate-bot ccc489dbaf Update ghcr.io/astral-sh/uv Docker tag to v0.8.23
build_latest / build (push) Successful in 55s
2025-10-05 04:01:27 +00:00
renovate-bot d0961bb9f0 Update ghcr.io/astral-sh/uv Docker tag to v0.8.22
build_latest / build (push) Successful in 36s
2025-09-28 04:01:28 +00:00
renovate-bot 83b11206da Update ghcr.io/astral-sh/uv Docker tag to v0.8.19
build_latest / build (push) Successful in 41s
2025-09-21 04:01:29 +00:00
renovate-bot 6f28f09b66 Update ghcr.io/astral-sh/uv Docker tag to v0.8.17
build_latest / build (push) Successful in 1m1s
2025-09-14 04:01:27 +00:00
renovate-bot e1508e6f31 Update ghcr.io/astral-sh/uv Docker tag to v0.8.15
build_latest / build (push) Successful in 42s
2025-09-07 04:01:27 +00:00
renovate-bot be88f1e179 Update ghcr.io/astral-sh/uv Docker tag to v0.8.14
build_latest / build (push) Successful in 1m28s
2025-08-31 04:02:06 +00:00
renovate-bot ae64ab6dde Update python Docker tag to v3.13.7
build_latest / build (push) Successful in 59s
2025-08-17 04:00:55 +00:00
renovate-bot a76df955ec Update ghcr.io/astral-sh/uv Docker tag to v0.8.11
build_latest / build (push) Waiting to run
2025-08-17 04:00:49 +00:00
renovate-bot 2473d258ff Update python Docker tag to v3.13.6
build_latest / build (push) Successful in 58s
2025-08-10 04:01:01 +00:00
renovate-bot 9c94704fbd Update ghcr.io/astral-sh/uv Docker tag to v0.8.8
build_latest / build (push) Waiting to run
2025-08-10 04:00:54 +00:00
renovate-bot 0c62678797 Update ghcr.io/astral-sh/uv Docker tag to v0.8.4
build_latest / build (push) Successful in 40s
2025-08-03 04:01:12 +00:00
renovate-bot 0528eea5cd Update ghcr.io/astral-sh/uv Docker tag to v0.8.3
build_latest / build (push) Successful in 40s
2025-07-27 04:00:44 +00:00
imcompiling 2836237b76 Merge pull request 'Update ghcr.io/astral-sh/uv Docker tag to v0.8.0' (#104) from renovate/ghcr.io-astral-sh-uv-0.x into main
build_latest / build (push) Successful in 37s
Reviewed-on: #104
Reviewed-by: imcompiling <[email protected]>
2025-07-21 09:15:20 -04:00
renovate-bot 4c741136cc Update ghcr.io/astral-sh/uv Docker tag to v0.8.0 2025-07-20 04:00:49 +00:00
imcompiling b221f1e438 Feat: Update the ban message.
build_develop / build (push) Successful in 37s
build_latest / build (push) Successful in 21s
build_release / build (push) Successful in 22s
For some reason, the user's name was None. I'm guessing because they were
banned and are no longer a member or something. Don't need to record the member's
name anyway though, as its already a part of the audit log.
2025-07-16 21:24:03 -04:00
imcompiling 1b08ba1355 Feat: Set delete messages to 30 minutes.
build_develop / build (push) Successful in 32s
2025-07-16 16:03:26 -04:00
imcompiling e191df1a38 Fix: spelling and ignore pylance warning.
build_develop / build (push) Successful in 32s
2025-07-16 15:57:31 -04:00
imcompiling e35a2a8c8d Feat: Add autoban
build_develop / build (push) Successful in 38s
2025-07-16 15:55:09 -04:00
imcompiling d7046e4595 Add: config for ban channel id. 2025-07-16 15:45:35 -04:00
imcompiling 70037fb47a Update renovate.json
build_latest / build (push) Successful in 19s
Don't automerge major versions, don't automerge docker minor versions.
2025-07-15 09:05:24 -04:00
renovate-bot 4ae3866e44 Update ghcr.io/astral-sh/uv Docker tag to v0.7.20
build_latest / build (push) Successful in 40s
2025-07-13 04:00:48 +00:00
renovate-bot 1349813f0d Update ghcr.io/astral-sh/uv Docker tag to v0.7.19
build_latest / build (push) Successful in 1m0s
2025-07-06 04:00:49 +00:00
renovate-bot 294b672fe2 Update ghcr.io/astral-sh/uv Docker tag to v0.7.16
build_latest / build (push) Successful in 45s
2025-06-29 04:00:48 +00:00
renovate-bot 72349a4cae Update python Docker tag to v3.13.5
build_latest / build (push) Successful in 1m4s
2025-06-15 04:01:25 +00:00
renovate-bot f6e9d3c32e Update ghcr.io/astral-sh/uv Docker tag to v0.7.13
build_latest / build (push) Waiting to run
2025-06-15 04:01:19 +00:00
renovate-bot 7c8455bf29 Update python Docker tag to v3.13.4
build_latest / build (push) Successful in 51s
2025-06-08 04:01:23 +00:00
renovate-bot f4c4a0435b Update ghcr.io/astral-sh/uv Docker tag to v0.7.12
build_latest / build (push) Waiting to run
2025-06-08 04:01:18 +00:00
renovate-bot bbc63dd77a Update dependency setuptools to <80.9.1,>=80.9.0
build_latest / build (push) Successful in 39s
2025-06-01 04:01:50 +00:00
renovate-bot 7ed3f0d613 Update ghcr.io/astral-sh/uv Docker tag to v0.7.9
build_latest / build (push) Waiting to run
2025-06-01 04:01:17 +00:00
imcompiling eb6a8c7479 Feat: Add logging to tell when refresh happens.
build_latest / build (push) Successful in 44s
build_release / build (push) Successful in 22s
2025-05-27 23:33:19 -04:00
imcompiling 58b230afe6 Fix: Catch git error and refresh connection.
build_latest / build (push) Successful in 39s
build_release / build (push) Successful in 23s
I think that the git error is just happening from timing out. Trying to fix by
refreshing the connection when it happens.
2025-05-27 23:31:02 -04:00
imcompiling fb8dfef55e Fix: daily test runs daily loop.
build_develop / build (push) Successful in 42s
build_latest / build (push) Successful in 19s
build_release / build (push) Successful in 20s
2025-05-27 23:13:39 -04:00
imcompiling 487d174b6d Fix: Remove name clobber. Add a try except.
build_develop / build (push) Successful in 40s
Also add environment variable to launch settings.
2025-05-26 21:15:15 -04:00
imcompiling abb50d71b4 Feat: Update logging.
build_develop / build (push) Successful in 36s
Narrowing down where the issue is. Active cycle is being obtained, but
nothing was happening with it. No more debug messages either.
2025-05-26 20:40:12 -04:00
imcompiling 7409e2fd2d Feat: Add filename, lineno, and function name to logging. 2025-05-26 20:34:45 -04:00
imcompiling 6a67804937 Fix: Import logger correctly.
build_develop / build (push) Successful in 42s
2025-05-25 22:31:50 -04:00
imcompiling 4f4d76d151 Feat: Add some logging.
build_develop / build (push) Successful in 43s
Trying to figure out why the elections are not starting.
2025-05-25 22:24:26 -04:00
imcompiling f3985b5d21 Feat: Set debug if env var is true. 2025-05-25 22:15:12 -04:00
imcompiling 142cc337a0 Feat: Add dakiny_bot logger. 2025-05-25 22:11:37 -04:00
imcompiling fd1d1c075e Feat: Remove logger from app.py. It existed it main.j 2025-05-25 22:11:18 -04:00
imcompiling e3ffafcff2 Update to python 3.13
build_latest / build (push) Successful in 40s
build_develop / build (push) Successful in 28s
2025-05-25 16:23:41 -04:00
imcompiling 855f3c1df8 Merge pull request 'Update dependency setuptools to v80' (#96) from renovate/setuptools-80.x into main
build_latest / build (push) Successful in 42s
Reviewed-on: #96
Reviewed-by: imcompiling <[email protected]>
2025-05-25 15:42:28 -04:00
renovate-bot a3371e9e8c Update dependency setuptools to v80 2025-05-25 04:01:54 +00:00
renovate-bot a158248a35 Update ghcr.io/astral-sh/uv Docker tag to v0.7.8
build_latest / build (push) Successful in 56s
2025-05-25 04:01:18 +00:00
renovate-bot 886ac2f7ee Update ghcr.io/astral-sh/uv Docker tag to v0.7.5
build_latest / build (push) Successful in 47s
2025-05-18 04:01:21 +00:00
renovate-bot f06033d2ec Update ghcr.io/astral-sh/uv Docker tag to v0.7.3
build_latest / build (push) Successful in 52s
2025-05-11 04:01:29 +00:00
renovate-bot 2ffc4126d2 Update ghcr.io/astral-sh/uv Docker tag to v0.7.2
build_latest / build (push) Successful in 52s
2025-05-04 04:01:47 +00:00
renovate-bot 4280ddd841 Update ghcr.io/astral-sh/uv Docker tag to v0.6.17
build_latest / build (push) Successful in 39s
2025-04-27 04:01:16 +00:00
imcompiling 58c167bbe3 Revert "Remove setuptools as a dependency."
build_latest / build (push) Successful in 31s
This reverts commit c5e4a94cd2.
2025-04-23 14:52:51 -04:00
renovate-bot 303e359c32 Update python Docker tag to v3.13.3 2025-04-13 14:13:26 +00:00
renovate-bot fb460ccc2c Update ghcr.io/astral-sh/uv Docker tag to v0.6.14 2025-04-13 14:13:21 +00:00
imcompiling c5e4a94cd2 Remove setuptools as a dependency.
build_latest / build (push) Successful in 37s
2025-04-06 12:07:20 -04:00
imcompiling f95955dc7f Merge pull request 'Update docker/login-action action to v3' (#92) from renovate/docker-login-action-3.x into main
build_latest / build (push) Successful in 24s
Reviewed-on: #92
Reviewed-by: imcompiling <[email protected]>
2025-04-06 11:59:05 -04:00
renovate-bot dfea936aaa Update docker/login-action action to v3 2025-04-06 04:02:18 +00:00
renovate-bot 1df639499c Update ghcr.io/astral-sh/uv Docker tag to v0.6.12
build_latest / build (push) Successful in 38s
2025-04-06 04:01:44 +00:00
renovate-bot be3ec007af Update dependency pytz to <2025.3,>=2025.2
build_latest / build (push) Successful in 33s
2025-03-30 04:02:06 +00:00
renovate-bot e8839d2930 Update ghcr.io/astral-sh/uv Docker tag to v0.6.10
build_latest / build (push) Waiting to run
2025-03-30 04:01:39 +00:00
imcompiling 29eb21b286 Merge pull request 'Update dependency pytz to v2025' (#89) from renovate/pytz-2025.x into main
build_latest / build (push) Successful in 29s
Reviewed-on: #89
Reviewed-by: imcompiling <[email protected]>
2025-03-23 23:39:51 -04:00
renovate-bot b7439631d9 Update dependency pytz to v2025 2025-03-23 04:01:44 +00:00
renovate-bot 6b9d8f6ad9 Update ghcr.io/astral-sh/uv Docker tag to v0.6.9
build_latest / build (push) Successful in 38s
2025-03-23 04:01:14 +00:00
imcompiling c48fba9c85 Update the create database script to account for directory structure change.
build_latest / build (push) Successful in 36s
2025-03-21 10:03:11 -04:00
imcompiling 7e3b57f4b6 Update pyproject to point to home directory, add an init and remove pyproject that ignores the warning that the init file fixes. 2025-03-21 10:02:30 -04:00
imcompiling 889ba2fd6b Correct cog listing.
build_latest / build (push) Successful in 32s
2025-03-19 17:47:58 -04:00
imcompiling 8b5c954aa5 Remove poetry lock.
build_latest / build (push) Successful in 34s
2025-03-19 11:20:00 -04:00
imcompiling adc44d4466 Merge branch '82-uv'
build_latest / build (push) Has been cancelled
2025-03-19 11:17:52 -04:00
imcompiling 969f380b08 Add ignore workflow runs on readme changes.
build_latest / build (push) Successful in 23s
2025-03-17 16:46:27 -04:00
imcompiling 10d7014c41 Merge branch 'main' of https://gitea.cheezers.org/imcompiling/dakiny-bot 2025-03-17 16:46:16 -04:00
renovate-bot 89e77a6671 Update dependency ruff to ^0.11.0
build_latest / build (push) Successful in 1m14s
2025-03-16 04:02:09 +00:00
renovate-bot c2ff656114 Update dependency sqlalchemy to v2.0.39
build_latest / build (push) Waiting to run
2025-03-16 04:02:02 +00:00
renovate-bot 81e2957fa5 Update dependency ruff to v0.9.10
build_latest / build (push) Successful in 19s
2025-03-09 05:01:41 +00:00
renovate-bot ba24a268ec Update dependency ruff to v0.9.9
build_latest / build (push) Successful in 20s
2025-03-02 05:02:12 +00:00
renovate-bot 70d262d947 Update dependency fastapi to v0.115.11
build_latest / build (push) Waiting to run
2025-03-02 05:02:04 +00:00
imcompiling 6199350cca Merge pull request 'Update actions/checkout action to v4' (#85) from renovate/actions-checkout-4.x into main
build_latest / build (push) Successful in 1m32s
Reviewed-on: #85
Reviewed-by: imcompiling <[email protected]>
2025-02-25 09:27:43 -05:00
renovate-bot c5e2b39648 Update actions/checkout action to v4 2025-02-23 05:01:30 +00:00
renovate-bot 5db2b43d6a Update python Docker tag to v3.13.2
build_latest / build (push) Successful in 1m33s
2025-02-23 05:01:24 +00:00
renovate-bot b9be9e5470 Update dependency ruff to ^0.9.0
build_latest / build (push) Successful in 1m13s
2025-02-22 13:06:23 +00:00
renovate-bot 6700199a36 Update dependency fastapi to ^0.115.0
build_latest / build (push) Waiting to run
2025-02-22 13:06:16 +00:00
renovate-bot 8f9821e9c9 Update dependency dataclass-wizard to ^0.35.0
build_latest / build (push) Successful in 1m20s
2025-02-16 05:01:51 +00:00
renovate-bot 83af20e04c Update dependency sqlalchemy to v2.0.38
build_latest / build (push) Waiting to run
2025-02-16 05:01:43 +00:00
imcompiling f1dd3cbd3b Rename yml files to yaml. 2025-02-04 22:53:54 -05:00
imcompiling d56251c0b9 Do not ping a user on their cakeday.
build_release / build (push) Successful in 17s
build_latest / build (push) Successful in 1m45s
2025-02-04 22:49:53 -05:00
imcompiling 667a600ec6 Add poetry lock file. 2025-02-04 22:46:51 -05:00
imcompiling 03a94ca6dd Turn on lockFileMaintenance for renovatebot. 2025-02-04 22:45:14 -05:00
imcompiling 9da598e4d9 Add renovatebot json config.
build_latest / build (push) Successful in 2m3s
2025-02-04 17:35:11 -05:00
imcompiling 3a280696ca Need to install specific poetry version, export gets removed in v2.
build_latest / build (push) Successful in 1m41s
build_release / build (push) Successful in 19s
2025-01-19 18:35:38 -05:00
imcompiling 8825afdb46 Missed removing a parameter from buiild_votes_str().
build_latest / build (push) Failing after 29s
build_release / build (push) Failing after 29s
2025-01-19 18:19:51 -05:00
24 changed files with 520 additions and 450 deletions
@@ -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
-1
View File
@@ -105,7 +105,6 @@ venv/
ENV/
env.bak/
venv.bak/
poetry.lock
# Spyder project settings
.spyderproject
+4 -1
View File
@@ -9,7 +9,10 @@
"type": "debugpy",
"request": "launch",
"module": "dakiny_bot",
"justMyCode": true
"justMyCode": true,
"env": {
"DEBUG": "true"
}
}
]
}
+2
View File
@@ -3,6 +3,8 @@
"aiofiles",
"autofilled",
"blurple",
"CAKEDAY",
"cakedays",
"CLANLEADER",
"Dakiny",
"DISCORDMANAGER",
+2 -2
View File
@@ -1,10 +1,10 @@
FROM python:3.12.3-slim
FROM python:3.13.7-slim
# install dependencies
RUN apt-get update && apt-get -y upgrade && apt-get -y install git sqlite3
# install uv
COPY --from=ghcr.io/astral-sh/uv:0.6.5 /uv /uvx /bin/
COPY --from=ghcr.io/astral-sh/uv:0.9.28 /uv /uvx /bin/
COPY . /home
+1
View File
@@ -17,6 +17,7 @@ class ChannelIds:
event_post: int
general: int
voting: int
ban: int
@dataclass
+2 -9
View File
@@ -1,6 +1,5 @@
"""Main file for bot."""
import logging
import os
import nextcord
@@ -16,12 +15,6 @@ from .DakinySettings import settings
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)
def run() -> None:
"""Builds and runs bot."""
@@ -38,8 +31,8 @@ def run() -> None:
bot = commands.Bot(intents=intents)
# 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}")
for folder in os.listdir("dakiny_bot/cogs"):
bot.load_extension(f"dakiny_bot.cogs.{folder}")
@bot.listen()
async def on_ready() -> None:
+13 -4
View File
@@ -5,9 +5,6 @@ from datetime import UTC, datetime, timedelta
from pathlib import Path
import nextcord
from sqlalchemy import select, true, update
from sqlalchemy.orm import Session
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
@@ -19,6 +16,7 @@ from dakiny_bot.database.sql_data_classes import (
Votes,
engine,
)
from dakiny_bot.logger import dakiny_logger
from dakiny_bot.utils import (
TEMPLATES_DIR,
VoteType,
@@ -28,6 +26,8 @@ from dakiny_bot.utils import (
get_datetime,
get_election_name,
)
from sqlalchemy import select, true, update
from sqlalchemy.orm import Session
REQUIRED_VOTES_TO_BE_ELECTED = 3
@@ -144,20 +144,29 @@ class Election:
async def check_date(self) -> None:
"""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():
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."""
@@ -201,7 +210,7 @@ class Election:
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(settings, self.guild),
build_votes_str(self.guild),
view=VoteView(self.guild),
)
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.ruff]
# Extend the `pyproject.toml` file in the parent directory...
extend = "../pyproject.toml"
extend = "../../pyproject.toml"
# Exclude a variety of commonly ignored directories.
exclude = ["gitea_webhook.py"]
+1 -1
View File
@@ -67,7 +67,7 @@ class VoteSelect(nextcord.ui.StringSelect):
session.execute(stmt)
session.commit()
vote_message_str = build_votes_str(settings, interaction.guild)
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)
+8 -1
View File
@@ -6,10 +6,12 @@ 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:
@@ -55,7 +57,12 @@ class ClanMessages(commands.Cog, name="Clan Messages"):
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}
self.origin.pull()
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)
+3 -5
View File
@@ -4,6 +4,7 @@ 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
@@ -119,11 +120,8 @@ class TestCog(commands.Cog, name="Test commands."):
Args:
interaction (nextcord.Interaction): Interaction with the message.
"""
cycle = Election(
get_active_election_cycle(),
self.bot.get_guild(settings.params.guild_id),
)
await cycle.check_date()
dl = daily_loop.DailyLoop(self.bot)
await dl.daily_loop()
await interaction.send("Test command sent.", ephemeral=True)
@test.subcommand()
+14 -1
View File
@@ -13,6 +13,7 @@ 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:
@@ -20,6 +21,8 @@ if TYPE_CHECKING:
KANDY = 239547993106284544
IGNORE_CAKEDAY = [266378407682506754]
class DailyLoop(commands.Cog, name="Daily Loop"):
"""Class for performing daily functions."""
@@ -41,8 +44,10 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
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()
@@ -76,13 +81,17 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
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:
@@ -112,7 +121,11 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
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
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:
+11 -2
View File
@@ -4,6 +4,7 @@ import nextcord
from nextcord.ext import commands
from dakiny_bot.app import birthday_list
from dakiny_bot.DakinySettings import settings
class SubmissionListener(commands.Cog, name="Message Listener"):
@@ -16,7 +17,15 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
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)
@@ -31,7 +40,7 @@ def setup(bot: commands.Bot) -> None:
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.
+1
View File
@@ -0,0 +1 @@
"""Module controls connection to Dakiny bot database."""
+1 -1
View File
@@ -7,7 +7,7 @@ if not Path("database/dakiny.db").exists():
with sqlite3.connect("database/dakiny.db") as con:
cur = con.cursor()
with Path("database_setup/database.sql", encoding="utf-8").open() as file:
with Path("dakiny_bot/database/database.sql").open() as file:
database_script = file.read()
cur.executescript(database_script)
con.commit()
-7
View File
@@ -1,7 +0,0 @@
[tool.ruff]
# Extend the `pyproject.toml` file in the parent directory...
extend = "../pyproject.toml"
[tool.ruff.lint]
# ignore implicit-namespace-package in this directory.
ignore = ["INP001"]
+13
View File
@@ -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)
+14 -6
View File
@@ -20,6 +20,7 @@ from dakiny_bot.database.sql_data_classes import (
Votes,
engine,
)
from dakiny_bot.logger import dakiny_logger
from .DakinySettings import settings
@@ -34,20 +35,20 @@ VoteType = StrEnum("VoteType", ["COUNCIL", "DISCORDMANAGER", "CLANLEADER"])
PointType = StrEnum("PointType", ["CLAN", "EVENT"])
def get_datetime(day: str) -> datetime:
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:
day (str): Month/Day in that format.
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(day.split("/")[0])
day = int(day.split("/")[1])
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:
@@ -55,8 +56,10 @@ def get_datetime(day: str) -> datetime:
if today.month == calendar.JANUARY and month > calendar.MARCH:
year -= 1
return datetime(year, month, day, tzinfo=UTC)
try:
return datetime(year, month, day, tzinfo=UTC)
except ValueError:
dakiny_logger.warning("Invalid month day: %s.", month_day)
def get_election_name() -> str:
@@ -92,12 +95,14 @@ def get_active_election_cycle() -> int:
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
@@ -114,13 +119,16 @@ def get_quarter_cycle() -> int:
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
+5 -4
View File
@@ -1,17 +1,18 @@
[project]
authors = [{ name = "imcompiling", email = "[email protected]" }]
requires-python = "<4.0,>=3.12"
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.0,>=2024.1",
"pandas<3.1.0,>=3.0.6",
"pytz<2025.3,>=2025.2",
"sqlalchemy<3.0.0,>=2.0.30",
"aiofiles<24.0.0,>=23.2.1",
"setuptools<71.0.0,>=70.0.0",
"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"
+29
View File
@@ -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"
}
}
}
Generated
+385 -398
View File
File diff suppressed because it is too large Load Diff