Search code examples
pythonembeddiscorddiscord.py

Using a variable for a masked link; discord.py embed posted through webhook; python


For a discord bot that will post links, for the URL that it outputs to be masked

variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value=str("![test]!({variable})"))

Do not know how this works

embed.add_field(name=str(field[0]), value=str("![test]!( https://www.google.com)"))

Solution

  • variable = url + "/collection/" + str(field[1]) + "test"
    embed.add_field(name=str(field[0]), value="![test]!({})".format(variable))
    

    format replaces {} into the given string.