Simple Discord Slash Command extension for discord.py.
Project description
discord-py-slash-command
Simple Discord Slash Commands extension for discord.py.
Example
Normal usage:
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from discord_slash 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 cog_ext
from discord_slash import SlashCommand
from discord_slash import SlashContext
class Slash(commands.Cog):
def __init__(self, bot):
if not hasattr(bot, "slash"):
# Creates new SlashCommand instance to bot if bot doesn't have.
bot.slash = SlashCommand(bot, override_type=True)
self.bot = bot
self.bot.slash.get_cog_commands(self)
def cog_unload(self):
self.bot.slash.remove_cog_commands(self)
@cog_ext.cog_slash(name="test")
async def _test(self, ctx: SlashContext):
embed = discord.Embed(title="embed test")
await ctx.send(content="test", embeds=[embed])
def setup(bot):
bot.add_cog(Slash(bot))
Installation
pip install -U discord-py-slash-command
Simple note before you use this
Since slash commands are currently not officially released (They're in public beta),
there will be many breaking changes to this extension which may cause it to become unstable,
so I'd recommend waiting until discord officially releases slash commands,
and waiting until Release 1.1.0, which I'm planning to finish implementing most of the features.
Or you can wait until discord.py supports slash commands.
DOCS
https://discord-py-slash-command.readthedocs.io/en/latest/
See discord-api-docs for some more information
about some formats.
Any Questions?
Discord Server
Or you can ask at Discussions.
TODO
- Rewrite
http.py
and webhook part (Maybe use discord.py's webhook support?) - Try supporting most of the features supported by discord.py commands extension
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.8.2.tar.gz
.
File metadata
- Download URL: discord-py-slash-command-1.0.8.2.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61fd39b6a315280ccf169d03aaaa53d141e986857ea39b50ab9ff6a5fba72346 |
|
MD5 | 0d05a8ec5fac6cbe999ef87be2f8f1c3 |
|
BLAKE2b-256 | 44a3ef17856bdcc2322c7125c7458490c5714376950376625be83d69f98de2a8 |
File details
Details for the file discord_py_slash_command-1.0.8.2-py3-none-any.whl
.
File metadata
- Download URL: discord_py_slash_command-1.0.8.2-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2beb44881e4bf63ce45366014b5335585eaa55ff1b14dec488ff32e520fcb224 |
|
MD5 | 1e950705ca9fc5f25fce175dea9d7a59 |
|
BLAKE2b-256 | eb905e407776e139bfbcba0b5d596a993e25e4448a8751caf44205035dde6e79 |