interactions-message-commands
Message commands extension for discord-py-interactions
README IS NOT FINISHED YET BUT IT IS A GOOD START
Installation
pip install -U interactions-message-commands
Usage
Here is the example code for how to use message commands:
import interactions
from interactions.ext.message_commands import MessageCommands, MessageContext
bot = interactions.Client(
token="token here"
)
cmd = MessageCommands(bot, "!")
@cmd.message()
async def ping(ctx):
await ctx.send("pong")
@cmd.message(name="hello")
async def hi(ctx: MessageContext, name: str):
await ctx.send(f"Hello, {name}!")
bot.start()
First, you need to initialize your client.
Next, you need to initialize MessageCommands().
- Multiple string prefixes in a list, tuple, or set is also allowed!
Then, you need to register your message commands.
@cmd.message(): register a message command- Only keyword argument at the time is
nameto override function name nameis optional, if not specified, the function name will be used- In the function,
ctxis required. - You can have as many arguments and keyword arguments as you want!
*argsis supported, but not**kwargs. However,*,is supported.
- Only keyword argument at the time is
Finally, start the bot.
Use message commands in the Discord chat, and the bot will respond!
Example: !ping or !hello John
There is also when_mentioned() and when_mentioned_or() for the prefix:
from interactions.ext.message_commands import MessageCommands, when_mentioned_or
cmd = MessageCommands(bot, when_mentioned_or("!", "?"))
Metadata
Release files for interactions-message-commands 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| interactions-message-commands-0.1.1.tar.gz | 19.3 kB | Without provenance | Details for interactions-message-commands-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| interactions_message_commands-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for interactions_message_commands-0.1.1-py3-none-any.whl |
Total release size: 40.2 kB
Release files / interactions-message-commands-0.1.1.tar.gz
| Download URL | interactions-message-commands-0.1.1.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cf6b89fe1caf673b024c5f55630e7a3344e5867086eb49b252353272d945ce7
|
|
BLAKE2b-256 checksum How to use checksums |
470e5fb746445f0a1b0c9739a7b3b390e1384a7f721b1cd95724c68c167aad03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Release files / interactions_message_commands-0.1.1-py3-none-any.whl
| Download URL | interactions_message_commands-0.1.1-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51368a7e933787c4296e0faf1cb52c1c52b6a4c9a4c900e93d57636e180c0efa
|
|
BLAKE2b-256 checksum How to use checksums |
c4b28dd57e9968d32d103adaf9fa9ac721ae151c0df4130a3b5b83c41c1e3f8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Security for interactions-message-commands 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.