Archived
generated from imcompiling/discord-bot-template
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ad68f4014 | ||
|
|
3aa0bf291f | ||
|
|
b727a80e4f | ||
|
|
857b5f1669 | ||
|
|
34cd2f9975 | ||
|
|
6af2476339 | ||
|
|
4a3f356b23 | ||
|
|
4fe2339ac1 | ||
|
|
2069b2544f | ||
|
|
901bcf3c62 | ||
|
|
8e8f84a42e | ||
|
|
cd241e6f5e | ||
|
|
93d9b565c0 | ||
|
|
c816d3b5b8 | ||
|
|
91900f2b00 |
@@ -0,0 +1,4 @@
|
||||
.*
|
||||
Dockerfile
|
||||
renovate.json
|
||||
README.md
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- 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
|
||||
|
||||
@@ -17,11 +17,11 @@ jobs:
|
||||
- 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
|
||||
password: $${{ secrets.PASSWORD }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
- name: Build Docker Image
|
||||
run: docker build -t gitea.cheezers.org/imcompiling/off-cooldown-bot:latest .
|
||||
- name: Push Docker Image
|
||||
|
||||
Vendored
+5
-5
@@ -5,11 +5,11 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Module",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"module": "main",
|
||||
"justMyCode": true
|
||||
"name": "Python: Module",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"module": "off_cooldown_bot.main",
|
||||
"justMyCode": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+2
-5
@@ -4,8 +4,5 @@
|
||||
"reportArgumentType": "information",
|
||||
"reportAttributeAccessIssue": "warning"
|
||||
},
|
||||
"cSpell.words": [
|
||||
"cakeday",
|
||||
"cakedays"
|
||||
]
|
||||
}
|
||||
"cSpell.words": ["cakeday", "cakedays", "cooldown", "nextcord"]
|
||||
}
|
||||
|
||||
+4
-8
@@ -3,14 +3,10 @@ FROM python:3.12.3-slim
|
||||
# install uv
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.6.5 /uv /uvx /bin/
|
||||
|
||||
WORKDIR /home
|
||||
|
||||
COPY config.py config.py
|
||||
COPY main.py main.py
|
||||
COPY pyproject.toml pyproject.toml
|
||||
|
||||
COPY cogs cogs/
|
||||
COPY . /off_cooldown_bot
|
||||
|
||||
# Sync the project into a new environment, using the frozen lockfile
|
||||
WORKDIR /off_cooldown_bot
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
CMD ["uv", "run", "./main.py"]
|
||||
CMD ["uv", "run", "./off_cooldown_bot/main.py"]
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
"""Empty init file for off_cooldown_bot module."""
|
||||
@@ -7,5 +7,4 @@ from . import models # noqa: F401 - Need this import for creating the models.
|
||||
url = "sqlite:///database.db"
|
||||
engine = create_engine(url)
|
||||
|
||||
# Don't need to create all when connected to prod.
|
||||
SQLModel.metadata.create_all(engine)
|
||||
@@ -8,8 +8,8 @@ import pathlib
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from logger import ocd_logger
|
||||
from settings import settings
|
||||
from .logger import ocd_logger
|
||||
from .settings import settings
|
||||
|
||||
nextcord_logger = logging.getLogger("nextcord")
|
||||
nextcord_logger.setLevel(logging.DEBUG)
|
||||
@@ -30,7 +30,7 @@ def main() -> None:
|
||||
intents.message_content = True
|
||||
|
||||
# To enable the guilds privileged intent:
|
||||
# intents.guilds = True
|
||||
# intents.guilds = True # noqa: ERA001
|
||||
|
||||
# To enable the members privileged intent:
|
||||
intents.members = True
|
||||
@@ -47,7 +47,7 @@ def main() -> None:
|
||||
if bot.user is None:
|
||||
ocd_logger.critical("Discord connection failed.")
|
||||
return
|
||||
ocd_logger.info(f"{bot.user.name} has connected to Discord!")
|
||||
ocd_logger.info("%s has connected to Discord!", bot.user.name)
|
||||
|
||||
# Run Discord bot
|
||||
bot.run(settings.params.discord_token)
|
||||
@@ -35,3 +35,7 @@ class Settings(YAMLWizard):
|
||||
|
||||
|
||||
settings = Settings.from_yaml_file(CONFIG_LOCATION)
|
||||
|
||||
# I'm not expecting a list to be returned.
|
||||
if isinstance(settings, list):
|
||||
settings = settings[0]
|
||||
@@ -6,7 +6,6 @@ authors = [{ name = "imcompiling", email = "[email protected]" }]
|
||||
readme = "README.md"
|
||||
dependencies = [
|
||||
"nextcord>=2.6.0",
|
||||
"python-dotenv>=1.0.1",
|
||||
"sqlmodel>=0.0.22",
|
||||
"dataclass-wizard[yaml]>=0.22.3,<1.0.0",
|
||||
"pytz>=2025.1",
|
||||
|
||||
Reference in New Issue
Block a user