#discord.errors.ClientException Callback for invite command is missing context parameter.

1 messages · Page 1 of 1 (latest)

charred blaze
uneven geyser
#

Why don’t you just use the option in the developer portal to set the default add button (in app authorization)
Then you don’t have to add this useless stuff

charred blaze
#
    @bot.slash_command()
    async def invite(ctx):
        await ctx.respond(
            f"https://discord.com/api/oauth2/authorize?client_id={bot.application_id}&permissions=2147551232&scope=applications.commands%20bot"
        )``` why isnt this valid?
#

discord.errors.ClientException Callback for invite command is missing context parameter.

charred blaze
frosty pine
#

then what’s with the indentation

charred blaze
#

like main() or bot()

frosty pine
#

why is this in a function

charred blaze
charred blaze
frosty pine
#

do your other slash commands work

charred blaze
#

and if i add an unnecessary argument to this one, it works too

frosty pine
#

are you really sure this is not in a class?

charred blaze
#

why?

frosty pine
#

because this typically happens when people forget the self arg

charred blaze
#

yeah. i didnt do that

noble parcelBOT
#

bot.py lines 26 to 30

@bot.slash_command()
async def invite(ctx: commands.context) -> None:
    await ctx.respond(
        f"https://discord.com/api/oauth2/authorize?client_id={bot.application_id}&permissions=2147551232&scope=applications.commands%20bot"
    )```
frosty pine
#

slash commands don’t take a commands.context

charred blaze
frosty pine
#

they take a discord.ApplicationContext

charred blaze
#

the annotation isnt the problem but thx for giving me the correct one

noble parcelBOT
#

bot.py lines 25 to 29

@bot.slash_command()
async def invite(ctx: discord.ApplicationContext) -> None:
    await ctx.respond(
        f"https://discord.com/api/oauth2/authorize?client_id={bot.application_id}&permissions=2147551232&scope=applications.commands%20bot"
    )```
signal surge
signal surge
#

cuz ive used it like that and it worked before changing all my typehints

charred blaze
#

typehints shouldnt actually change functionality

#

right?

#

Do slash commands need to take an argument?

frosty pine
#

no

noble parcelBOT
#

bot.py lines 25 to 29

@bot.slash_command(description="Invite link for this bot")
async def invite(ctx: discord.ApplicationContext, useless: str = "") -> None:
    await ctx.respond(
        f"https://discord.com/api/oauth2/authorize?client_id={bot.application_id}&permissions=2147551232&scope=applications.commands%20bot"
    )```
charred blaze
#

but its not optimal imo

signal surge
#

afaik you can create an oauth link with a function

charred blaze