Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 670f81ae60 | |||
| a8b5a59212 | |||
| a7f00f9e43 | |||
| 08938c08ae |
163
.gitignore
vendored
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
# Bot databases stored as .db
|
||||||
|
*.db
|
||||||
|
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
||||||
@ -15,6 +15,10 @@ Source Code:
|
|||||||
https://github.com/jtkick/base-discord-bot
|
https://github.com/jtkick/base-discord-bot
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# BOT PERMISSIONS
|
||||||
|
# 1729383718059856
|
||||||
|
|
||||||
PROJECT_VERSION = "0.1.0"
|
PROJECT_VERSION = "0.1.0"
|
||||||
|
|
||||||
# Standard imports
|
# Standard imports
|
||||||
@ -25,6 +29,7 @@ import sys
|
|||||||
# Third-part imports
|
# Third-part imports
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
from discord import app_commands
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
|
|
||||||
@ -72,6 +77,8 @@ def main():
|
|||||||
if filename.endswith('.py'):
|
if filename.endswith('.py'):
|
||||||
await client.load_extension(f'cogs.{filename[:-3]}')
|
await client.load_extension(f'cogs.{filename[:-3]}')
|
||||||
logger.info("Loaded %s cog", filename)
|
logger.info("Loaded %s cog", filename)
|
||||||
|
for server in client.guilds:
|
||||||
|
await client.tree.sync(guild=discord.Object(id=server.id))
|
||||||
|
|
||||||
client.run(TOKEN, log_handler=None)
|
client.run(TOKEN, log_handler=None)
|
||||||
|
|
||||||
|
|||||||
BIN
assets/dj.png
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.7 KiB |
3
assets/icons/__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from .icons import colors, generate_pngs
|
||||||
63
assets/icons/icons.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import cairosvg
|
||||||
|
import codecs
|
||||||
|
import discord
|
||||||
|
import inspect
|
||||||
|
import pathlib
|
||||||
|
import PIL
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
# I need a list of all colors that the Discord library offers, and I can't seem
|
||||||
|
# to find a good one, so I'm going to just create one here
|
||||||
|
colors = ['ash_embed', 'ash_theme', 'blue', 'blurple', 'brand_green',
|
||||||
|
'brand_red', 'dark_blue', 'dark_embed', 'dark_gold', 'dark_gray',
|
||||||
|
'dark_green', 'dark_grey', 'dark_magenta', 'dark_orange', 'dark_purple',
|
||||||
|
'dark_red', 'dark_teal', 'dark_theme', 'darker_gray', 'darker_grey',
|
||||||
|
'default', 'fuchsia', 'gold', 'green', 'greyple', 'light_embed',
|
||||||
|
'light_gray', 'light_grey', 'light_theme', 'lighter_gray',
|
||||||
|
'lighter_grey', 'magenta', 'og_blurple', 'onyx_embed', 'onyx_theme',
|
||||||
|
'orange', 'pink', 'purple', 'red', 'teal', 'yellow']
|
||||||
|
|
||||||
|
def generate_pngs(svg_path: pathlib.Path, png_path: pathlib.Path):
|
||||||
|
"""Generate icons for embed messages.
|
||||||
|
|
||||||
|
This method takes SVG files, changes their colors, and converts them into
|
||||||
|
PNG files for use in Discord message embeds. Since uploading the image
|
||||||
|
itself to the Discord message isn't an option, we are going to create a
|
||||||
|
designated directory for the icons, and use the public URL for it to point
|
||||||
|
Discord to the proper icon.
|
||||||
|
|
||||||
|
Params:
|
||||||
|
svg_path (pathlib.Path): The path to the SVG files to be converted.
|
||||||
|
png_path (pathlib.Path): The path to store the resultant PNG files.
|
||||||
|
"""
|
||||||
|
# Convert to each Discord color
|
||||||
|
for color_name in colors:
|
||||||
|
color_dir = png_path / color_name
|
||||||
|
color_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
color_hex = str(getattr(discord.Colour, color_name)())
|
||||||
|
|
||||||
|
# Open each SVG in the directory
|
||||||
|
for svg_file in svg_path.glob("*.svg"):
|
||||||
|
with codecs.open(svg_file, "r", encoding="utf-8") as f:
|
||||||
|
svg_data = f.read()
|
||||||
|
|
||||||
|
# Convert the SVG elements to the correct new color
|
||||||
|
svg_data = svg_data.replace("#000000", color_hex)
|
||||||
|
|
||||||
|
# If we just save the new PNG, the icon will completely fill the
|
||||||
|
# image, but we're going to use it in areas of Discord messages
|
||||||
|
# where they are rendered in circles, so we're going to add margins
|
||||||
|
# on each side so that the icon doesn't get cut off
|
||||||
|
with tempfile.NamedTemporaryFile(delete=True) as temp:
|
||||||
|
cairosvg.svg2png(
|
||||||
|
bytestring=svg_data.encode("utf-8"), write_to=temp.name)
|
||||||
|
# Resize to add border
|
||||||
|
img = PIL.Image.open(temp.name).convert("RGBA")
|
||||||
|
img = PIL.ImageOps.expand(img, border=100, fill=(0, 0, 0, 0))
|
||||||
|
img.resize((300, 300), PIL.Image.LANCZOS)
|
||||||
|
|
||||||
|
# Save to actual PNG file
|
||||||
|
img.save(color_dir / f"{svg_file.stem}.png", format="PNG")
|
||||||
|
print("new file:", color_dir / f"{svg_file.stem}.png")
|
||||||
BIN
assets/icons/png/ash_embed/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/ash_embed/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
assets/icons/png/ash_embed/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/ash_embed/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/ash_embed/line-3.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
assets/icons/png/ash_embed/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/ash_embed/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/ash_embed/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/ash_embed/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/ash_embed/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/ash_embed/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/icons/png/ash_embed/music-note.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
assets/icons/png/ash_embed/plus.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/icons/png/ash_embed/search.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/ash_theme/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/ash_theme/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
assets/icons/png/ash_theme/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/ash_theme/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/ash_theme/line-3.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
assets/icons/png/ash_theme/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/ash_theme/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/ash_theme/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/ash_theme/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/ash_theme/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/ash_theme/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/icons/png/ash_theme/music-note.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
assets/icons/png/ash_theme/plus.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/icons/png/ash_theme/search.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
assets/icons/png/blue/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/blue/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/blue/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/blue/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/blue/line-3.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/blue/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/blue/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/blue/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/blue/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/blue/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/blue/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
assets/icons/png/blue/music-note.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/icons/png/blue/plus.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/icons/png/blue/search.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/blurple/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/blurple/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/blurple/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/blurple/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/blurple/line-3.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
assets/icons/png/blurple/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/blurple/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/blurple/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/blurple/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/blurple/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/blurple/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/icons/png/blurple/music-note.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/icons/png/blurple/plus.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/icons/png/blurple/search.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/brand_green/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/brand_green/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/brand_green/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/brand_green/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/brand_green/line-3.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
assets/icons/png/brand_green/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/brand_green/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/brand_green/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/brand_green/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/brand_green/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/brand_green/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/icons/png/brand_green/music-note.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/icons/png/brand_green/plus.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/icons/png/brand_green/search.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/brand_red/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/brand_red/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/brand_red/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/brand_red/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/brand_red/line-3.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
assets/icons/png/brand_red/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/brand_red/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/brand_red/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/brand_red/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/brand_red/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/brand_red/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/icons/png/brand_red/music-note.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/icons/png/brand_red/plus.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/icons/png/brand_red/search.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/dark_blue/arrow-2-rectangle-path.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/dark_blue/arrow-cw.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/png/dark_blue/dots-3-horizontal.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/dark_blue/headphones.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/icons/png/dark_blue/line-3.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/dark_blue/list-bullet.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/icons/png/dark_blue/media-backward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/dark_blue/media-forward.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/icons/png/dark_blue/media-pause.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/icons/png/dark_blue/media-play.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/icons/png/dark_blue/media-stop.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |