#My bot broke randomly

1 messages · Page 1 of 1 (latest)

carmine steppe
#

what do u mean by broke

#

Name = quest_number

#

And in the other u put pages

#

Name of the option need to be rue same as the other

#

I know

#

The decorator is not respected because the name is the wrong one

#

Replace the async def ctx, pages by ctx, quest_number

#

Show me the code

#

And also did u restart ur discord ?

azure haven
#

it's input_type=int, not type

carmine steppe
azure haven
#

It is not.

carmine steppe
#

I know it has changed with one decorator

#

discord.option it’s type

#

Sometime

azure haven
#

hm

carmine steppe
#

With one decorator is type

azure haven
#

then thats just a bug

carmine steppe
#

And not input_type

#

Use type=

#

If decorator is from discord

#

Can you do

#

@discord.option(

#

And you put ur thing

#

I told u

#

Why it’s not working

azure haven
#

You just didn't even change it lol

carmine steppe
#

The name of the parameter

#

Has to be the same has the other

#

Try that

@bot.slash_command(name="quest", description="View the current quests.")
@discord.option(name="quest_number", description="The number of the quest that you want to see.", type=int, min_value=1, max_value=6, required=False, default=1)
async def get(ctx, quest_number: int):
.......

carmine steppe
#

What error ?

#

Show ur command code

#

But did the option was working ?

#

Code of the command

#

No but like rn

#

Does it was /quest and u have a dropdown

#

So the error was what I told u

#

Option name and the other need to be the same

#

Now the error is on the command code not option

pseudo briar
#

?tag requests

elfin ferryBOT
#

Why you should not use the requests library for your bot
requests is a popular HTTP library for Python. It is however not a good option for Discord bots, since it is not async and blocking.

This essentially means that your bot will not be able to execute any code at all while a request is happening. Since requests usually take a few seconds to complete, this can have a detrimental effect on your bot's performance. E.g if a user executes a command that performs a request taking 5 seconds to complete, no one else will be able to use your bot for those 5 seconds.

Please look at using a HTTP library that has async support, such as aiohttp or httpx

carmine steppe
#

Also take too munch time

#

You should defer

azure haven
#

Also, if you do an API request, always use await ctx.defer()

carmine steppe
#

Also toothy option take type while Option take input_type

azure haven
#

yea, i saw it, just a dumb change and a semantic bug imo

carmine steppe
#

Nelo told me that it will add input_type also in the other

#

Still on the master ig

azure haven
#

change the variable names...

#

you didnt change it in your code

#

if you change the parameter name you need to change it everywhere in your code too

carmine steppe
#

Replace page by quest_number

carmine steppe
#

With pleasure