1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 16:03:12 +00:00

refactor: Update Dockerfile and docker-compose.dev.yml for development environment

This commit is contained in:
wlinator 2024-09-02 16:31:25 -04:00
parent f73e7882de
commit c040ea7d22
6 changed files with 42 additions and 8 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
data/

View file

@ -17,7 +17,6 @@ RUN pip install --no-cache-dir poetry && \
pip cache purge
COPY . .
RUN rm -rf .venv
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

View file

@ -3,6 +3,14 @@ services:
build: .
container_name: lumi-core
restart: always
develop:
watch:
- action: sync
path: .
target: /usr/src/app/
ignore:
- .venv/
- data/
env_file:
- path: ./.env
required: true

View file

@ -145,6 +145,7 @@
"daily_success_claim_description": "you claimed your reward of **${0}**!",
"default_level_up_message": "**{0}** you have reached **Level {1}**.",
"dev_clear_tree": "The application command tree has been cleared.",
"dev_stop_note": "Stopping the bot...\n-# Note: if Luminara is running with Docker Compose, this will restart the container.",
"dev_sync_tree": "The application command tree has been synced.",
"error_actionable_hierarchy_bot": "I don't have permission to perform this action on this user due to role hierarchy.",
"error_actionable_hierarchy_user": "you don't have permission to perform this action on this user due to role hierarchy.",

View file

@ -2,20 +2,24 @@ import discord
from discord.ext import commands
import lib.format
from lib.client import Luminara
from lib.const import CONST
class Dev(commands.Cog):
def __init__(self, bot: commands.Bot):
def __init__(self, bot: Luminara):
self.bot = bot
self.sync.usage = lib.format.generate_usage(self.sync)
self.clear.usage = lib.format.generate_usage(self.clear)
self.stop.usage = lib.format.generate_usage(self.stop)
@commands.group(name="dev", description="Lumi developer commands")
@commands.guild_only()
@commands.is_owner()
async def dev(self, ctx: commands.Context[commands.Bot]) -> None:
pass
async def dev(self, ctx: commands.Context[Luminara]) -> None:
"""
Luminara developer commands
"""
@dev.command(
name="sync_tree",
@ -23,7 +27,7 @@ class Dev(commands.Cog):
)
async def sync(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Luminara],
guild: discord.Guild | None = None,
) -> None:
"""
@ -49,7 +53,7 @@ class Dev(commands.Cog):
)
async def clear(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Luminara],
guild: discord.Guild | None = None,
) -> None:
"""
@ -65,6 +69,27 @@ class Dev(commands.Cog):
await ctx.send(content=CONST.STRINGS["dev_clear_tree"])
@dev.command(
name="stop",
usage="dev stop",
)
@commands.is_owner()
async def stop(
self,
ctx: commands.Context[Luminara],
) -> None:
"""
Stops the bot. If Tux is running with Docker Compose, this will restart the container.
async def setup(bot: commands.Bot) -> None:
Parameters
----------
ctx : commands.Context
The context in which the command is being invoked.
"""
await ctx.reply(CONST.STRINGS["dev_stop_note"])
await self.bot.shutdown()
async def setup(bot: Luminara) -> None:
await bot.add_cog(Dev(bot))

View file

@ -13,7 +13,7 @@ class Ping(commands.Cog):
@commands.hybrid_command(name="ping")
async def ping(self, ctx: commands.Context[commands.Bot]) -> None:
"""
Ping command.
Show Luminara's latency.
Parameters
----------