Milo
Milo

Reputation: 11

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!

Upvotes: 0

Views: 918

Answers (1)

Ratery
Ratery

Reputation: 2917

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.

Upvotes: 1

Related Questions