0
votes

I am making a small discord.py bot that interacts with a game stats api, I got the bot to respond with the correct information now I am just trying to find a way to format the reply so it look neater, I have seen many tutorials on how to format strings but for my case none of them worked.

@client.command()
async def show(ctx, player,):  # General stats
    rs = requests.get(apiLink + "/checkban?name=" + str(player))
    if rs.status_code == 200:  # HTTP OK
        rs = rs.json()
        embed = discord.Embed(title="Other users for" + str(player), description="""User is known as: 
        """ +(str(rs["otherNames"]['usedNames'])))
        await ctx.send(embed=embed)

Here is a picture of the reply in discord discord

How would I go to remove the quotation marks and the brackets in the reply? I know how to make it work with printed next but I haven't found help when the text is pulled from a web json api and embedded.

Thank you! :)

You can look into the join function in python. Assuming that you have an array of all names that you need to display, you can use ','.join({array_name}) to join all the values while putting commas between each oneSaurav Chittal
I've tried your suggestion but I am running into the same issue, how would I use that function inside the embeded message? It feels a little trickier for me since what I am modifying is the json reply from the request.Se7en Axis
@Se7enAxis don't do it inside the embed message. Create a new variable and set it to the formatted string, and then set the description arg of the embed to that variable.Aditya Tomar