Skip to main content

A small wrapper for easy creation of discord.py Embeds and sending/editing of Messages including those Embeds

Project description

DISCLAIMER!

This package is only vaguely tested.

Installing

Python 3.6 or higher is required

other than that it's just as simple as

pip install discord.py-embed-wrapper
from embed_wrapper import *

Wrapper Classes - Examples/Usage

EmbedField

to create an EmbedField object

wrapped_field = EmbedField(name=field_name, value=field_value, inline=field_inline)

and then use it in the initialisation of an EmbedWrapper

EmbedWrapper

embed_wrapper = EmbedWrapper(
    author_name=author_name, author_url=author_url, author_icon_url=author_icon_url,
    embed_type=embed_type, title=title, url=url, color=color, description=description,
    timestamp=timestamp,
    footer_text=footer_text, footer_icon_url=footer_icon_url,
    image_url=image_url, thumbnail_url=thumbnail_url,
    fields=[wrapped_field]
)

to finalize and instantiate the embed from the wrapper call

embed = embed_wrapper.embed

Helper Functions - Examples/Usage

embeds_from_message

Creates a List of Embeds from a give Message. Returns None if the given Message didn't have any Embeds.

def embeds_from_message(message: Message) -> Optional[List[Embed]]:
    ...

embeds = embeds_from_message(message=message)

send_embed_message

Sends a Message including an Embed to either a Guild TextChannel or a DMChannel and returns the sent Message.

async def send_embed_message(
        embed: Embed,
        invoking_message: Message,
        as_reply: bool = False,
        as_dm: bool = False,
        dm_channel: DMChannel = None,
        pin: bool = False,
        message_content: str = "",
        reactions: List[str] = None,
        mentions: List[Union[User, Member, Role]] = None,
        append_mentions: bool = False
) -> Message:
...

simplest usage

embed_message = await send_embed_message(embed=embed, invoking_message=message)

Sends an Embed Message only containing the embed in the same channel it was invoked.

edit_embed_message

Edits a given Embed Message with a new Embed and optionally new Message Content and returns the edited Message. Pass None as the Embed to remove it.

async def edit_embed_message(
        embed: Embed,
        message: Message,
        message_content: Optional[str],
) -> Message:
...

usage

embed_message = await edit_embed_message(embed=embed, message=embed_message)

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

discord.py-embed-wrapper-0.0.9.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

discord.py_embed_wrapper-0.0.9-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file discord.py-embed-wrapper-0.0.9.tar.gz.

File metadata

  • Download URL: discord.py-embed-wrapper-0.0.9.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.3

File hashes

Hashes for discord.py-embed-wrapper-0.0.9.tar.gz
Algorithm Hash digest
SHA256 95c3e9511de5759cec6a38327e9bd724e7ec029dfb7dec9da4d2b0f13a0744da
MD5 906934b42bc98a96c5e616dfc6320310
BLAKE2b-256 f68d177b22211b6edc047b8b4a9fd37e0f005b16358455e38a7e604186f2c797

See more details on using hashes here.

File details

Details for the file discord.py_embed_wrapper-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: discord.py_embed_wrapper-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.3

File hashes

Hashes for discord.py_embed_wrapper-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f14e7b5441f66de384a10efaabe559415828050e8b7f7fcf98446194b87711e5
MD5 5c552f8989c3b259c47664f2fcadd599
BLAKE2b-256 45d979b51e898fe220d8329a3f7ee822acc78e04f5c0b6f8156cab1df44bcd58

See more details on using hashes here.

Supported by

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