Discord templating engine built on discord.py, to help separate text of embeds from the source code. Inspired by Flask.
Key Features:
- use of xml files to hold the various template responses
- allows for pagination, in an abstract form simplifying the interface in the source code
:gear: Installing:
Python3.8 or higher is required
:test_tube: Tests
To run the tests, run the following command in the root directory:
Windows:
python -m unittest tests -v
Linux:
python3 -m unittest tests -v
:zap: Usage
This is explained in more detail in the wiki
Wrap expressions that need to evaluated with {}, such as {player.name} or {todays_date}
Sample XML file:
<discord>
<message key="test_key">
<embed>
<title>Test</title>
<description>Test Description</description>
<colour>magenta</colour>
<timestamp format="%Y-%m-%d %H:%M:%S.%f">{todays_date}</timestamp>
<url>https://www.discord.com</url>
<fields>
<field>
<name>Test Field</name>
<value>Test Text</value>
</field>
</fields>
<footer>
<text>Test Footer</text>
<icon>https://cdn.discordapp.com/embed/avatars/0.png</icon>
</footer>
<thumbnail>https://cdn.discordapp.com/embed/avatars/0.png</thumbnail>
<image>https://cdn.discordapp.com/embed/avatars/0.png</image>
<author>
<name>Test Author</name>
<icon>https://cdn.discordapp.com/embed/avatars/0.png</icon>
<url>https://discordapp.com</url>
</author>
</embed>
<view>
<components>
<button key="understood_button">
<label>Understood</label>
<style>success</style>
</button>
</components>
</view>
</message>
</discord>
using the above xml file, for example, you can create an embed with the following code:
import datetime
from typing import Literal
import discord
from discord.ext import commands
import qalib
from qalib.template_engines import formatter
bot = commands.AutoShardedBot(command_prefix="!", intents=discord.Intents.all())
Messages = Literal["test_key"]
async def acknowledged(interaction: discord.Interaction):
await interaction.response.send_message("Acknowledged", ephemeral=True)
@bot.command()
@qalib.qalib_context(formatter.Formatter(), "templates/test.xml")
async def test(ctx: qalib.QalibContext[Messages]):
callables = {"understood_button": acknowledged}
await ctx.rendered_send("test_key", callables, keywords={
"todays_date": datetime.datetime.now()
})
Release files for discord-qalib 2.5.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discord_qalib-2.5.14.tar.gz | 30.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discord_qalib-2.5.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 69.7 kB
Release files / discord_qalib-2.5.14.tar.gz
| Download URL | discord_qalib-2.5.14.tar.gz |
|---|---|
| Size | 30.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5902cafec5f829e64f58fff8c1352c01bf747d50e01dd38c18aae49de2261f2d
|
|
BLAKE2b-256 checksum How to use checksums |
17cde945b756bd407df76455fe6028cbcc7086497d66e52c5a85ba5cbfc84e18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.
Transparency logRelease files / discord_qalib-2.5.14-py3-none-any.whl
| Download URL | discord_qalib-2.5.14-py3-none-any.whl |
|---|---|
| Size | 39.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67a712fe503566bfd4dc3cc29c26a75acf6c612d4bfc7d707beaa4747f8df75f
|
|
BLAKE2b-256 checksum How to use checksums |
897bde9ba043a6c1285fc7cf3a7fda60a60c52966503d50ae7fdf446b41e1f32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.
Transparency log