-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Guide] Intro & Quickstart guide #9263
base: docs/guide
Are you sure you want to change the base?
Changes from 16 commits
cd29da0
550459f
1b836d4
932f4d0
7bb3a9f
ed32f59
a1f6a39
510983c
1a5cf3f
7b3ed8a
abbfb7b
1d5f14f
c965a16
edefab0
5e2c820
3c273b3
2b23d84
27c0794
b56b3bd
48b0d51
3d9df90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,103 @@ | ||||||
.. currentmodule:: discord | ||||||
|
||||||
.. _guide_install: | ||||||
|
||||||
Installation | ||||||
============= | ||||||
|
||||||
Welcome to discord.py, a library for Python to aid in creating applications for Discord. | ||||||
|
||||||
Prerequisites | ||||||
-------------- | ||||||
|
||||||
To install discord.py you'll need Python version 3.8 or higher. Earlier versions of Python are not supported. | ||||||
|
||||||
.. _guide_install_primer: | ||||||
|
||||||
Primer | ||||||
------------- | ||||||
|
||||||
On Unix systems you can run the following command to install discord.py from PyPI. | ||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
python3 -m pip install -U discord.py | ||||||
|
||||||
On Windows systems, you can use the following command instead. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
py -3 -m pip install -U discord.py | ||||||
|
||||||
Voice Support | ||||||
~~~~~~~~~~~~~~ | ||||||
|
||||||
Voice support (e.g. playing audio in voice channels) is not enabled by default and can be enabled by installing ``discord.py[voice]`` instead of ``discord.py``. :: | ||||||
|
||||||
pip install -U "discord.py[voice]" | ||||||
|
||||||
Linux systems may need to install additional dependencies via your package manager to get full voice support. | ||||||
|
||||||
On Debian and Ubuntu systems: | ||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
$ sudo apt install libffi-dev libsodium-dev python3-dev | ||||||
|
||||||
For Fedora and CentOS systems: | ||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
$ sudo dnf install libffi-devel libsodium-devel python3-devel | ||||||
|
||||||
For Arch Linux systems: | ||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
$ pacman -Syu libsodium | ||||||
AbstractUmbra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
For other distributions, please use your package manager to find libraries for ``libffi``, ``libsodium``, and the Python 3 development headers. | ||||||
|
||||||
Virtual Environments | ||||||
~~~~~~~~~~~~~~~~~~~~~ | ||||||
|
||||||
Global Python environments get cluttered with dependencies very easily - virtual environments can help separate your projects into clean, organized folders. | ||||||
Virtual environments (or "venvs") help separate project dependencies from the global Python installation, avoiding polluting | ||||||
other projects using the same Python version. They also allow you to install libraries that you may not have permission to install globally. | ||||||
|
||||||
To quickly get a virtual environment working in your project folder: | ||||||
|
||||||
1. Ensure you are in your project's root directory. | ||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
$ cd your_bot_source | ||||||
$ python3 -m venv .venv | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably needs to be distro specific. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why creating a venv would be distro specific here. Could you explain your comment in more detail? We can have a note that says for windows systems to use the |
||||||
|
||||||
The ``.venv`` argument is the output folder of the virtual environment, this can be named anything but be sure to remember it. | ||||||
|
||||||
2. Activate the virtual environment: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be tabs too. |
||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
$ source .venv/bin/activate | ||||||
|
||||||
On Windows, use the following: | ||||||
|
||||||
.. code-block:: pwsh | ||||||
|
||||||
$ .\.venv\Scripts\activate | ||||||
|
||||||
3. You can then use ``pip`` and ``python`` without interfering with other projects: | ||||||
|
||||||
.. code-block:: shell | ||||||
|
||||||
$ pip install -U discord.py # note the lack of ``py -3 -m`` or ``python3 -m`` | ||||||
$ python your_bot.py | ||||||
|
||||||
For a more in-depth look into virtual environments, see :doc:`py:tutorial/venv`. | ||||||
|
||||||
Next Steps | ||||||
----------- | ||||||
|
||||||
Now that you've installed discord.py, the next step is to begin making your bot application. See :ref:`_guide_intro` for further getting started steps. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.