Skip to main content

discord-styled-text

A small library to style text for Discord without having to remember any syntax

PyPI PyPI - Python Version PyPI - License Documentation Status

Installation

discord-styled-text requires Python 3.6 at minimum.

$ pip install discord-styled-text

Documentation

Documentation is available on ReadTheDocs.

Example Usage

>>> from discord_styler import *

>>> bold_text = Bold("Here's some bold text")
>>> italic_text = Italic("and here's some", Underline("italic text"), "with nested styles!")
>>> text = StyledText("We can combine them:", bold_text, italic_text)
>>> str(text)
"We can combine them: **Here's some bold text** *and here's some __italic text__ with nested styles!*"

>>> quoted = StyledText(BlockQuote(text), "and we can do quotes too")
>>> str(quoted)
"> We can combine them: **Here's some bold text** *and here's some __italic text__ with nested styles!*\n and we can do quotes too"

>>> question = StyledText(
...     UserMention(200102491231092736),
...     f"will you be free at {TimeStamp(1618953630, TimeStyle.LongDateTime)}?",
...     f"I'll be doing code review in {ChannelMention(656893570711814145)} if you wanna join")
>>> str(question)
"<@200102491231092736> will you be free at <t:1618953630:F>? I'll be doing code review in <#656893570711814145> if you wanna join"

>>> link = NonEmbeddingURL("https://github.com/miaowware/discord-styled-text/pull/1")
>>> str(link)
'<https://github.com/miaowware/discord-styled-text/pull/1>'

>>> code = StyledText(
...     "What do you think of this?\n",
...     CodeBlock('def __str__(self) -> str:\n        return "||" + super().__str__() + "||"', lang="py"))
>>> str(code)
'What do you think of this?\n ```py\ndef __str__(self) -> str:\n        return "||" + super().__str__() + "||"\n```'

The output of the example, rendered in Discord

Copyright 2021 classabbyamp, 0x5c
Released under the BSD 3-Clause License.
See LICENSE for the full license text.

Metadata

Release files for discord-styled-text 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discord-styled-text 1.0.0
File Size Uploaded Provenance Actions
discord-styled-text-1.0.0.tar.gz 6.4 kB Without provenance Details for discord-styled-text-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for discord-styled-text 1.0.0
File Interpreter ABI Platform Actions
discord_styled_text-1.0.0-py3-none-any.whl Python 3 none any Details for discord_styled_text-1.0.0-py3-none-any.whl

Total release size: 14.5 kB

Release files / discord-styled-text-1.0.0.tar.gz

Download URL discord-styled-text-1.0.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
68c7446ea829ab5abba047066d25b72cd889a9ce16c4fb961e59b711e2fed4ea
BLAKE2b-256 checksum
How to use checksums
9d388f1c6a617c594a5452ff6cd368ef72f82ec5d925ee3171f8319fd6d75423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.14

Release files / discord_styled_text-1.0.0-py3-none-any.whl

Download URL discord_styled_text-1.0.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf4f29c6f3163af7262d857790447c2aa725c7e06df34f5f88e3603a67cc0801
BLAKE2b-256 checksum
How to use checksums
92dc45ce8be12463b4168509ee535887f8f544c7a786ff8ce95999132c4ef595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.14

Security for discord-styled-text 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page