Embed Templates

You can set embed templates that can be used to send error messages, warnings, and other messages. If you don’t set any custom templates, default templates will be used.

More information can be found in the Embed Documentation.

import discord

from ezcord import Bot, emb

# override the default error embed with a custom one
error_embed = discord.Embed(title="Error", color=discord.Color.orange())
error_embed.set_footer(text="This is a custom footer")

emb.set_embed_templates(error_embed=error_embed)


bot = Bot()


@bot.slash_command()
async def hey(ctx):
    await emb.error(ctx, "Error message")
    await emb.info(ctx, "Info message", title="Info Title")  # set an embed title


if __name__ == "__main__":
    bot.run("TOKEN")  # Replace with your bot token
  1. Pass a string to the error() method to send an error message.

    Note

    The string will be used as the description of the error embed.

  2. The final embed will be sent as an interaction response or a normal message, depending on the target type.