An extension library for interactions.py to add prefixed commands. A demonstration of molter-core.
Project description
Molter for interactions.py.
An extension library for interactions.py to add prefixed (AKA text-based or 'message') commands. This is a demonstration of the molter framework, a framework for adding prefixed commands into Discord Python libraries.
This attempts to make the prefixed command experience much like discord.py
's prefixed commands, though it is not 1:1 on purpose.
NOTE: This extension is primarily developed by Astrea49. Direct questions about this to her, please!
Installation
pip install interactions-molter
Example
Standalone
import interactions
from interactions.ext import molter
client = interactions.Client(
token="TOKEN",
intents=interactions.Intents.DEFAULT | interactions.Intents.GUILD_MESSAGE_CONTENT,
)
molt = molter.setup(client)
@molt.prefixed_command(aliases=["test2"])
async def test(ctx: molter.MolterContext, some_var: int):
await ctx.reply(str(some_var))
client.start()
Extension
import interactions
from interactions.ext import molter
# very important to use the below instead of Extension
# it's a subclass of it, so application commands will work
# fine, but it's needed for prefixed commands to also work
class Extend(molter.MolterExtension):
def __init__(self, client: interactions.Client):
self.client = client
@molter.prefixed_command()
async def soup(self, ctx: molter.MolterContext):
await ctx.reply("Give soup, please!")
def setup(client: interactions.Client):
Extend(client)
Other examples
To view more examples and understand how molter
works, take a look at the examples
folder in this repository.
Branch Explanation
- The
main
branch is the PyPI version - this branch will never deviate from it. This is done to make sure the PyPI page's example links link to the right code. - The
stable
branch is code considered code that is stable enough to use in daily use, though it is not perfect. This branch also will target any beta, pre-release, or release candidate version ofinteractions.py
, if possible. - The
dev
branch mirrorsinteractions.py
'sunstable
branch, and is also a general testing ground for new and experimental changes. Bugs are common on this branch. If you decide to use this branch, I highly suggest pinning to a specific commit you know is stable.
Credit
Thanks to both NAFF
and Toricane's interactions-message-commands
for a decent part of this! They both had a huge influence over how this port was designed.
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
Hashes for interactions-molter-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc97df85f833fe740b64c94d5a9add4e3010dccbcba177dcad217925a50f49fb |
|
MD5 | 7e89946618ca08663b9f5d5914aeac63 |
|
BLAKE2b-256 | 72703f274b9e079decea7b892775cc4e66becfa649e860321ee09568c54bcfb2 |
Hashes for interactions_molter-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bd38ba61a305b3020a8ece99f0065433dd0b915a87ca221adffc8e5095c458c |
|
MD5 | 8a233b77c4b01d6657b123f27b6b17a6 |
|
BLAKE2b-256 | 0e6f60ea5a02f9018140604a348ec40d7beda835b31bfbb20c6c697192d16b4d |