You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/faq.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ Pretty much anything from the discord's commands extension doesn't work, also so
109
109
.. warning::
110
110
If you use something that might take a while, eg ``wait_for`` you'll run into two issues:
111
111
112
-
1. If you don't respond within 3 seconds (``ctx.respond()``) discord invalidates the interaction.
112
+
1. If you don't respond within 3 seconds (``ctx.defer()`` or `ctx.send(..)``) discord invalidates the interaction.
113
113
2. The interaction only lasts for 15 minutes, so if you try and send something with the interaction (``ctx.send``) more than 15 mins after the command was ran it won't work.
114
114
115
115
As an alternative you can use ``ctx.channel.send`` but this relies on the the bot being in the guild, and the bot having send perms in that channel.
Copy file name to clipboardExpand all lines: docs/migration.rst
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,60 @@
1
+
Migration
2
+
+++++++++
3
+
This page contains instructions on how to migrate between versions with breaking changes.
4
+
5
+
Migrate To V1.0.10
6
+
==================
7
+
Changes that you'll need to make in this version are mainly becuase of a new ui from discord, more info `here <https://github.com/discord/discord-api-docs/pull/2615>`_
8
+
9
+
Responding / Deferring
10
+
**********************
11
+
12
+
In regards to :class:`SlashContext` the methods ``.respond`` and ``.ack`` have been removed, and ``.defer`` added.
13
+
Deferring a message will allow you to respond for up to 15 mins, but you'll have to defer within three seconds.
14
+
When you defer the user will see a "this bot is thinking" message until you send a message, This message can be ephermical (hidden) or visible.
15
+
``.defer`` has a ``hidden`` parameter, which will make the deferred message ephermical.
16
+
17
+
We suggest deferring if you might take more than three seconds to respond, but if you will call ``.send`` before three seconds then don't.
18
+
19
+
.. note::
20
+
You **must** respond with ``.send`` within 15 minutes of the command being invoked to avoid an "interaction failed" message, if you defer.
21
+
This is especially relevant for bots that had 'invisible' commands, where the invocation was not shown.
22
+
If you wish to have the invocation of the command not visible, send an ephermical success message, and then do what you used to.
23
+
It is no longer possible to "eat" the invocation.
24
+
``ctx.channel.send`` does **not** count as responding.
25
+
26
+
Example
27
+
--------
28
+
29
+
.. code-block:: python
30
+
31
+
# Before
32
+
@slash.slash(...)
33
+
asyncdefcommand(ctx, ...):
34
+
await ctx.respond()
35
+
await ctx.send(...)
36
+
37
+
# After 1
38
+
@slash.slash(...)
39
+
asyncdefcommand(ctx, ...):
40
+
await ctx.send(...)
41
+
42
+
# After 2
43
+
@slash.slash(...)
44
+
asyncdefcommand(ctx, ...):
45
+
await ctx.defer()
46
+
# Process that takes time
47
+
await ctx.send(...)
48
+
49
+
50
+
Sending hidden messages
51
+
***********************
52
+
The method ``.send_hidden`` on :class:`SlashContext` has been removed. Use ``.send(hidden = True, ..)`` instead.
0 commit comments