diff --git a/docs/guide/topics/embeds.rst b/docs/guide/topics/embeds.rst index 37cb513b9..46cd1c17a 100644 --- a/docs/guide/topics/embeds.rst +++ b/docs/guide/topics/embeds.rst @@ -257,6 +257,8 @@ In this example, we will use the :meth:`Bot.user.display_avatar `: .. code-block:: python3 @@ -284,27 +286,28 @@ the embed. The alternative to this, is to set :attr:`Embed.thumbnail`, which would be displayed in the top right corner of the embed. -Rather than setting the URL, we are going to attach a file for the thumbnail. +Rather than setting the image to a URL like we did before, let's try attaching a file for thumbnail. + +First, we have to construct a :class:`File` object. The first argument is the file path, and the second is the name of the attachment that will be used to refer to it within Discord. .. code-block:: python3 my_file = discord.File('./images/sunny_weather.png', 'thumbnail.png') - my_weather_embed.set_thumbnail(url="attachment://thumbnail.png") - - await channel.send(embed=my_weather_embed, file=my_file) - -What we do here is first retrieve the file from the local filesystem via :class:`discord.File`, -and then refer to the filename in the embed. +Next, we need to call :meth:`my_weather_embed.set_thumbnail() ` to set the thumbnail. +To refer to our attachment for the thumbnail, we will use a special URI scheme that Discord provides - ``attachment://``. -In this case the we provide the filename as ``thumbnail.png``, -so to refer to it, we use ``attachment://thumbnail.png``. +Since we called our file ``thumbnail.png``, we will set the ``url`` parameter to ``attachment://thumbnail.png``. -.. note:: +.. code-block:: python3 - ``attachment://`` is a special URI scheme that Discord understands and will automatically - place the attached file as the thumbnail of the embed. + my_weather_embed.set_thumbnail(url="attachment://thumbnail.png") .. warning:: Make sure to provide the file with the ``file`` parameter before sending the message. + Otherwise, Discord will not know what attachment you are referring to within the embed. + + .. code-block:: python3 + + await message.channel.send(embed=my_weather_embed, file=my_file)