All Projects → EQUENOS → dislash.py

EQUENOS / dislash.py

Licence: MIT license
A Python wrapper for discord slash-commands and buttons, designed to extend discord.py.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to dislash.py

slash-commands
slash commands handler to make your bot support slash commands.
Stars: ✭ 59 (-65.7%)
Mutual labels:  discord-api, context-menu, slash-commands
DiscordBot-Template
A boilerplate / template for discord.js bots with 100% coverage of Discord API, command handler, error handler based on https://discordjs.guide/
Stars: ✭ 129 (-25%)
Mutual labels:  discord-api, buttons, slash-commands
reactionmenu
A library to create a discord paginator. Supports pagination with Discords Buttons feature and reactions.
Stars: ✭ 68 (-60.47%)
Mutual labels:  components, buttons, discord-py
hata
Async Discord API wrapper.
Stars: ✭ 156 (-9.3%)
Mutual labels:  discord-api, slash-commands
miso-bot
Discord bot with too many features
Stars: ✭ 41 (-76.16%)
Mutual labels:  discord-api, discord-py
discord-ui
A discord.py extension for sending, receiving and handling ui interactions in discord
Stars: ✭ 28 (-83.72%)
Mutual labels:  discord-api, discord-py
discord-super-utils
A modern python module including many useful features that make discord bot programming extremely easy.
Stars: ✭ 106 (-38.37%)
Mutual labels:  discord-api, discord-py
Eruditus
Discord CTF helper bot for CyberErudites
Stars: ✭ 34 (-80.23%)
Mutual labels:  discord-py, slash-commands
gencord
A simple, beginner-friendly, and easy-to-use library for interacting with the Discord API, with minimal syntax.
Stars: ✭ 20 (-88.37%)
Mutual labels:  discord-api, slash-commands
opensource-discordbots
Curated list of awesome open-source Discord Bots
Stars: ✭ 19 (-88.95%)
Mutual labels:  discord-api, discord-py
Karuma
Karuma is a Discord Bot including Nukes, Raids, Mass DM and other features. Only for educational purposes 🥱🚀
Stars: ✭ 132 (-23.26%)
Mutual labels:  discord-api, discord-py
nextcord
A Python wrapper for the Discord API forked from discord.py
Stars: ✭ 956 (+455.81%)
Mutual labels:  discord-api, discord-py
Axley
A simple multi-purpose Discord bot being made using Discord.py API wrapper..
Stars: ✭ 16 (-90.7%)
Mutual labels:  discord-api, discord-py
mass-dm-discord
A MassDM selfbot which is working in 2021. Only for educational purposes 🥱🚀
Stars: ✭ 87 (-49.42%)
Mutual labels:  discord-api, discord-py
hikari
A Discord API wrapper for Python and asyncio built on good intentions.
Stars: ✭ 631 (+266.86%)
Mutual labels:  discord-api, slash-commands
discord-ext-slash
Support slash commands with an extension to Rapptz/discord.py
Stars: ✭ 18 (-89.53%)
Mutual labels:  discord-py, slash-commands
slshx
⚔️ Strongly-typed Discord commands on Cloudflare Workers
Stars: ✭ 163 (-5.23%)
Mutual labels:  discord-api, slash-commands
Peribot
This is a jack of all trades Discord bot that I maintain with a focus on enhancing any community it is invited to. Inspired by the Steven Universe character "Peridot", Peribot is comprised of over 30 cogs and with more on the way! This bot can be deployed by anyone who wants to customize its appearance or functionality to fit better with a commu…
Stars: ✭ 14 (-91.86%)
Mutual labels:  discord-api, discord-py
tesserae
Components for building h5-based single-page-applications using C#
Stars: ✭ 23 (-86.63%)
Mutual labels:  components
render react
Pre-render and mount React components from Ruby
Stars: ✭ 14 (-91.86%)
Mutual labels:  components

Warning

This library is no longer maintained in favor of disnake. Disnake is an updated version of discord.py with the latest API features implemented. The syntax for slash commands is very convenient so we really recommend using disnake if you're planning to switch to slash commands before April 2022.

