#๐Ÿ”’ how to accept parts of msg as parameter

38 messages ยท Page 1 of 1 (latest)

raw narwhal
#

so like i wana do $game @team1 @team2 <time>
and then this would send and embed with this info

sinful matrixBOT
#

@raw narwhal

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

whole ice
#

is this for a discord bot?

raw narwhal
#

yes

whole ice
#

can u send a snippet of code of what u have so far is it using discord.py?

raw narwhal
#

umm like for this??

whole ice
raw narwhal
whole ice
#

oh ok lol

raw narwhal
#

i couldnt figure out how to take multiple things

whole ice
#

so u jut want to have it take multiple paramters right

whole ice
#

u can use slash commands to make it easier

raw narwhal
#

okay

#

but still how can i do this with prefix

#

because like

#

idk maybe its jus me

#

i prefer prefix ๐Ÿ˜ญ

whole ice
#

hol on ill send u an example

raw narwhal
#

okay

whole ice
#

shoot i only have them in slash command srry

#

maybe ask chatgpt idk

raw narwhal
#

๐Ÿ˜ญ

#

well

#

if you can

#

pls jus send that / command thing

#

so i can get refference uk

whole ice
#

sure np

#

this was part of a trivia bot i used to work on

@tree.command(
name='trivia',
description='Play some trivia',
guild=discord.Object(id=--------))
@app_commands.describe(category='Select a category')
@app_commands.choices(category=[
app_commands.Choice(name='Random', value='random'),
app_commands.Choice(name='Animals', value='animals'),
app_commands.Choice(name='Art & Literature', value='art & literature'),
app_commands.Choice(name='Celebrities', value='celebrities'),
app_commands.Choice(name='Entertainment', value='entertainment'),
app_commands.Choice(name='Food', value='food'),
app_commands.Choice(name='Geography', value='geography'),
app_commands.Choice(name='History', value='history'),
app_commands.Choice(name='Science', value='science'),
app_commands.Choice(name='Sports', value='sports'),
app_commands.Choice(name='Technology', value='technology'),
app_commands.Choice(name='Video Games', value='video games')
])
so this basically gives u a list of things to choose from ill also find soemthing that gives u an input field of other sorts

#

and i had this in the begining


intents = Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='$', intents=intents)
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)

raw narwhal
#

thankyouu

#

okay

whole ice
#

alr here so this is what a function that takes in a text value and a list of choices would look like

@tree.command(
    name='trivia',
    description='Play some trivia',
    guild=discord.Object(id=----)
)
@app_commands.describe(
    category='Select a category',
    difficulty='Choose a difficulty (easy, medium, hard)'
)
@app_commands.choices(category=[
    app_commands.Choice(name='Random', value='random'),
    app_commands.Choice(name='Animals', value='animals'),
    app_commands.Choice(name='Art & Literature', value='art & literature'),
    app_commands.Choice(name='Celebrities', value='celebrities'),
    app_commands.Choice(name='Entertainment', value='entertainment'),
    app_commands.Choice(name='Food', value='food'),
    app_commands.Choice(name='Geography', value='geography'),
    app_commands.Choice(name='History', value='history'),
    app_commands.Choice(name='Science', value='science'),
    app_commands.Choice(name='Sports', value='sports'),
    app_commands.Choice(name='Technology', value='technology'),
    app_commands.Choice(name='Video Games', value='video games')
])
async def trivia(
    interaction: discord.Interaction,
    category: app_commands.Choice[str],
    difficulty: str
):
#

so like category = "select a category" and describe correspond to the trivia's input paramaters

#

hope this helps

sinful matrixBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.