Author SHA1 Message Date
renovate-bot bf621eb59c Update dependency dataclass-wizard to v1 2026-07-05 00:01:41 +00:00
renovate-bot 090388cbf3 Update ghcr.io/astral-sh/uv Docker tag to v0.9.28 2026-02-01 00:01:23 +00:00
renovate-bot 64d5ceda03 Update ghcr.io/astral-sh/uv Docker tag to v0.9.26 2026-01-18 00:01:05 +00:00
renovate-bot 8f6ab7d01a Update ghcr.io/astral-sh/uv Docker tag to v0.9.24 2026-01-11 00:01:04 +00:00
renovate-bot c6750e5dbe Update ghcr.io/astral-sh/uv Docker tag to v0.9.21 2026-01-04 00:01:18 +00:00
imcompiling 1e4a300306 Merge pull request 'Update ghcr.io/astral-sh/uv Docker tag to v0.9.18' (#9) from renovate/ghcr.io-astral-sh-uv-0.x into main
Reviewed-on: #9
Reviewed-by: imcompiling <[email protected]>
2025-12-21 13:25:16 -05:00
renovate-bot 3ffd739124 Update ghcr.io/astral-sh/uv Docker tag to v0.9.18 2025-12-21 00:01:10 +00:00
renovate-bot 2d595e1a96 Update ghcr.io/astral-sh/uv Docker tag to v0.8.23 2025-10-05 04:01:36 +00:00
renovate-bot 6eebce3f2c Update ghcr.io/astral-sh/uv Docker tag to v0.8.22 2025-09-28 04:01:36 +00:00
renovate-bot b08185d943 Update ghcr.io/astral-sh/uv Docker tag to v0.8.19 2025-09-21 04:01:39 +00:00
renovate-bot 8ecd804c90 Update ghcr.io/astral-sh/uv Docker tag to v0.8.17 2025-09-14 04:01:36 +00:00
renovate-bot 21069fa3db Update ghcr.io/astral-sh/uv Docker tag to v0.8.15 2025-09-07 04:01:35 +00:00
renovate-bot 8a06ebd795 Update ghcr.io/astral-sh/uv Docker tag to v0.8.14 2025-08-31 04:02:16 +00:00
renovate-bot bb54fe775b Update python Docker tag to v3.13.7 2025-08-17 04:01:05 +00:00
renovate-bot 380741e8f1 Update ghcr.io/astral-sh/uv Docker tag to v0.8.11 2025-08-17 04:01:00 +00:00
renovate-bot 2ea4f83b44 Update python Docker tag to v3.13.6 2025-08-10 04:01:13 +00:00
renovate-bot 0627803734 Update ghcr.io/astral-sh/uv Docker tag to v0.8.8 2025-08-10 04:01:07 +00:00
renovate-bot 146d8e2230 Update ghcr.io/astral-sh/uv Docker tag to v0.8.4 2025-08-03 04:01:22 +00:00
renovate-bot 6593c7b63e Update ghcr.io/astral-sh/uv Docker tag to v0.8.3 2025-07-27 04:00:53 +00:00
imcompiling 1f60098039 Merge pull request 'Update ghcr.io/astral-sh/uv Docker tag to v0.8.0' (#7) from renovate/ghcr.io-astral-sh-uv-0.x into main
Reviewed-on: #7
Reviewed-by: imcompiling <[email protected]>
2025-07-21 09:15:34 -04:00
renovate-bot 0ded9fe60e Update ghcr.io/astral-sh/uv Docker tag to v0.8.0 2025-07-20 04:00:55 +00:00
renovate-bot 55f295a40b Update ghcr.io/astral-sh/uv Docker tag to v0.7.20 2025-07-13 04:00:57 +00:00
renovate-bot ad22747130 Update ghcr.io/astral-sh/uv Docker tag to v0.7.19 2025-07-06 04:00:58 +00:00
renovate-bot 7f3c1f06ad Update ghcr.io/astral-sh/uv Docker tag to v0.7.16 2025-06-29 04:00:56 +00:00
renovate-bot 98fa35db7e Update python Docker tag to v3.13.5 2025-06-15 04:01:35 +00:00
renovate-bot 24c32202a0 Update ghcr.io/astral-sh/uv Docker tag to v0.7.13 2025-06-15 04:01:30 +00:00
renovate-bot d5acfe3bc2 Update python Docker tag to v3.13.4 2025-06-08 04:01:32 +00:00
renovate-bot bb6fe8d428 Update ghcr.io/astral-sh/uv Docker tag to v0.7.12 2025-06-08 04:01:27 +00:00
renovate-bot 22e624f3ab Update ghcr.io/astral-sh/uv Docker tag to v0.7.9 2025-06-01 04:01:55 +00:00
renovate-bot ae326f0688 Update ghcr.io/astral-sh/uv Docker tag to v0.7.8 2025-05-25 04:02:04 +00:00
renovate-bot 1d77adb2d5 Update ghcr.io/astral-sh/uv Docker tag to v0.7.5 2025-05-18 04:02:07 +00:00
renovate-bot 5d6a261fa6 Update ghcr.io/astral-sh/uv Docker tag to v0.7.3 2025-05-11 04:02:09 +00:00
imcompiling d056b96fa1 Merge pull request 'Update ghcr.io/astral-sh/uv Docker tag to v0.7.2' (#6) from renovate/ghcr.io-astral-sh-uv-0.x into main
Reviewed-on: #6
Reviewed-by: imcompiling <[email protected]>
2025-05-06 14:40:58 -04:00
renovate-bot 7446f81219 Update ghcr.io/astral-sh/uv Docker tag to v0.7.2 2025-05-04 04:02:25 +00:00
renovate-bot b5060e1347 Update ghcr.io/astral-sh/uv Docker tag to v0.6.17 2025-04-27 04:01:55 +00:00
renovate-bot 32fe2f7375 Update python Docker tag to v3.13.3 2025-04-13 14:13:35 +00:00
renovate-bot fa20e99bed Update ghcr.io/astral-sh/uv Docker tag to v0.6.14 2025-04-13 14:13:30 +00:00
renovate-bot e55ead2f09 Update ghcr.io/astral-sh/uv Docker tag to v0.6.12 2025-04-06 04:02:22 +00:00
imcompiling 4d35d0238e Merge pull request 'Update docker/login-action action to v3' (#5) from renovate/docker-login-action-3.x into main
Reviewed-on: #5
Reviewed-by: imcompiling <[email protected]>
2025-03-30 12:40:15 -04:00
renovate-bot b24c0c49fe Update docker/login-action action to v3 2025-03-30 04:02:15 +00:00
renovate-bot 7897a9bd5c Update ghcr.io/astral-sh/uv Docker tag to v0.6.10 2025-03-30 04:02:11 +00:00
imcompiling 2dfc29adbf Merge pull request 'Update python Docker tag to v3.13.2' (#3) from renovate/python-3.x into main
Reviewed-on: #3
Reviewed-by: imcompiling <[email protected]>
2025-03-23 23:38:56 -04:00
imcompiling ca2e558746 Merge pull request 'Update actions/checkout action to v4' (#4) from renovate/actions-checkout-4.x into main
Reviewed-on: #4
Reviewed-by: imcompiling <[email protected]>
2025-03-23 23:37:01 -04:00
renovate-bot 229364faf6 Update actions/checkout action to v4 2025-03-23 04:02:00 +00:00
renovate-bot ad51e3471b Update python Docker tag to v3.13.2 2025-03-23 04:01:59 +00:00
renovate-bot 3b77cbdece Update ghcr.io/astral-sh/uv Docker tag to v0.6.9 2025-03-23 04:01:54 +00:00
imcompiling 6f65ae0d91 Update template to be more python-module like. 2025-03-19 08:44:51 -04:00
imcompiling 582ec6a5f0 use home directory in dockerfile. 2025-03-18 22:01:02 -04:00
imcompiling 1c34d5b87a Correct launch working directory. 2025-03-18 21:49:29 -04:00
imcompiling 3a3e986f0c Update some imports. 2025-03-18 11:20:20 -04:00
imcompiling cb4e4c5522 Add editorconfig. 2025-03-18 11:10:38 -04:00
imcompiling 341298f015 Don't need python dotenv. 2025-03-18 11:05:02 -04:00
imcompiling b64f0bd423 Try double star for repo name directory. 2025-03-18 10:52:02 -04:00
imcompiling da76f5dc0e I put repo name in wrong place. 2025-03-18 10:51:17 -04:00
imcompiling 56406de693 Move things into a repo named module. 2025-03-18 10:48:48 -04:00
imcompiling 5edd4e9a0c Add dockerignore file and update dockerfile to copy all files. 2025-03-17 21:38:19 -04:00
imcompiling b47a7f2282 rename yml files to yaml. 2025-03-17 16:49:12 -04:00
imcompiling 3986230f46 Merge branch 'main' of https://gitea.cheezers.org/imcompiling/discord-bot-template 2025-03-17 16:45:47 -04:00
imcompiling 5e43b1f804 Ignore building on readme edits. 2025-03-17 16:45:38 -04:00
imcompiling 14903a3c3c Update template file to include settings.py 2025-03-17 12:45:40 -04:00
imcompiling bae29c8485 Update doc string for main.py. 2025-03-17 12:44:52 -04:00
imcompiling 2ffc24eb86 Switch settings over to yaml and dataclasses. 2025-03-16 15:08:20 -04:00
imcompiling 9121627d12 Address smells in main.py, remove hydra usage. 2025-03-16 15:00:30 -04:00
imcompiling c6224282f6 Address some ruff smells. 2025-03-16 14:56:16 -04:00
imcompiling edbc8de473 Update template to use uv and have renovate. 2025-03-16 13:07:29 -04:00
21 changed files with 226 additions and 159 deletions
+1
View File
@@ -0,0 +1 @@
"""Empty init file for ${REPO_NAME_SNAKE} module."""
+14
View File
@@ -0,0 +1,14 @@
"""Starts the app for off_cooldown_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()
+41
View File
@@ -0,0 +1,41 @@
"""Main file for bot."""
import os
import nextcord
from nextcord.ext import commands
from .settings import settings
def run() -> None:
"""Set config, intents, then connects the bot to discord."""
# 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 guilds privileged intent:
# intents.guilds = 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(f"${REPO_NAME_SNAKE}/cogs"):
bot.load_extension(f"${REPO_NAME_SNAKE}.cogs.{folder}")
@bot.listen()
async def on_ready() -> None:
"""When Discord is connected."""
if bot.user is None:
print("Discord connection failed.")
return
print(f"{bot.user.name} has connected to Discord!")
# Run Discord bot
bot.run(settings.params.discord_token)
@@ -1,16 +1,12 @@
""" """Cog loader. Adds all command cogs to the bot."""
Cog loader. Adds all command cogs to the bot.
"""
from nextcord.ext import commands from nextcord.ext import commands
from cogs.commands.hi import HiCog from .hi import HiCog
# This function will be called when this extension is loaded. # This function will be called when this extension is loaded.
# It is necessary to add these functions to the bot. # It is necessary to add these functions to the bot.
def setup(bot: commands.Bot): def setup(bot: commands.Bot) -> None:
""" """Add all command classes to bot."""
Adds all command classes to bot.
"""
bot.add_cog(HiCog(bot)) bot.add_cog(HiCog(bot))
@@ -1,29 +1,22 @@
""" """Example command file."""
Example command file.
"""
import nextcord import nextcord
from nextcord.ext import commands from nextcord.ext import commands
class HiCog(commands.Cog, name="Test commands."): class HiCog(commands.Cog, name="Test commands."):
""" """Class holds commands for testing."""
Class holds commands for testing.
"""
def __init__(self, bot) -> None: def __init__(self, bot: commands.Bot) -> None:
"""
Default constructor for HelpCog class. Does nothing.
"""
self.bot = bot self.bot = bot
@nextcord.slash_command() @nextcord.slash_command()
async def hi(self, interaction: nextcord.Interaction): async def hi(self, interaction: nextcord.Interaction) -> None:
""" """
Says hi Says hi.
Args: Args:
interaction (nextcord.Interaction): Interaction to reply to. interaction (nextcord.Interaction): Interaction to reply to.
"""
"""
await interaction.response.send_message("Hi!", ephemeral=True) await interaction.response.send_message("Hi!", ephemeral=True)
+28
View File
@@ -0,0 +1,28 @@
"""File contains classes defining ${REPO_NAME} settings structure."""
from dataclasses import dataclass
from dataclass_wizard import YAMLWizard
CONFIG_LOCATION = "conf/config.yaml"
@dataclass
class Params:
"""Class defines start parameters that shouldn't be changed."""
discord_token: str
@dataclass
class Settings(YAMLWizard):
"""Class defines all configs required for ${REPO_NAME}."""
params: Params
def save(self) -> None:
"""Save settings to the yaml file."""
self.to_yaml_file(CONFIG_LOCATION)
settings = Settings.from_yaml_file(CONFIG_LOCATION)
+2
View File
@@ -0,0 +1,2 @@
.*
Dockerfile
+16
View File
@@ -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
+3 -1
View File
@@ -1,3 +1,5 @@
$REPO_NAME_SNAKE/**
.gitea/workflows/*.yml .gitea/workflows/*.yml
main.py .vscode/launch.json
pyproject.toml pyproject.toml
Dockerfile
@@ -1,19 +1,25 @@
name: build_develop name: build_develop
on: [push] on:
push:
branches:
- "*"
- "!main"
paths-ignore:
- "README.md"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Docker - name: Install Docker
uses: https://github.com/papodaca/install-docker-action@v1 uses: https://github.com/papodaca/install-docker-action@v1
- name: Log into container registry - name: Log into container registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: gitea.cheezers.org registry: gitea.cheezers.org
username: ${REPO_OWNER} username: ${REPO_OWNER}
@@ -3,19 +3,21 @@ name: build_latest
on: on:
push: push:
branches: [main] branches: [main]
paths-ignore:
- "README.md"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Docker - name: Install Docker
uses: https://github.com/papodaca/install-docker-action@v1 uses: https://github.com/papodaca/install-docker-action@v1
- name: Log into container registry - name: Log into container registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: gitea.cheezers.org registry: gitea.cheezers.org
username: ${REPO_OWNER} username: ${REPO_OWNER}
@@ -9,13 +9,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Docker - name: Install Docker
uses: https://github.com/papodaca/install-docker-action@v1 uses: https://github.com/papodaca/install-docker-action@v1
- name: Log into container registry - name: Log into container registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: gitea.cheezers.org registry: gitea.cheezers.org
username: ${REPO_OWNER} username: ${REPO_OWNER}
+2 -1
View File
@@ -3,6 +3,7 @@
"ms-python.vscode-pylance", "ms-python.vscode-pylance",
"ms-python.python", "ms-python.python",
"ms-python.debugpy", "ms-python.debugpy",
"charliermarsh.ruff" "charliermarsh.ruff",
"editorconfig.editorconfig"
] ]
} }
+1 -1
View File
@@ -8,7 +8,7 @@
"name": "Python: Module", "name": "Python: Module",
"type": "debugpy", "type": "debugpy",
"request": "launch", "request": "launch",
"module": "main", "module": "${REPO_NAME_SNAKE}",
"justMyCode": true "justMyCode": true
} }
] ]
+7
View File
@@ -0,0 +1,7 @@
{
"python.analysis.diagnosticSeverityOverrides": {
"reportOptionalMemberAccess": "warning",
"reportArgumentType": "information",
"reportAttributeAccessIssue": "warning"
}
}
+9 -10
View File
@@ -1,13 +1,12 @@
FROM python:3.11.9-slim FROM python:3.13.7-slim
# install uv
COPY --from=ghcr.io/astral-sh/uv:0.9.28 /uv /uvx /bin/
COPY . /home
# Sync the project into a new environment, using the frozen lockfile
WORKDIR /home WORKDIR /home
RUN uv sync --frozen --no-dev
COPY config.py config.py CMD ["uv", "run", "--frozen", "--no-dev", "-m", "${REPO_NAME_SNAKE}"]
COPY main.py main.py
COPY pyproject.toml pyproject.toml
COPY cogs cogs/
RUN pip install --upgrade pip && pip install poetry && poetry export -f requirements.txt --output requirements.txt && pip install -r requirements.txt
CMD ["python3", "-u", "./main.py"]
-22
View File
@@ -1,22 +0,0 @@
"""
File contains classes defining the Hydra configuraton structure.
"""
from dataclasses import dataclass
@dataclass
class Params:
"""
Class defines the various configuration parameters.
"""
discord_token: str
@dataclass
class BotConfig:
"""
Class defines all configs required for Dakiny Bot.
"""
params: Params
-65
View File
@@ -1,65 +0,0 @@
import logging
import os
import sys
import hydra
import nextcord
from hydra.core.config_store import ConfigStore
from nextcord.ext import commands
from config import BotConfig
cs = ConfigStore.instance()
cs.store(name="${REPO_NAME}_config", node=BotConfig)
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: BotConfig):
"""
Main function for the bot. Sets config, intents, then connects the bot to discord.
Args:
cfg (BotConfig): The local configs to use.
"""
# 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
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
+32 -13
View File
@@ -1,21 +1,20 @@
[tool.poetry] [project]
name = "${REPO_NAME}" name = "${REPO_NAME}"
version = "0.1.0" version = "0.1.0"
description = "" description = ""
authors = ["${REPO_OWNER}"] authors = [{name="${REPO_OWNER}", email=""}]
readme = "README.md" readme = "README.md"
dependencies = [
"nextcord>=2.6.0",
"sqlmodel>=0.0.22",
"dataclass-wizard[yaml]>=1.0.0,<1.1.0",
]
requires-python = ">=3.12"
[tool.poetry.dependencies] [tool.uv]
python = "^3.11" dev-dependencies = ["ruff>=0.7.2"]
hydra-core = "1.3.2"
nextcord = "2.6.1"
python-dotenv = "1.0.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff] [tool.ruff]
# Exclude a variety of commonly ignored directories. # Exclude a variety of commonly ignored directories.
exclude = [ exclude = [
@@ -58,8 +57,28 @@ target-version = "py38"
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default. # McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F", "D100", "D1"] select = ["ALL"]
ignore = ["D107"] 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. # Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"] fixable = ["ALL"]
+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"
}
}
}
-2
View File
@@ -1,2 +0,0 @@
nextcord==2.4.2
hydra-core==1.3.2