An extension library for interactions.py to add text-based commands! Ported from dis-snek.
Project description
interactions-molter
An extension library for interactions.py to add text-based (AKA message or prefix) commands! Ported from 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.
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
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.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e843f1c98a489959148dff02b14c228391e8a32450caf0520411fa70ad65eea4 |
|
MD5 | 23498e58dc546f4637397d10ded1a935 |
|
BLAKE2b-256 | 8d3cf8d78b2e571314839b337b257ace82249d21745b6312079423490396f913 |
Hashes for interactions_molter-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac16c39267d8ebb8be4133f524dc91b74ee9041e043c9964ca6d630b8630e4f6 |
|
MD5 | cc374dde2b19c95a258e205f88249a04 |
|
BLAKE2b-256 | d9d7b49596870e8e5b46c653415c2178c1d3dba8319fda88607a74e943b23f47 |