Search code examples
pythonjsondiscorddiscord.pyembed

Error: Object of type MissingPermissions is not JSON serializable


@client.event
async def on_command_error(ctx, error):
    embed = discord.Embed(colour=maincolour)
    embed.title = "**Error**"
    embed.description = error
    await ctx.send(embed=embed)

When I run and put a command with an error or something, I want it to send back the embed but all it says in the logs is Object of type MissingPermissions is not JSON serializable on the last line of the script above. Please may someone help?


Solution

  • Replace embed.description = error with embed.description = str(error) (print type(error) if you want to get a better understanding)