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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8f324b6aedd6bf4d8f9c75ee6878e6e00fa537d5dd5c7da44dbb63496feb8b1 |
|
MD5 | ddd7651226ed210c186b39fc71696587 |
|
BLAKE2b-256 | 976bfd7633c7fbb2af3adfe2484157c41338b3994f84510c99a6a61956d088c1 |
Hashes for interactions_molter-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83c84539dbd62dcde07d849115382ad8296cd57a3343981d129993cbb6be201d |
|
MD5 | 4bcec99c39a52280428437584a082eef |
|
BLAKE2b-256 | 1990cb7afb2026483ba192bb54df5e9ab9d0208b193ce91bb4cfb3c4cab315f7 |