#Command raised an exception TypeError object NoneType can't be used in 'await' expression

1 messages · Page 1 of 1 (latest)

royal kite
#

I actually don't understand the issue at all.

    @gang.sub_command(name="add")
    async def gang_add(self, inter:disnake.ApplicationCommandInteraction, name: str, slots: int, tier: typing.Literal["1", "2", "3", "Max"]):
        """Add a new gang
        
        Parameters
        ----------
        name:
            The name of the gang
        slots:
            The amount of slots the gang has
        tier:
            The tier of the gang
        """
        await inter.response.defer(with_message=True, ephemeral=True)

        channel = inter.guild.get_channel(1023672676587409520)
        role = await inter.guild.create_role(name=f"{name} | {tier}", mentionable=True)
        embed = disnake.Embed(title="Gang Created", description=f"Created a gang called `{name}` with `{slots}` slots and a tier of `{tier}`", color=0x00ff00)
        embed2 = disnake.Embed(title="Gang Created")
        embed2.add_field(name="Gang Name", value=name)
        embed2.add_field(name="Slots", value=slots)
        embed2.add_field(name="Tier", value=tier)
        embed2.set_author(name=f"By: {inter.author}", icon_url=inter.author.avatar.url)
        embed2.set_footer(text=f"ID: {inter.author.id}")
        if tier == "Max":
            tier = 4
        await db.execute("INSERT INTO gangs (ID, slots, tier) VALUES (?, ?, ?)", role.id, slots, tier)
        await db.commit()

        await channel.send(embed=embed2)
    
        await inter.edit_original_message(embed=embed)
hearty wagonBOT
#

If you're getting an error, please include the entire traceback and paste it to our pastebin: https://paste.disnake.dev

Not including the entire error or omitting parts will lead to less helpful support and an inability to fix this issue if it turns out to be a library bug.

royal kite
#
    await db.execute("INSERT INTO gangs (ID, slots, tier) VALUES (?, ?, ?)", role.id, slots, tier)
TypeError: object NoneType can't be used in 'await' expression

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 1255, in process_application_commands
    await app_command.invoke(interaction)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 724, in invoke
    await self.invoke_children(inter)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 713, in invoke_children
    await subcmd.invoke(inter, **kwargs)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 364, in invoke
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: object NoneType can't be used in 'await' expression
#

which object is none? and how and why

#

wait lmaoo ignore oopsie. forgot using sqlite3 now aiosqlite