From 16257d6f48654f2514fd64c18841318889fe427c Mon Sep 17 00:00:00 2001 From: "Jari (LotU)" <18392003+MrLotU@users.noreply.github.com> Date: Wed, 24 Jan 2018 08:58:04 +0100 Subject: [PATCH] Update message_embeds.md --- docs/bot_tutorial/message_embeds.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/bot_tutorial/message_embeds.md b/docs/bot_tutorial/message_embeds.md index 3530fe7..41ac400 100644 --- a/docs/bot_tutorial/message_embeds.md +++ b/docs/bot_tutorial/message_embeds.md @@ -1,22 +1,21 @@ # Message Embeds -A [Message Embed](https://b1naryth1ef.github.io/disco/api/disco_types_message.html#messageembed) represents a Discord Embed object. An Embed object is used to display certain data, in a more layed out and pretty way than regular Discord messages. +A [Message Embed](https://b1naryth1ef.github.io/disco/api/disco_types_message.html#messageembed) represents a Discord Embed object. An Embed object is another component of Discord messages that can be used to present data with special formatting and structure. An example of a message embed: -![alt text](https://i.stack.imgur.com/HRWHk.png "A discord embed") +![A discord embed](https://i.stack.imgur.com/HRWHk.png "A discord embed") -An embed can contain the following buildstones: +An embed can contain the following components: * Author, including link and avatar * Title * Description * Field(s) * Thumbnail image * Image -* Footer text -* Footer icon +* Footer, including text and icon * Timestamp -Next to these, you can set the embeds color, which will set the color of the left sidebar of the embed. +* Color (sets the color of the left sidebar of the embed) ## Creating an embed Creating an embed is simple, and can be done like this: @@ -40,21 +39,21 @@ embed.add_field(name='Inline field 3', value='Third value for the third field', embed.add_field(name='A non-inline field', value='You can only have a max of 3 inline field on 1 line', inline=False) embed.description = 'This is the general description of the embed, you can use the Discord supported MD in here too, to make it look extra fancy. For example, creating some **bold** or ~~strikethrough~~ text.' ``` -Last up, let's set a footer, color and add a timestamp +Last up, let's set a footer, color and add a timestamp: ```py embed.timestamp = datetime.utcnow().isoformat() embed.set_footer(text='Disco Message Embeds tutorial') embed.color = '10038562' #This can be any color, but I chose a nice dark red tint ``` -Once your embed is finshed, you can send it using the `channels_messages_create()` message or the `event.msg.reply()` function in a command like this: -with `channels_messages_create()`: +Once your embed is finshed, you can send it using the `channel.send_message()` message or the `event.msg.reply()` function. +With `channel.send_message()`: ```py -self.bot.client.api.channels_messages_create(, '', embed=embed) +self.bot.state.channels.get().send_message('[optional text]', embed=embed) ``` with the `event.msg.reply()` function: ```py -event.msg.reply('', embed=embed) +event.msg.reply('[optional text]', embed=embed) ``` The final embed we created in this tutorial would look like this: