Hyperlinks in an Embed Not Working (Discord. Py)

Tricky issue here...

I have a list of dicts (top_x_games) that I'm looping through and adding certain elements from it to a string. The problem is that the [here](your_link_goes_here) discord syntax for adding a clickable link inside a message doesn't appear to be working. This works in cases for a single string so I'm not sure why it isn't here.

description2 = ""
for game in top_x_games:
        description2 += f"#{game['rank']}) [{game['name']}]({steam_api.get_game_url(game['name'])}) with f"{(game['player_count'])} players\n"

An example of the result has been this, where randomly 2 out of the 10 correctly hyperlink the url to the {game['name']} value but the others don't : see screenshot

Any help or advice would be greatly appreciated!

1 Answer

This occurs because a URLs generated using steam_api.get_game_url contain spaces. URl can not contains spaces therefore Discord doesn’t format them as hyperlinks.

Your problem is not connected to Discord or discord.py.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest