I am trying to add a quotes API to my discord bot and it sends random quotes.

I used the freeCodeCamp tutorial by Beau Carnes but ZenQuotes is not working. I was also recommended aiohttp instead of requests module but aiohttp is not working. Anyone know how to modify Carnes’ tutorial or have documentation on how to use another quotes API for python discord bot?

async def get_quote():
  response = requests.get("https://zenquotes.io/api/random")
  json_data = json.loads(response.text)
  quote = json_data[0]["q"]
  return (quote) 

async def inspire(ctx):
    quote = await get_quote()
    await ctx.send(quote)```

you may need an await so it waits for the api to return something

how do I delete this post, because I made some changes to what API I’m using and want to ask another specific question

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.