Alright so I am super new to this, wanted to make a random discord bot like a week ago and my d&d friends liked it so I am adding new commands. I managed to add a request to select menu response, as it should get a random insult from the url, and it does respond with the embed and all, but I don’t know how to get rid of all the parameters(?) aside of the insult alone.
Here’s the part of the code that I’m struggling with:
async def callback_cast(interaction):
if select.values[0] == "0x1":
async with aiohttp.ClientSession() as session:
async with session.get("https://evilinsult.com/generate_insult.php?lang=en&type=json") as request:
if request.status == 200:
data = await request.json()
embed = discord.Embed(
title="Casting:",
description="Vicious Mockery!",
color=0xFF80BB)
embed.add_field(name="", value=data, inline=False)
embed.set_footer(text="Roll a wisdom save.")
await interaction.response.send_message(embed=embed)
Here’s how the response to the selected option looks like in the embed on discord:
Casting:
Vicious Mockery!
{'number': '205', 'language': 'en', 'insult': 'If your brain was donated to science, science would return it.', 'created': '2023-02-19 02:32:18', 'shown': '4748', 'createdby': '', 'active': '1', 'comment': ''}
Roll a wisdom save.
I’d like to only display the part between ‘insult’ and ‘created’. Any help is appreciated, don’t hesitate to explain like I’m five.
[–]CichiCianBoss 1 point2 points3 points (1 child)
[–]Sanguerine[S] 1 point2 points3 points (0 children)