aboutsummaryrefslogtreecommitdiff
path: root/docs/faq.rst
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-20 00:59:30 -0400
committerRapptz <[email protected]>2016-06-20 00:59:30 -0400
commite2e6d7182ec6b03400521ba6914cfda53035c589 (patch)
tree768060b97de26aa048dc8d31e00e41291a58ad73 /docs/faq.rst
parent[commands] Add the concept of global checks. (diff)
downloaddiscord.py-e2e6d7182ec6b03400521ba6914cfda53035c589.tar.xz
discord.py-e2e6d7182ec6b03400521ba6914cfda53035c589.zip
Add FAQ entry for `after` being called right away.
Diffstat (limited to 'docs/faq.rst')
-rw-r--r--docs/faq.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/faq.rst b/docs/faq.rst
index 94d75b48..60684b0f 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -163,6 +163,27 @@ this together we can do the following: ::
player = await voice.create_ytdl_player(url, after=my_after)
player.start()
+Why is my "after" function being called right away?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ``after`` keyword argument expects a *function object* to be passed in. Similar to how ``threading.Thread`` expects a
+callable in its ``target`` keyword argument. This means that the following are invalid:
+
+.. code-block:: python
+
+ player = await voice.create_ytdl_player(url, after=self.foo())
+ other = await voice.create_ytdl_player(url, after=self.bar(10))
+
+However the following are correct:
+
+.. code-block:: python
+
+ player = await voice.create_ytdl_player(url, after=self.foo)
+ other = await voice.create_ytdl_player(url, after=lambda: self.bar(10))
+
+Basically, these functions should not be called.
+
+
How do I run something in the background?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~