Skip to main content

Cool idiomatic discord.py embed builder with a lot of features

Project description

Discord EmbedBuilder

Does a lot of shit and simplifies discord's annoying and lengthy embed creation process.

Installation

pip install py-embedbuilder

From there you can just..

Example

import discord
from discord.ext import commands

@bot.command(name="example")
async def example(ctx):
    msg = await EmbedBuilder(ctx) \
        .set_title("Welcome!") \
        .set_description("This is a basic embed") \
        .set_color(discord.Color.blue()) \
        .send()

or

@bot.command(name="example")
async def example(ctx):
    builder = EmbedBuilder(ctx)
    messages = await (builder
                     .set_title("Welcome!")
                     .set_description("This is a basic embed")
                     .set_color(discord.Color.blue())
                     .send())

These both do the exact same thing it's just a matter of preference.

"Quick" explanation of everything you can do

? denotes optional inputs and SHOULD NOT be included in the actual function. If there is no ? it's a required field.

Basic stuff

.set_title("Your title here")
.set_description("Whatever you want to say")
.set_color(discord.Color.red())  # or any color
.set_url("https://example.com")  # makes the title clickable

Author details

Author details (author name, author icon url, author url) are incredibly simple.

.set_author("Cheap Credits", ?icon_url="https://example.com/img.png", ?url="https://cheap.ypuf.xyz")

Footer details

.set_footer("Visit my site!", ?icon_url="https://example.com/img.png")

Fields

These are just normal field inputs so it's title, description and then inline: true/false

.add_field("Look at this number", "17", inline=True)
.add_field("Another field", "Some value", inline=False)

Images and thumbnails

.set_thumbnail("https://example.com/small_image.png")  # small image in top right
.set_image("https://example.com/big_image.png")       # big image at bottom

Files and attachments

.set_file_path("./my_image.png")  # attach a local file
.add_file(discord.File("another_file.txt"))  # or add discord files directly

Message content (outside the embed)

.set_content("This text appears above the embed")

Timestamps

.set_timestamp()  # uses current time
.set_timestamp(some_datetime_object)  # or your own time
.set_timezone('America/New_York')  # change timezone if needed

For slash commands

Works exactly the same but pass the interaction instead of ctx:

@bot.slash_command()
async def slash_example(interaction):
    await EmbedBuilder(interaction) \
        .set_title("Slash command embed") \
        .set_ephemeral(True) \
        .send()  # only the user who ran the command can see it

Long descriptions? No problem

If your description is too long, it'll automatically split it into multiple embeds:

really_long_text = "Lorem ipsum..." * 1000

await EmbedBuilder(ctx) \
    .set_title("Long ass message") \
    .set_description(really_long_text) \
    .send()  # automatically creates multiple embeds

Pagination for fancy stuff

Want actual page navigation? Enable pagination:

builder = EmbedBuilder(ctx).enable_pagination()

# Add custom pages
builder.add_page(title="Page 1", description="First page content")
builder.add_page(title="Page 2", description="Second page content")
builder.add_page(title="Page 3", description="Third page content")

await builder.send()  # creates navigation buttons

Other useful shit

Reply to messages

.set_reply(True)   # default behavior (if you're sending to a specific channel it won't reply to the user anyway)
.set_reply(False)  # don't reply, just send normally

Auto-delete messages

.set_delete_after(30)  # deletes after 30 seconds

Edit existing messages instead of sending new ones

old_message = await ctx.send("Loading...")
await EmbedBuilder(ctx) \
    .edit_message(old_message) \
    .set_title("Done!") \
    .send()

Multiple embeds with gradient colors (because why not)

honestly this doesnt have any proper functionality right now but it will i prmise

await EmbedBuilder(ctx) \
    .set_description("Long content that creates multiple embeds") \
    .enable_gradient_colors() \
    .send()  # each embed gets a different color

That's basically it

The library handles all the annoying Discord limits and validation for you. Just chain the methods you want and call .send() at the end.

If something breaks, it'll probably tell you what went wrong instead of just dying silently like Discord's API likes to do.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_embedbuilder-0.1.2a0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_embedbuilder-0.1.2a0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file py_embedbuilder-0.1.2a0.tar.gz.

File metadata

  • Download URL: py_embedbuilder-0.1.2a0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for py_embedbuilder-0.1.2a0.tar.gz
Algorithm Hash digest
SHA256 acbd0934ce567753aa1d200c618e0c08c0468a85a2e758bb446e7d87450666f6
MD5 eaa43b588370618569445b04682cfff6
BLAKE2b-256 8b48c32f76f1272e552cbce456bdb3e66421cb3e53d36a9f0f29c199145e156d

See more details on using hashes here.

File details

Details for the file py_embedbuilder-0.1.2a0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_embedbuilder-0.1.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 27282aa0e5ccea1fea60417c2b0c405ca08d77e865c267dfa32d6c754ef1498f
MD5 4341a584acf0a377c6d79e686ba12627
BLAKE2b-256 7a41a0df2cc674d56df64bc0788b52ea295e0fec2d472546f971ba0d53fe32f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page