R
R
RieldaBot2021-12-20 13:20:31
Python
RieldaBot, 2021-12-20 13:20:31

Discord.py | How to do this?

How to implement slash command highlighting through the Discord.py library Screenshot of
what exactly I want:
61c058c7c6ecc114132693.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AlmondPark33609, 2021-12-21
@RieldaBot

bibles:
pip install discord
pip install discord_slash
pip install discord-py-slash-command

import discord
from discord_slash import SlashCommand # Импортируем новую библиотеку

client = discord.Client(intents=discord.Intents.all())
slash = SlashCommand(client, auto_register=True) # Объявляем слэш команды через клиент



@client.event
async def on_ready():
    print("Готов!")

@slash.slash(name="ping", 
    description="Возращает скорость ответа бота",  
    ) 
async def _ping(ctx): # Объявляем новую команду
    await ctx.send(content=f"Pong! ({client.latency*1000}ms)")

client.run("ТОКЕН")

V
Vindicar, 2021-12-20
@Vindicar

discord.py doesn't support slash commands, look at dislash - it's kind of designed to work with discord.py.
Or you can look towards discord.py forks like pycord or nextcord.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question