This commit is contained in:
Parker M. 2025-04-03 22:17:26 -05:00
parent 4a03653c13
commit 330636bcc0
Signed by: parker
GPG Key ID: 505ED36FC12B5D5E
2 changed files with 4 additions and 36 deletions

View File

@ -35,7 +35,6 @@ DB_PORT = None
DB_USER = None
DB_PASSWORD = None
schema = {
"type": "object",
"properties": {
@ -47,7 +46,7 @@ schema = {
},
"required": ["token"],
},
"sqlite": { # TODO - turn SQLITE path and name into global variables
"sqlite": {
"type": "object",
"properties": {
"name": {"type": "string", "default": "disarchive"},
@ -93,7 +92,7 @@ schema = {
}
# Attempt to load the config file, otherwise create a new template
# Load config file or alert user if not found
def load_config():
if os.path.exists("/.dockerenv"):
file_path = "/config/config.yaml"
@ -114,7 +113,7 @@ def load_config():
)
# Thouroughly validate all of the options in the config.yaml file
# Validate the config file against the schema
def validate_config(file_contents):
global TOKEN, BOT_COLOR, SQLITE_NAME, DB_NAME, DB_ENGINE, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD
config = yaml.safe_load(file_contents)
@ -170,34 +169,3 @@ def validate_config(file_contents):
DB_ENGINE = "sqlite"
TOKEN = config["bot_info"]["token"]
"""
Template for embeds
"""
def create_embed(
title: str = None,
description: str = None,
color=None,
footer=None,
thumbnail=None,
):
embed = discord.Embed(
title=title,
description=description,
color=color if color else BOT_COLOR,
)
if footer:
embed.set_footer(text=footer)
# else:
# embed.set_footer(
# text=datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") + " UTC"
# )
if thumbnail:
embed.set_thumbnail(url=thumbnail)
return embed

View File

@ -8,7 +8,7 @@ import os
from src.utils.db import get_db
from models import Message
from config import BOT_COLOR, LOG, create_embed
from config import BOT_COLOR, LOG
class Archive(commands.Cog):