Skip to content

Commit 99870a1

Browse files
authored
Merge pull request #49 from jkoelker/fix/slash-command-sync
fix: sync slash commands to guilds on ready for instant availability
2 parents 7a5046c + 09f1d45 commit 99870a1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/oneiro/bot.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ async def on_config_change(new_config: dict[str, Any]) -> None:
251251

252252
# Start config file watching
253253
await config.start_watching()
254+
255+
# Sync slash commands to all guilds for instant availability
256+
# (global commands can take up to 1 hour to propagate)
257+
if bot.guilds:
258+
guild_ids = [g.id for g in bot.guilds]
259+
await bot.sync_commands(guild_ids=guild_ids)
260+
print(f"Commands synced to {len(guild_ids)} guild(s): {[g.name for g in bot.guilds]}")
261+
254262
print("Ready to generate images!")
255263

256264
@bot.event

0 commit comments

Comments
 (0)