diff --git a/docs/docs_embed.rst b/docs/docs_embed.rst new file mode 100644 index 000000000..f033430d5 --- /dev/null +++ b/docs/docs_embed.rst @@ -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 + } + } \ No newline at end of file diff --git a/docs/docs_message.rst b/docs/docs_message.rst index 9be63139a..335f71709 100644 --- a/docs/docs_message.rst +++ b/docs/docs_message.rst @@ -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 ~~~~~~~~~~~~~~~ diff --git a/docs/index.rst b/docs/index.rst index e89ef708d..6f8842c65 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -42,7 +42,7 @@ Contents: docs_message docs_invite docs_permissions - + docs_embed Indices and tables diff --git a/docs/vars.rst b/docs/vars.rst index f276167e2..1e3ed4dc4 100644 --- a/docs/vars.rst +++ b/docs/vars.rst @@ -15,4 +15,5 @@ .. _ChannelPermissions : ./docs_permissions.html#id3 .. _EvaluatedPermissions : ./docs_permissions.html#id6 .. _Member : ./docs_member.html -.. _Colors : ./docs_module.html#discord-colors \ No newline at end of file +.. _Colors : ./docs_module.html#discord-colors +.. _Embed : ./docs_embed.html \ No newline at end of file diff --git a/test/bot.1.js b/test/bot.1.js index 128b8506d..cbf0d1afd 100644 --- a/test/bot.1.js +++ b/test/bot.1.js @@ -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) {