An extension library for interactions.py to add prefixed commands. Ported from dis-snek.
Project description
interactions-molter
An extension library for interactions.py to add prefixed (AKA text-based or 'message') commands. Ported from dis-snek
's molter
.
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 is a work in progress! Some things may be broken, and some things may not work as they should. More features need to be added, too.
NOTE 2: 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
# prefixed commands will not work otherwise
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")
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.
Credit
Thanks to both dis-snek
and Toricane's interactions-message-commands
for a decent part of this! They both had a huge influence over how this port was designed.
TODO
- Add in documentation, or at least fill out docstrings.
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.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5a552746b045304114d06f3f7289de47c7308d56cd5ab0f60bb8edec2c0fe14 |
|
MD5 | 57082989279599b3e500b5dc80b59764 |
|
BLAKE2b-256 | b617b233faa3a5de4f5b79649a99fdb83f9f6fc3ce1d0f8729b41e21bcde21f8 |
Hashes for interactions_molter-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ebd879bea1e165c17fdd37ca1b06c6f09b465a050bc6c5c69b88b7f76accece |
|
MD5 | 54b71d10f007ad6367b8620098dcf1d2 |
|
BLAKE2b-256 | cbed02949358f1fadc429df6b9e52c229325a70a3f322c04cf658947a9f286e3 |