Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions capy_discord/exts/tools/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ async def sync(self, ctx: commands.Context[commands.Bot], spec: str | None = Non
"""Sync commands manually with "!" prefix (owner only)."""
try:
if spec in [".", "guild"]:
if ctx.guild is None:
await ctx.send("This command must be used in a guild.")
return
# Instant sync to current guild
ctx.bot.tree.copy_global_to(guild=ctx.guild)
synced = await ctx.bot.tree.sync(guild=ctx.guild)
description = f"Synced {len(synced)} commands to **current guild**."
elif spec == "clear":
if ctx.guild is None:
await ctx.send("This command must be used in a guild.")
return
# Clear guild commands
ctx.bot.tree.clear_commands(guild=ctx.guild)
await ctx.bot.tree.sync(guild=ctx.guild)
Expand Down
2 changes: 1 addition & 1 deletion capy_discord/ui/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ def __init__(
async def on_submit(self, interaction: discord.Interaction) -> None:
"""Delegate submission to the callback."""
if self.submission_callback:
await self.submission_callback(interaction, self) # type: ignore
await self.submission_callback(interaction, self)
41 changes: 20 additions & 21 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.