'You need to display more than 2 hints in the discord bot using slash commands
Question in English
Hi all. My code is attached below, I want to make the user enter the "/invite" command, it pops up not one argument, but two. An example will be in the screenshots. I did all this via slash commands in discord.py. Help me how to do it
- What do I have: enter image description here
- What do I want enter image description here
I want to have arguments such as "User", "Passport" so that they are in the prompts, but I have an onda prompt, help me decide
My code
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option
client = commands.Bot(command_prefix="!")
slash = SlashCommand(client, sync_commands=True)
token = "Token"
@slash.slash(name = 'invite', description = '[Отчет о принятии] Принятие человека в семью', options = [{
"name": "member",
"description": "пользователь",
"type": 6,
"requied": False,
}], guild_ids = [824998118595887165])
async def invite(ctx:SlashContext):
await ctx.send("World")
client.run(token)
Solution 1:[1]
In order to make the options visible to the slash command user, you have to set required=True.
This forces the user to fill in/select the options required.
Whole code:
@slash.slash(name = 'invite', description = '[????? ? ????????] ???????? ???????? ? ?????', options = [{
"name": "member",
"description": "????????????",
"type": 6,
"requied": True,
},
{
"name": "member",
"description": "????????????",
"type": 6,
"requied": True,
},
{
"name": "member",
"description": "????????????",
"type": 6,
"requied": True,
}], guild_ids = [824998118595887165])
async def invite(ctx:SlashContext):
await ctx.send("World")```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
