Comments (10)
You have to send an initial response to an interaction within 3 seconds:
However, if you manually defer the interaction e.g. doing
async def select_page(self, interaction: discord.Interaction):
await interaction.response.defer()
await asyncio.sleep(4)
then you have up to 15 minutes (since that is how long the interaction token is valid for) to send follow-up messages.
The reason that you are getting this error is because pycord automatically defers the response if you do not respond yourself, and since you slept for more than 3 seconds in the component callback, the interaction token is invalidated.
from pycord.
Yeah, am aware of the reason. But I think that the library should catch the 404. Depending on the load of the server the bot is not able to respond in the given time which results in this error.
from pycord.
You can catch it yourself? discord.ui.View
provides a on_error
function for this
from pycord.
I think the library shouldn't throw errors without the developer really expecting them. You also can also barely differentiate those library exceptions from those who get thrown in the callback.
from pycord.
It should be expected because you have exceeded the 3 second limit. Continuing from your point, neither should the library silently ignore errors.
from pycord.
It should be expected
No. It is not mentioned anywhere in the documentation. "Not Found" also doesn't make sense in this context and won't be useful to the library user. Exceptions are only expected on library user input eg. by calling a core.
Continuing from your point, neither should the library silently ignore errors.
But not everyone wants that the interaction to be auto-deferred
from pycord.
It is documented in the discord API documentation. The reason that it gets auto-deferred is because you have to respond to the interaction and the defer happens only when the callback is done and no response was made.
It probably should be documented with more clarity in the fact that you have to respond within 3 seconds and that the library auto-defers it for you if you don't respond youself.
from pycord.
It is documented in the discord API documentation.
No. The user doesn't know that it will be auto-deferred. The average user probably also only uses pycord's documentation.
The reason that it gets auto-deferred is because you have to respond to the interaction and the defer happens only when the callback is done and no response was made.
You don't need to respond. If you don't respond, it just shows that the interaction failed.
from pycord.
The documentation that I referenced documents the fact that you need to respond within 3 seconds if you don't want it to fail.
I suppose the point of having it was that it is better than the "This interaction has failed" text that appears if you don't respond at all. I already said that it should probably be documented that it will auto-defer.
Of course you could have a task that waits for 3 seconds and then checks if the interaction has been responded to or not but this could be prone to race conditions. In my opinion, it is better to keep what we have at the moment but document it better.
from pycord.
Stale
from pycord.
Related Issues (20)
- Subcommand groups not showing up in the Slash Command channel HOT 4
- Slash commands interaction response doesnt give message HOT 1
- Error importing SlashCommandGroup, Page, ext.pages HOT 3
- audit_logs not fetching more than 100 logs HOT 4
- Paginator error upon failed interaction
- DeprecationWarning for BridgeOption raised at module level
- v2.7: Remove backwards support for Option in bridge commands.
- Add description attribute to ClientUser HOT 1
- Unclear exception when command is run without first creating bot in server HOT 1
- sync_commands doesnt raise error HOT 4
- is_integration return False even if its an integration
- Vanity URL cannot be edited anymore HOT 5
- walk_application_commands() return None if 1 command is not loaded HOT 3
- Deferred message cannot return as ephemeral HOT 4
- Accessing Raw Interaction Data in `interaction_metadata` HOT 14
- Unload cog does not remove prefix command HOT 1
- Strict type checking on `mypy` doesn't work with Pycord
- Quest Profile Badge HOT 1
- Accessing server-specific attributes of discord.Member with user apps causes an exception HOT 1
- Add server-specific member banners HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycord.