How to make insult command(discord.py)

i'm making an insult command,its making a JSONDecode Error any solution...

@client.command(pass_context=True)
async def insult(ctx):
  async with aiohttp.ClientSession() as session:
      request = await session.get('https://evilinsult.com/generate_insult.php?lang=en&type=json')
      insultjson = await request.json(content_type='text/html')

  await ctx.send(url=insultjson['insult']) 

1 answer

  • answered 2021-09-27 17:19 Harsh Modani

    The problem is most probably the link. Instead of &, just use &. Plus, they seem to have a plain text option too - replace type=json with type=text in the same link and you should be able to use it without having to deal with JSON at all. Check out evilinsult.com's GitHub repo

    Also, please always paste your exact errors - it helps us give you a better answer.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum