Template
Compare commits
57
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7111facea | ||
|
|
090388cbf3 | ||
|
|
64d5ceda03 | ||
|
|
8f6ab7d01a | ||
|
|
c6750e5dbe | ||
|
|
1e4a300306 | ||
|
|
3ffd739124 | ||
|
|
2d595e1a96 | ||
|
|
6eebce3f2c | ||
|
|
b08185d943 | ||
|
|
8ecd804c90 | ||
|
|
21069fa3db | ||
|
|
8a06ebd795 | ||
|
|
bb54fe775b | ||
|
|
380741e8f1 | ||
|
|
2ea4f83b44 | ||
|
|
0627803734 | ||
|
|
146d8e2230 | ||
|
|
6593c7b63e | ||
|
|
1f60098039 | ||
|
|
0ded9fe60e | ||
|
|
55f295a40b | ||
|
|
ad22747130 | ||
|
|
7f3c1f06ad | ||
|
|
98fa35db7e | ||
|
|
24c32202a0 | ||
|
|
d5acfe3bc2 | ||
|
|
bb6fe8d428 | ||
|
|
22e624f3ab | ||
|
|
ae326f0688 | ||
|
|
1d77adb2d5 | ||
|
|
5d6a261fa6 | ||
|
|
d056b96fa1 | ||
|
|
7446f81219 | ||
|
|
b5060e1347 | ||
|
|
32fe2f7375 | ||
|
|
fa20e99bed | ||
|
|
e55ead2f09 | ||
|
|
4d35d0238e | ||
|
|
b24c0c49fe | ||
|
|
7897a9bd5c | ||
|
|
2dfc29adbf | ||
|
|
ca2e558746 | ||
|
|
229364faf6 | ||
|
|
ad51e3471b | ||
|
|
3b77cbdece | ||
|
|
6f65ae0d91 | ||
|
|
582ec6a5f0 | ||
|
|
1c34d5b87a | ||
|
|
3a3e986f0c | ||
|
|
cb4e4c5522 | ||
|
|
341298f015 | ||
|
|
b64f0bd423 | ||
|
|
da76f5dc0e | ||
|
|
56406de693 | ||
|
|
5edd4e9a0c | ||
|
|
b47a7f2282 |
@@ -0,0 +1 @@
|
|||||||
|
"""Empty init file for ${REPO_NAME_SNAKE} module."""
|
||||||
@@ -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()
|
||||||
@@ -1,21 +1,14 @@
|
|||||||
"""Main file for bot."""
|
"""Main file for bot."""
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from settings import settings
|
from .settings import settings
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def run() -> None:
|
||||||
"""Set config, intents, then connects the bot to discord."""
|
"""Set config, intents, then connects the bot to discord."""
|
||||||
# Allows privileged intents for monitoring members joining, roles editing, and role assignments
|
# Allows privileged intents for monitoring members joining, roles editing, and role assignments
|
||||||
# These need to be enabled in the developer portal as well
|
# These need to be enabled in the developer portal as well
|
||||||
@@ -33,8 +26,8 @@ def main() -> None:
|
|||||||
bot = commands.Bot(intents=intents)
|
bot = commands.Bot(intents=intents)
|
||||||
|
|
||||||
# Get the modules of all cogs whose directory structure is ./cogs/<module_name>
|
# Get the modules of all cogs whose directory structure is ./cogs/<module_name>
|
||||||
for folder in os.listdir("cogs"):
|
for folder in os.listdir(f"${REPO_NAME_SNAKE}/cogs"):
|
||||||
bot.load_extension(f"cogs.{folder}")
|
bot.load_extension(f"${REPO_NAME_SNAKE}.cogs.{folder}")
|
||||||
|
|
||||||
@bot.listen()
|
@bot.listen()
|
||||||
async def on_ready() -> None:
|
async def on_ready() -> None:
|
||||||
@@ -46,7 +39,3 @@ def main() -> None:
|
|||||||
|
|
||||||
# Run Discord bot
|
# Run Discord bot
|
||||||
bot.run(settings.params.discord_token)
|
bot.run(settings.params.discord_token)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
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.
|
||||||
@@ -7,7 +7,7 @@ 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: nextcord.Bot) -> None:
|
def __init__(self, bot: commands.Bot) -> None:
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@nextcord.slash_command()
|
@nextcord.slash_command()
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
.*
|
||||||
|
Dockerfile
|
||||||
@@ -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
-2
@@ -1,4 +1,5 @@
|
|||||||
|
$REPO_NAME_SNAKE/**
|
||||||
.gitea/workflows/*.yml
|
.gitea/workflows/*.yml
|
||||||
main.py
|
.vscode/launch.json
|
||||||
pyproject.toml
|
pyproject.toml
|
||||||
settings.py
|
Dockerfile
|
||||||
|
|||||||
@@ -13,13 +13,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@v7
|
||||||
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}
|
||||||
@@ -11,13 +11,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@v7
|
||||||
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@v7
|
||||||
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}
|
||||||
Vendored
+2
-1
@@ -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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+6
-10
@@ -1,16 +1,12 @@
|
|||||||
FROM python:3.12.3-slim
|
FROM python:3.13.7-slim
|
||||||
|
|
||||||
# install uv
|
# 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
|
||||||
|
|
||||||
|
# Sync the project into a new environment, using the frozen lockfile
|
||||||
WORKDIR /home
|
WORKDIR /home
|
||||||
|
|
||||||
COPY config.py config.py
|
|
||||||
COPY main.py main.py
|
|
||||||
COPY pyproject.toml pyproject.toml
|
|
||||||
|
|
||||||
COPY cogs cogs/
|
|
||||||
|
|
||||||
RUN uv sync --frozen --no-dev
|
RUN uv sync --frozen --no-dev
|
||||||
|
|
||||||
CMD ["uv", "run", "./main.py"]
|
CMD ["uv", "run", "--frozen", "--no-dev", "-m", "${REPO_NAME_SNAKE}"]
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -6,7 +6,6 @@ authors = [{name="${REPO_OWNER}", email=""}]
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nextcord>=2.6.0",
|
"nextcord>=2.6.0",
|
||||||
"python-dotenv>=1.0.1",
|
|
||||||
"sqlmodel>=0.0.22",
|
"sqlmodel>=0.0.22",
|
||||||
"dataclass-wizard[yaml]>=0.22.3,<1.0.0",
|
"dataclass-wizard[yaml]>=0.22.3,<1.0.0",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user