Simple Discord Slash Command extension for discord.py.
Project description
discord-py-slash-command
Simple Discord Slash Command extension for discord.py.
Example
Normal usage:
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from discord_slash.model import SlashContext
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
slash = SlashCommand(bot)
@slash.slash(name="test")
async def _test(ctx: SlashContext):
embed = discord.Embed(title="embed test")
await ctx.send(content="test", embeds=[embed])
bot.run("discord_token")
Cog:
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from discord_slash import SlashContext
class Slash(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.slash = SlashCommand(bot, override_type=True)
# Cog is only supported by commands ext, so just skip checking type.
@self.slash.slash(name="test")
async def _test(ctx: SlashContext):
await ctx.send(content="Hello, World!")
def cog_unload(self):
self.slash.remove()
def setup(bot):
bot.add_cog(Slash(bot))
Installation
pip install -U discord-py-slash-command
Simple note before you use this
Since slash command feature is not officially released,
there will be many breaking changes to this extension and may be unstable,
so I'd recommend waiting until discord officially releases slash command,
and wait until Release 1.1.0, which I'm planning to finish implementing most of the feature.
Or you can wait until discord.py supports slash command.
DOCS
https://discord-py-slash-command.readthedocs.io/en/latest/
See discord-api-docs for some more information
about some formats.
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
File details
Details for the file discord-py-slash-command-1.0.3.tar.gz
.
File metadata
- Download URL: discord-py-slash-command-1.0.3.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be32ee9413e0eeca015f0402974bd4955860958733a1566142ec5bab6d551d1e |
|
MD5 | a5df30301dcbcbc1d437a76655e360b7 |
|
BLAKE2b-256 | 496107a076648a6b5d6f30abb33feae9ed4b12f6f9e4cffb36194ffd4f5fea1b |
File details
Details for the file discord_py_slash_command-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: discord_py_slash_command-1.0.3-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60f71e0ce15a8f12f08776df1669e5060d00bede5890c6b0433f0396a3ed7f36 |
|
MD5 | 716e26e2ad4d1d81e12476596f1d0bc4 |
|
BLAKE2b-256 | a2b7b2076120487ba290296526bffb0e5005c66467d2739701c18d3708bdde98 |