Skip to content

Commit

Permalink
Test sync command
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimShadyIAm committed Mar 31, 2022
1 parent b97696b commit 9665fdf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ COPY ./requirements.txt .
COPY . .
RUN pip install --upgrade pip setuptools wheel
RUN pip install -r requirements.txt
RUN python3 -u sync_commands.py
# RUN python3 -u sync_commands.py
CMD ["python", "-u", "main.py"]
14 changes: 13 additions & 1 deletion cogs/commands/misc/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import traceback
import discord
from discord import app_commands
from discord.ext import commands
from data.services import guild_service
from utils import GIRContext, cfg, transform_context
from utils import GIRContext, cfg, transform_context, logger
from utils.framework import admin_and_up, guild_owner_and_up
from utils.framework.transformers import ImageAttachment

Expand Down Expand Up @@ -32,6 +33,17 @@ async def sabbath(self, ctx: GIRContext, mode: bool = None):

await ctx.send_success(f"Set sabbath mode to {'on' if g.sabbath_mode else 'off'}!")

@commands.command()
@commands.is_owner()
async def sync(self, ctx: commands.Context):
try:
async with ctx.typing():
await self.bot.tree.sync(guild=discord.Object(id=cfg.guild_id))
except Exception as e:
await ctx.send(f"An error occured\n```{e}```")
logger.error(traceback.format_exc())
else:
await ctx.send("Done!")

async def setup(bot):
await bot.add_cog(Admin(bot))

0 comments on commit 9665fdf

Please sign in to comment.