If you have any questions, join Our Discord Server

dislash.py

Discord PyPi Python

An extending library for discord.py that allows to build awesome message components and slash commands.

Note about the future of discord.py

Since discord.py will no longer stay up to date, we decided to create a fork: disnake. It has all features of dpy 2.0 + application commands.

Table Of Contents

  1. Installation
  2. Features
  3. Examples
  4. Creating a slash command
  5. Creating Buttons
  6. Creating Menus
  7. Creating context menus
  8. Links
  9. Downloads

Installation

Run any of these commands in terminal:

pip install dislash.py
python -m pip install dislash.py

Features

  • Supports automatic registration of slash-commands
  • Supports manual and automatic sharding
  • Convenient decorator-based interface
  • Works with discord.py <=1.7.3, >=2.0.0a

Examples

💡 This library requires discord.py.

Creating a slash command

from discord.ext import commands
from dislash import InteractionClient

bot = commands.Bot(command_prefix="!")
inter_client = InteractionClient(bot, test_guilds=[12345, 98765])
# If 'test_guilds' param isn't specified, the commands are registered globally.
# Global registration takes up to 1 hour.

@inter_client.slash_command(
    name="hello", # Defaults to the function name
    description="Says hello",
    guild_ids=test_guilds
)
async def hello(inter):
    await inter.reply("Hello!")

bot.run("BOT_TOKEN")

Creating buttons

This example shows how to send a message with buttons.

from discord.ext import commands
from dislash import InteractionClient, ActionRow, Button, ButtonStyle

bot = commands.Bot(command_prefix="!")
inter_client = InteractionClient(bot)

@bot.command()
async def test(ctx):
    # Make a row of buttons
    row_of_buttons = ActionRow(
        Button(
            style=ButtonStyle.green,
            label="Green button",
            custom_id="green"
        ),
        Button(
            style=ButtonStyle.red,
            label="Red button",
            custom_id="red"
        )
    )
    # Send a message with buttons
    msg = await ctx.send(
        "This message has buttons!",
        components=[row_of_buttons]
    )
    # Wait for someone to click on them
    def check(inter):
        return inter.message.id == msg.id
    inter = await ctx.wait_for_button_click(check)
    # Send what you received
    button_text = inter.clicked_button.label
    await inter.reply(f"Button: {button_text}")

bot.run("BOT_TOKEN")

Creating menus

This example shows how to send a message with a menu.

from discord.ext import commands
from dislash import InteractionClient, SelectMenu, SelectOption

bot = commands.Bot(command_prefix="!")
inter_client = InteractionClient(bot)

@bot.command()
async def test(ctx):
    msg = await ctx.send(
        "This message has a select menu!",
        components=[
            SelectMenu(
                custom_id="test",
                placeholder="Choose up to 2 options",
                max_values=2,
                options=[
                    SelectOption("Option 1", "value 1"),
                    SelectOption("Option 2", "value 2"),
                    SelectOption("Option 3", "value 3")
                ]
            )
        ]
    )
    # Wait for someone to click on it
    inter = await msg.wait_for_dropdown()
    # Send what you received
    labels = [option.label for option in inter.select_menu.selected_options]
    await inter.reply(f"Options: {', '.join(labels)}")

bot.run("BOT_TOKEN")

Creating context menus

This example shows how to create context menus and interact with them.

from discord.ext import commands
from dislash import InteractionClient

bot = commands.Bot(command_prefix="!")
inter_client = InteractionClient(bot)

@inter_client.user_command(name="Press me")
async def press_me(inter):
    # User commands are visible in user context menus
    # They can be global or per guild, just like slash commands
    await inter.respond("Hello there!")

@inter_client.message_command(name="Resend")
async def resend(inter):
    # Message commands are visible in message context menus
    # inter is instance of ContextMenuInteraction
    await inter.respond(inter.message.content)

bot.run("BOT_TOKEN")

Links

Downloads

Downloads Downloads Downloads

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].