#Slash Commands not registering

1 messages · Page 1 of 1 (latest)

spiral meteor
#
@bot.slash_command(name="collect", description="Collect an item!", guild_ids=bot_guilds)
async def throw(ctx: ApplicationContext):
    await ctx.respond(f"Working! My latency is {bot.latency}. Context type is {str(type(ctx))}.")

bot_guilds is [i.id for i in bot.guilds], that list works, but it doesn't add the command to the slashes. however if i specify it explicitly (guild_ids=[123456345678]) it will register and it will ALSO work if i change the code afterwards. what have i done wrong above?

tough loom
#

is the bot invited with application.commands?

visual grail
#

You shouldn't be adding every single bot guild to a slash command like that, just omit the guild_ids field to register them globally. That field is supposed to be used for registering commands to a few specific servers.

opaque mulch
#

This will not work.

bot.guilds is only populated when the bot is online

But the list is created before that. So an empty list gets passed to the Slash cmd. Thus removing the command for all guilds

opaque mulch
visual grail
#

All bots have application.commands nowadays, you don't need to specifically grant it

opaque mulch
opaque mulch
#

@visual grail did you resolve it?

#

oh wait wrong guy 💀

#

@spiral meteor is this resolved now?

spiral meteor
#

yup it works!

#

however the bot's pfp doesn't load in the left side until it gets autocompleted and run

#

which should be totally fine for now

#

on the other hand,

#

why is the file being attached seperately?

#
await ctx.respond(content=None, file=gen_image[0], embed=embeds["snowball_success"].set_image(
            url=f"attachment://{gen_image[1]}"
        ))
#

file is a discord.File object, url should be something like attachment://1.png

opaque mulch
spiral meteor
spiral meteor