A small library to style text for Discord without having to remember any syntax
Project description
discord-styled-text
A small library to style text for Discord without having to remember any syntax
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```'
Copyright
Copyright 2021 classabbyamp, 0x5c
Released under the BSD 3-Clause License.
See LICENSE
for the full license text.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for discord-styled-text-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68c7446ea829ab5abba047066d25b72cd889a9ce16c4fb961e59b711e2fed4ea |
|
MD5 | 14181d9adfd3eff1a310c85de3d86031 |
|
BLAKE2b-256 | 9d388f1c6a617c594a5452ff6cd368ef72f82ec5d925ee3171f8319fd6d75423 |
Close
Hashes for discord_styled_text-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf4f29c6f3163af7262d857790447c2aa725c7e06df34f5f88e3603a67cc0801 |
|
MD5 | e37a02c434f01360aa84ab87bb827b26 |
|
BLAKE2b-256 | 92dc45ce8be12463b4168509ee535887f8f544c7a786ff8ce95999132c4ef595 |