Skip to content
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

Open
wants to merge 21 commits into
base: docs/guide
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/ext/commands/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ know how the command was executed. It contains a lot of useful information:
The context implements the :class:`abc.Messageable` interface, so anything you can do on a :class:`abc.Messageable` you
can do on the :class:`~ext.commands.Context`.

.. _ext_commands_commands_converters:

Converters
------------

Expand Down
4 changes: 4 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Where can I use ``await``\?

You can only use ``await`` inside ``async def`` functions and nowhere else.

.. _faq_blocking:

What does "blocking" mean?
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -351,6 +353,8 @@ Commands Extension

Questions regarding ``discord.ext.commands`` belong here.

.. _ext_commands_on_message:

Why does ``on_message`` make my commands stop working?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
103 changes: 103 additions & 0 deletions docs/guide/installation.rst
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On Unix systems you can run the following command to install discord.py from PyPI.
On Unix-based 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On Windows systems, you can use the following command instead.
On Windows, you can use the following command instead.


.. 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

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs to be distro specific.

Copy link

Choose a reason for hiding this comment

The 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 py launcher to gently remind users for that.


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:
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Now that you've installed discord.py, the next step is to begin making your application. See :ref:`_guide_intro` for further getting started steps.

Loading
Loading