Add message content to doc examples

This also changes the wording of Context's attributes 
for consistency.
This commit is contained in:
Cryptex 2022-03-14 18:01:48 -07:00 committed by GitHub
parent 68dbf0f882
commit 6cf7c4a7d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -178,9 +178,9 @@ As seen earlier, every command must take at least a single parameter, called the
This parameter gives you access to something called the "invocation context". Essentially all the information you need to This parameter gives you access to something called the "invocation context". Essentially all the information you need to
know how the command was executed. It contains a lot of useful information: know how the command was executed. It contains a lot of useful information:
- :attr:`.Context.guild` to fetch the :class:`Guild` of the command, if any. - :attr:`.Context.guild` returns the :class:`Guild` of the command, if any.
- :attr:`.Context.message` to fetch the :class:`Message` of the command. - :attr:`.Context.message` returns the :class:`Message` of the command.
- :attr:`.Context.author` to fetch the :class:`Member` or :class:`User` that called the command. - :attr:`.Context.author` returns the :class:`Member` or :class:`User` that called the command.
- :meth:`.Context.send` to send a message to the channel the command was used in. - :meth:`.Context.send` to send a message to the channel the command was used in.
The context implements the :class:`abc.Messageable` interface, so anything you can do on a :class:`abc.Messageable` you The context implements the :class:`abc.Messageable` interface, so anything you can do on a :class:`abc.Messageable` you

View File

@ -19,9 +19,14 @@ It looks something like this:
.. code-block:: python3 .. code-block:: python3
# This example requires the 'message_content' intent.
import discord import discord
client = discord.Client() intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
@client.event @client.event
async def on_ready(): async def on_ready():