Allow reloading the config on the $sync command

This lets us keep higher uptime if needed
This commit is contained in:
Marc Di Luzio 2024-08-09 14:03:53 +01:00
parent b6a4bdf46c
commit 9f5cc9bb49

View file

@ -1,6 +1,7 @@
import discord import discord
import random import random
import logging import logging
import importlib
from discord import app_commands from discord import app_commands
from discord.ext import commands from discord.ext import commands
import util import util
@ -37,6 +38,9 @@ async def on_ready():
@commands.dm_only() @commands.dm_only()
async def sync(ctx: discord.ext.commands.context.Context): async def sync(ctx: discord.ext.commands.context.Context):
"""Handle sync command""" """Handle sync command"""
# Reload the config first
importlib.reload(config)
logger.info(f"Reloaded config")
# Sync the commands with the discord API # Sync the commands with the discord API
synced = await bot.tree.sync() synced = await bot.tree.sync()
logger.info(f"Synced {len(synced)} command(s)") logger.info(f"Synced {len(synced)} command(s)")