Update the sync command to report progress
This commit is contained in:
parent
b98fa7469a
commit
723659344b
1 changed files with 10 additions and 4 deletions
14
matchy.py
14
matchy.py
|
@ -35,18 +35,24 @@ async def on_ready():
|
||||||
@bot.command()
|
@bot.command()
|
||||||
@commands.check(lambda ctx: ctx.message.author.id in config.OWNERS)
|
@commands.check(lambda ctx: ctx.message.author.id in config.OWNERS)
|
||||||
@commands.dm_only()
|
@commands.dm_only()
|
||||||
async def sync(ctx: discord.ext.commands.context.Context):
|
async def sync(ctx: commands.Context):
|
||||||
"""Handle sync command"""
|
"""Handle sync command"""
|
||||||
|
|
||||||
# Reload the config first
|
# Reload the config first
|
||||||
|
msg = await ctx.reply("Reloading config...", ephemeral=True)
|
||||||
importlib.reload(config)
|
importlib.reload(config)
|
||||||
logger.info(f"Reloaded config")
|
logger.info(f"Reloaded config")
|
||||||
|
|
||||||
# Sync the commands with the discord API
|
# Sync the commands with the discord API
|
||||||
|
await msg.edit(content="Syncing...")
|
||||||
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)")
|
||||||
# Cache the guild information
|
|
||||||
cache_guilds()
|
|
||||||
await ctx.reply("Done!", ephemeral=True)
|
|
||||||
|
|
||||||
|
# Cache the guild information
|
||||||
|
await msg.edit(content="Caching guilds...")
|
||||||
|
cache_guilds()
|
||||||
|
|
||||||
|
await msg.edit(content="Done!")
|
||||||
|
|
||||||
@bot.tree.command(description = "Match matchees into groups", guilds = list(g for g in guilds if g.id in config.SERVERS))
|
@bot.tree.command(description = "Match matchees into groups", guilds = list(g for g in guilds if g.id in config.SERVERS))
|
||||||
@app_commands.describe(per_group = "Matchees per group (default 3+)", post = "Post to channel")
|
@app_commands.describe(per_group = "Matchees per group (default 3+)", post = "Post to channel")
|
||||||
|
|
Loading…
Add table
Reference in a new issue