Quickstart
Installation
Enter one of these commands to install the library:
pip install dislash.py
python -m pip install dislash.py
Or just clone the repo: https://github.com/EQUENOS/dislash.py
Creating a simple command
Let’s make a /hello command that will send “Hello!” to the chat.
from discord.ext import commands
from dislash import InteractionClient
bot = commands.Bot(command_prefix="!")
# test_guilds param is optional, this is a list of guild IDs
inter_client = InteractionClient(bot, test_guilds=[12345])
@inter_client.slash_command(description="Says Hello")
async def hello(ctx):
await ctx.send("Hello!")
bot.run("BOT_TOKEN")
Note
Per-guild registration is instant, while global registration takes up to 1 hour to complete.
In order to register a command globally, do not specify the
test_guilds
/ guild_ids
parameters.And here we go! We’ve just made a simple slash-command named /hello
More examples
Note
For more examples, see Examples