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

Conversation

AbstractUmbra
Copy link
Contributor

Summary

(Duplicate of #7500 due to contributor inactivity).

This PR will add the Intro and Quickstart guides to the discord.py guide.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@AbstractUmbra AbstractUmbra marked this pull request as ready for review February 25, 2023 13:45
Copy link
Contributor

@numbermaniac numbermaniac left a comment

Choose a reason for hiding this comment

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

A couple of quick grammar nitpicks.

docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@ShineyDev ShineyDev left a comment

Choose a reason for hiding this comment

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

This guide is not an introduction to the library, but a guide to installing the library. You should consider changing the file name to install.rst or similar, and creating a true introduction such as the django overview or similar.

docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@IAmTomahawkx IAmTomahawkx left a comment

Choose a reason for hiding this comment

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

Mostly good, a couple of newer developments in discord that should be updated though

docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/intro.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
docs/guide/quickstart.rst Outdated Show resolved Hide resolved
@tailoric
Copy link
Contributor

As mentioned some time ago in the #docs channel on the discord server by me.
Could it be possible to also explain, or at least mention, the command line commands of discord.py:

  • python -m discord newbot
  • python -m discord newcog

I've noticed that they are never mentioned in the documentation at all (unless I really missed them) and many people don't even know about these helpful features for setting up the base skeleton of both.
It could be nice to tell in the introduction about at least the newbot command since it sets up a good "boilerplate" to start from.
The newcog command may be better suited inside the Cogs guide but I think it would be helpful to give more awareness to both of them in the guides.

XuaTheGrate and others added 9 commits February 3, 2024 13:24
Co-authored-by: numbermaniac <5206120+numbermaniac@users.noreply.github.com>
Co-authored-by: numbermaniac <5206120+numbermaniac@users.noreply.github.com>
Co-authored-by: numbermaniac <5206120+numbermaniac@users.noreply.github.com>
Co-authored-by: Riley Miļeško <30989490+ShineyDev@users.noreply.github.com>
Copy link
Contributor

@ShineyDev ShineyDev left a comment

Choose a reason for hiding this comment

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

Since the content has been reviewed by several others by now I'll just restate that the files should be renamed. A guide/intro should not tell me how to install a library, consider renaming to guide/install[ation]. This also makes space for guide/quickstart to be renamed to guide/intro[duction].

@AbstractUmbra
Copy link
Contributor Author

Since the content has been reviewed by several others by now I'll just restate that the files should be renamed. A guide/intro should not tell me how to install a library, consider renaming to guide/install[ation]. This also makes space for guide/quickstart to be renamed to guide/intro[duction].

I personally agree with this and will rename these files appropriately. If there are issues we can always revert.

Copy link
Contributor

@ika2kki ika2kki left a comment

Choose a reason for hiding this comment

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

left a few comments below.
happy with the content so far

docs/guide/installation.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@ShineyDev ShineyDev left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link

@No767 No767 left a comment

Choose a reason for hiding this comment

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

As per usual, I left some of my suggestions and thoughts down in this review. The section "A Simple Bot" (in docs/guide/introduction.rst) doesn't flow nicely and it was really hard to read in order to understand what it was supposed to be guiding me through.

docs/guide/installation.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved
docs/guide/introduction.rst Show resolved Hide resolved
docs/guide/introduction.rst Show resolved Hide resolved
docs/guide/introduction.rst Show resolved Hide resolved
docs/guide/introduction.rst Show resolved Hide resolved
docs/guide/introduction.rst Show resolved Hide resolved
docs/guide/introduction.rst Show resolved Hide resolved
docs/guide/introduction.rst Outdated Show resolved Hide resolved

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.

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.

Comment on lines +39 to +59
Linux systems may need to install additional dependencies via your package manager to get full voice support:-

.. tab:: Debian/Ubuntu

.. code-block:: shell

$ sudo apt install libffi-dev libsodium-dev python3-dev

.. tab:: Fedora/CentOS

.. code-block:: shell

$ sudo dnf install libffi-devel libsodium-devel python3-devel

.. tab:: Arch Linux

.. code-block:: shell

$ pacman -Syu libsodium libffi

For other distributions, please use your package manager to find libraries for ``libffi``, ``libsodium``, and the Python 3 development headers.
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
Linux systems may need to install additional dependencies via your package manager to get full voice support:-
.. tab:: Debian/Ubuntu
.. code-block:: shell
$ sudo apt install libffi-dev libsodium-dev python3-dev
.. tab:: Fedora/CentOS
.. code-block:: shell
$ sudo dnf install libffi-devel libsodium-devel python3-devel
.. tab:: Arch Linux
.. code-block:: shell
$ pacman -Syu libsodium libffi
For other distributions, please use your package manager to find libraries for ``libffi``, ``libsodium``, and the Python 3 development headers.
.. note::
You may need to install additional libraries to enable voice support on Linux, below are the commands for some popular distributions.
.. tab:: Debian/Ubuntu
.. code-block:: shell
$ sudo apt install libffi-dev libsodium-dev python3-dev
.. tab:: Fedora/CentOS
.. code-block:: shell
$ sudo dnf install libffi-devel libsodium-devel python3-devel
.. tab:: Arch Linux
.. code-block:: shell
$ pacman -Syu libsodium libffi
For other distributions, please use your package manager to find libraries for ``libffi``, ``libsodium``, and the Python 3 development headers.

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

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.


.. warning::

If you accidentally use the ``Client Secret`` for your bot token, it's **NOT** what you are looking for - you need the bot **Token**, which has a different format.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably reword this, Maybe "Ensure you don't use the Client Secret in place of your token, these are not the same thing and ..."

async def apples(ctx: commands.Context, amount: int) -> None:
await ctx.send(f"Hello, I would like {amount} apples please!")

Here's where our commands will be defined. We use the :meth:`@bot.command() <ext.commands.Bot.command>` decorator to flag this function as a command.
Copy link
Contributor

Choose a reason for hiding this comment

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

Where's here?

Here's where our commands will be defined. We use the :meth:`@bot.command() <ext.commands.Bot.command>` decorator to flag this function as a command.
This creates a command ``!apples`` that we can type into a channel, and the bot will respond with the given amount of applies in a predefined sentence.. A few key features:

- :class:`~ext.commands.Context` refers to the command invocation context - this includes the :attr:`~ext.commands.Context.channel`, command :attr:`~ext.commands.Context.author`, :attr:`~ext.commands.Context.message` and more.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would reword the "this includes" section to use "such as ..." rather than "... and more".


TOKEN = "your bot token here"

This is the final step, you put your bot token here, save and run the file and the bot will start up.
Copy link
Contributor

Choose a reason for hiding this comment

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

nowhere in this do I see Bot.run explicitly being called. you'll need to add that.


Activate the virtual environment (if you made one):

.. code-block:: shell
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, use tabs.

Copy link
Contributor

Choose a reason for hiding this comment

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

big nono dot png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Changes Requested
Development

Successfully merging this pull request may close these issues.

None yet