Running the bot and using the command in Discord will return the embed with the author information filled in. In action, this will look something like this: t_author(name= "RealDrewData", url= "", icon_url= "") Icon_URL: a string with the URL location of the picture to use in the author icon Url: a string with a link for the author text For the author, there are 3 arguments to know: set_author() method on it to add the information for the author. Once we have our initial embed object, we can use the. The author is the text at the very top, and the icon is the circle next to that. To turn the example blue, you would change it like this (change in bold): async def embed( ctx):Įmbed=discord.Embed(title= "Sample Embed", url= "", description= "This is an embed that will show how to build an embed and the different components", color=**()**)Ī full list of the color classmethods available for color in Discord.py are available in the documentation. To use the built in colors, you just use the classmethod of that color's name. You can continue to look up HEX color codes with a tool like Google's Color Picker, or you can use the built in colors inside discord.Color. You have multiple options when it comes to colors. Go to the server where you joined your bot. In the command build the initial embed object like so: async def embed( ctx):Įmbed=discord.Embed(title= "Sample Embed", url= "", description= "This is an embed that will show how to build an embed and the different components", color= 0xFF5733) All this command will do is build the embed and send it to the channel. Let's create a new command in the bot code. This will color the left edge of the embed. This is the darker 2 red lines aboveĬolor: a color object. When you click on title in the final embed it will take you to this linkĭescription: a string to set the description. Url: a string to set the link for the title. This is the first line on our blank embed We will be using 4 arguments to get started: When creating an embed, you need to initialize an embed object using the Embed() function from the discord package. Title, Description, and color (color is the bar to the left side) You'll know how to make this embed by the end of the tutorial! There are multiple pictures, links, and text fields that we are able to edit. The embed below is similar to what we will be making. In this tutorial we will go through how to create an embed and customize every part of it. Building EmbedsĮmbeds in Discord are simple and have a very clean, formatted look to them. It is recommended that you migrate your code to a more current version. You will encounter issues if you are using a version lower than 1.0. Note: This is tested on version 1.4.1 of the Discord.py module. Python Discord Bots: Formatting Text: How to add rich formatting to Python Discord bots With Python and Discord.py, this is super easy to do in your Discord bot! Maybe you have links or images that you want to send back in chat. When your Discord bot responds to your server, you don't always want a boring default message to be sent back.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |