#Application Command raised an exception KeyError 1043936305127632927

1 messages · Page 1 of 1 (latest)

lean latch
#

Whenever I try to use my welcome command I get this error

#

welcome command code:

@client.slash_command(description="Sets the welcome channel and message")
@commands.has_permissions(manage_guild=True)
async def welcome(ctx,ch: discord.TextChannel=None, *, msg=None):
    if ch==None: ch=ctx.channel
    if msg=="default": msg=default_welcome
    if ctx.guild.id not in settings: settings[ctx.guild.id] = {}
    if 'welcome' in settings[ctx.guild.id]:
        settings[ctx.guild.id]['welcome'][0]=ch.id
        if msg: settings[ctx.guild.id]['welcome'][1]=msg
    else:
        if msg==None: msg=default_welcome
        settings[ctx.guild.id]['welcome'] = [ch.id, msg]
    db.set('settings', str(settings))
    await ctx.respond(f"**:yes: Set the Welcome Channel to {ch.mention}**")
@welcome.error
async def welcome_error(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        await ctx.respond(f"**:no: {error}**")
        return
    args = ctx.message.content.lower().split()
    if len(args)>1 and args[1]=="disable":
        await ctx.respond(f"**:yes: Disabled the welcome message**")
        del settings[ctx.guild.id]['welcome']
        db.set('settings', str(settings))
    else:
        await ctx.respond(f"**:no: {error}**")

raven verge
#

What error? You didn't show any errors

north silo
#

are you sure 1 line if statements work that way?

lean latch
lean latch
#

but it still shows the same error

lean latch
#

I tried console logging the error but I get the same result

#

I've had this issue for a while now

#

Any idea why this happens?

surreal tendon
#

This means that the key of your guild_id doesn't exist in the settings dictionary

#

Very basic python error

surreal tendon
north silo
#

Must be some sort of error handler blocking it from showing up

lean latch
lean latch
lean latch
#

Thank you so much Colin,
I have finally resolved the issue, I've had this issue for a while now. It's now finally fixed, thank you so much again!