Message commands in interactions.py! A port of dis-snek's molter.
Project description
interactions-molter
Message commands in interactions.py! A port of dis-snek
's molter
.
This attempts to make the message command experience much like discord.py
's message 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.
Installation
pip install git+https://github.com/Astrea49/interactions-molter.git
Example
Standalone
import interactions
from interactions.ext import molter
bot = interactions.Client(
token="TOKEN",
intents=interactions.Intents.DEFAULT | interactions.Intents.GUILD_MESSAGE_CONTENT,
)
molt = molter.Molter(bot)
@molt.msg_command(aliases=["test2"])
async def test(ctx: molter.MolterContext, some_var: int):
await ctx.reply(str(some_var))
bot.start()
Extension
import interactions
from interactions.ext import molter
# very important to use the below instead of Extension
# message commands will not work otherwise
class Extend(molter.MolterExtension):
def __init__(self, bot: interactions.Client):
self.bot = bot
@molter.msg_command()
async def soup(self, ctx: molter.MolterContext):
await ctx.reply("give soup")
def setup(bot: interactions.Client):
Extend(bot)
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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 623caae0860713ca46d989734f7dbf3711005bdf78225990e172bcfc76f8bc2a |
|
MD5 | adf49968ccec7e327239bb3c0d10de42 |
|
BLAKE2b-256 | b4332e4e4946054691b72d082a6e29e21be6e869b55222eceafa4f1c6e1de00d |
Hashes for interactions_molter-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56b1cc0edf029cd038cc96db46b991efe0397b1ceb957663126f8a1604519fa3 |
|
MD5 | 750f203c825c3d9ef7809a673c039abf |
|
BLAKE2b-256 | 1dec046d2ad45dd872ac15d5f7082149884e952ad8d79f8af1ba3f687a2d331e |