mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
Add message content to doc examples
This also changes the wording of Context's attributes for consistency.
This commit is contained in:
parent
68dbf0f882
commit
6cf7c4a7d7
@ -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
|
||||||
|
@ -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():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user