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
Examples
Note
There are more in-depth examples about how molter
works in the examples
folder in this repository. These can be considered the documentation for this extension as of right now, so please take a look at them!
Standalone
import interactions
from interactions.ext import molter
client = interactions.Client(
token="TOKEN",
intents=interactions.Intents.DEFAULT | interactions.Intents.GUILD_MESSAGE_CONTENT,
)
# See examples folder for more information.
# molter.setup(client, default_prefix="!")
molter.setup(client)
@molter.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)
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.6.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a015753de1d7c405b8d38dfde4410aefdf2b9c64b934b56e9e410baeac55e8b |
|
MD5 | 347da35d43365e5293e1e3eb495f21b3 |
|
BLAKE2b-256 | 84da3a351ef85eda8d00af923537a9a3b82207eac5fd727123a9be6d5131dfb9 |
Hashes for interactions_molter-0.6.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b0dc0a66f36141b440b8b3edd07fb4e9541eb940a2913aacdbb88240320518b |
|
MD5 | 714cbae64b6d491810aa838603d86ab9 |
|
BLAKE2b-256 | 409ea8346d60449e79f80dd4776d0a6b8c56a91865138b12029c98f1f7bf269f |