Added Embed docs

This commit is contained in:
hydrabolt
2015-10-29 18:50:49 +00:00
parent 2d2e2eba22
commit a6411d0eea
5 changed files with 113 additions and 4 deletions

108
docs/docs_embed.rst Normal file
View 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
}
}

View File

@@ -38,7 +38,7 @@ A `String` UUID of the message, will never change.
embeds
~~~~~~
A raw, unhandled `JSON object` that will contain embeds of the message - if any.
An `Array` of Embed_ objects.
editedTimestamp
~~~~~~~~~~~~~~~

View File

@@ -42,7 +42,7 @@ Contents:
docs_message
docs_invite
docs_permissions
docs_embed
Indices and tables

View File

@@ -15,4 +15,5 @@
.. _ChannelPermissions : ./docs_permissions.html#id3
.. _EvaluatedPermissions : ./docs_permissions.html#id6
.. _Member : ./docs_member.html
.. _Colors : ./docs_module.html#discord-colors
.. _Colors : ./docs_module.html#discord-colors
.. _Embed : ./docs_embed.html

View File

@@ -45,7 +45,7 @@ mybot.once("ready", function () {
});
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) {