Create and send custom embed to a channel programatically using custom commands bot
To create a embed and send it to a channel programmitically using pre hook
Md Shahriyar Alam
2 years ago
Construct Embed
Custom commands bot has its own way of defining Embeds, Follow the instructions below.
py
myEmbed = Message(
content="Message outside embed",
title="This is title",
url="https://ccbot.app", # A link thats clickable on title
description="This is just a description",
color=0xffffff, # Any hex code here followed by `0x`
fields=[
("Field Title", "Field Value", true), # last one is inline value can be true or false
("Another Field", "This is awesome", true),
],
image="https://i.ibb.co/XpK0FLG/slash-commands.png", # Any image here
thumbnail="https://i.ibb.co/XpK0FLG/slash-commands.png", # Any image here
footer="This is footer text",
footer_icon="https://i.ibb.co/XpK0FLG/slash-commands.png", # Icon shows beside footer
timestamp=interaction.created_at, # For current time
author=user.username,
author_icon=user.avatar_url,
author_url="https://ccbot.app"
)Send the embed
py
send_message(channel_id, myEmbed)Both code must be in pre or post hook.
Loading comments…
Need help?
Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.