
#Icon bot command discord code#
Our code will look like this to add a field: embed.add_field(name= "Field 1 Title", value= "This is the value for field 1. Inline: boolean specifying whether the field is inline


Value: a string with the body text of the field Name: a string with the title of the field There are 3 arguments that this method can take that you need to know about: When creating embeds, you have the ability to create a number of text fields with more information. Simple as that, our embed now has a thumbnail at the to right. In action, it will look like this: t_thumbnail(url= "")
#Icon bot command discord how to#
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. LinkedIn logo for sharing a link Twitter logo for sharing a link Reddit logo for sharing a link
