mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
Added Embed docs
This commit is contained in:
108
docs/docs_embed.rst
Normal file
108
docs/docs_embed.rst
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
Embeds
|
||||||
|
======
|
||||||
|
|
||||||
|
Embeds are parts of Messages that are sort-of like a preview. They are created serverside by Discord, so in real-time they would come through as part of a `messageUpdate` event. When grabbing messages from logs, they will already be embedded as part of the array ``message.embeds``.
|
||||||
|
|
||||||
|
All the Embed classes extend ``Discord.Embed``.
|
||||||
|
|
||||||
|
Link Embed
|
||||||
|
----------
|
||||||
|
|
||||||
|
A Link Embed is an embed showing a preview of any linked site in a message.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
{
|
||||||
|
url, // the URL of the link
|
||||||
|
type : "link",
|
||||||
|
title, // title of the embed/URL
|
||||||
|
thumbnail : {
|
||||||
|
width, // the width of the thumbnail in pixels
|
||||||
|
height, // the height of the thumbnail in pixels
|
||||||
|
url, // the direct URL to the thumbnail
|
||||||
|
proxy_url, // a proxy URL to the thumbnail
|
||||||
|
},
|
||||||
|
provider : {
|
||||||
|
url, // ???
|
||||||
|
name, // ???
|
||||||
|
},
|
||||||
|
description, // description of the embed
|
||||||
|
author : {
|
||||||
|
url, // URL to the author (if any)
|
||||||
|
name // name of the author (if any)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Image Embed
|
||||||
|
-----------
|
||||||
|
|
||||||
|
An Image Embed shows an image of a referenced link
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
{
|
||||||
|
url, // the URL of the image
|
||||||
|
type : "image",
|
||||||
|
title, // title of the embed/image
|
||||||
|
thumbnail : {
|
||||||
|
width, // the width of the thumbnail in pixels
|
||||||
|
height, // the height of the thumbnail in pixels
|
||||||
|
url, // the direct URL to the thumbnail
|
||||||
|
proxy_url, // a proxy URL to the thumbnail
|
||||||
|
},
|
||||||
|
provider : {
|
||||||
|
url, // ???
|
||||||
|
name, // ???
|
||||||
|
},
|
||||||
|
description, // description of the embed
|
||||||
|
author : {
|
||||||
|
url, // URL to the author (if any)
|
||||||
|
name // name of the author (if any)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Video Embed
|
||||||
|
-----------
|
||||||
|
|
||||||
|
A Video Embed embeds videos (e.g. youtube)
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
{
|
||||||
|
url, // the URL of the image
|
||||||
|
type : "image",
|
||||||
|
title, // title of the embed/image
|
||||||
|
thumbnail : {
|
||||||
|
width, // the width of the thumbnail in pixels
|
||||||
|
height, // the height of the thumbnail in pixels
|
||||||
|
url, // the direct URL to the thumbnail
|
||||||
|
proxy_url, // a proxy URL to the thumbnail
|
||||||
|
},
|
||||||
|
provider : {
|
||||||
|
url, // ???
|
||||||
|
name, // ???
|
||||||
|
},
|
||||||
|
description, // description of the embed
|
||||||
|
author : {
|
||||||
|
url, // URL to the author (if any)
|
||||||
|
name // name of the author (if any)
|
||||||
|
},
|
||||||
|
video : {
|
||||||
|
width, // the width of the embedded video player
|
||||||
|
height, // the height of the embedded video player
|
||||||
|
url // the URL of the embedded play
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ A `String` UUID of the message, will never change.
|
|||||||
embeds
|
embeds
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
A raw, unhandled `JSON object` that will contain embeds of the message - if any.
|
An `Array` of Embed_ objects.
|
||||||
|
|
||||||
editedTimestamp
|
editedTimestamp
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ Contents:
|
|||||||
docs_message
|
docs_message
|
||||||
docs_invite
|
docs_invite
|
||||||
docs_permissions
|
docs_permissions
|
||||||
|
docs_embed
|
||||||
|
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
|
|||||||
@@ -15,4 +15,5 @@
|
|||||||
.. _ChannelPermissions : ./docs_permissions.html#id3
|
.. _ChannelPermissions : ./docs_permissions.html#id3
|
||||||
.. _EvaluatedPermissions : ./docs_permissions.html#id6
|
.. _EvaluatedPermissions : ./docs_permissions.html#id6
|
||||||
.. _Member : ./docs_member.html
|
.. _Member : ./docs_member.html
|
||||||
.. _Colors : ./docs_module.html#discord-colors
|
.. _Colors : ./docs_module.html#discord-colors
|
||||||
|
.. _Embed : ./docs_embed.html
|
||||||
@@ -45,7 +45,7 @@ mybot.once("ready", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mybot.on("messageUpdate", function(newMessage, oldMessage){
|
mybot.on("messageUpdate", function(newMessage, oldMessage){
|
||||||
// links and videos will create a loop
|
mybot.reply(newMessage, JSON.stringify(newMessage.embeds));
|
||||||
})
|
})
|
||||||
|
|
||||||
mybot.on("serverUpdate", function (oldserver, newserver) {
|
mybot.on("serverUpdate", function (oldserver, newserver) {
|
||||||
|
|||||||
Reference in New Issue
Block a user