Use Python3Lexer instead of PythonLexer for pygments.

This commit is contained in:
Rapptz
2017-05-22 07:21:23 -04:00
parent d672f84932
commit f588876587
10 changed files with 37 additions and 37 deletions

View File

@ -96,7 +96,7 @@ happens, you will receive an event about it and you can then respond to it.
A quick example to showcase how events work:
.. code-block:: python
.. code-block:: python3
import discord

View File

@ -626,7 +626,7 @@ For example, to wait for a reaction: ::
Since this function now can return multiple arguments, the ``timeout`` parameter will now raise a ``asyncio.TimeoutError``
when reached instead of setting the return to ``None``. For example:
.. code-block:: python
.. code-block:: python3
def pred(m):
return m.author == message.author and m.channel == message.channel
@ -726,7 +726,7 @@ In v1.0, the :class:`.Context` has received a lot of changes with how it's retri
The biggest change is that ``pass_context=True`` is now the default behaviour. Ergo:
.. code-block:: python
.. code-block:: python3
# before
@bot.command()
@ -768,7 +768,7 @@ provided one.
For example, if you want to add some functionality to the context:
.. code-block:: python
.. code-block:: python3
class MyContext(commands.Context):
@property
@ -778,7 +778,7 @@ For example, if you want to add some functionality to the context:
Then you can use :meth:`~ext.commands.Bot.get_context` inside :func:`on_message` with combination with
:meth:`~ext.commands.Bot.invoke` to use your custom context:
.. code-block:: python
.. code-block:: python3
class MyBot(commands.Bot):
async def on_message(self, message):
@ -787,7 +787,7 @@ Then you can use :meth:`~ext.commands.Bot.get_context` inside :func:`on_message`
Now inside your commands you will have access to your custom context:
.. code-block:: python
.. code-block:: python3
@bot.command()
async def secret(ctx):

View File

@ -25,7 +25,7 @@ possible, the events must be decorated with ``@asyncio.coroutine``.
Before:
.. code-block:: python
.. code-block:: python3
@client.event
def on_message(message):
@ -33,7 +33,7 @@ Before:
After:
.. code-block:: python
.. code-block:: python3
@client.event
@asyncio.coroutine
@ -42,7 +42,7 @@ After:
Or in Python 3.5+:
.. code-block:: python
.. code-block:: python3
@client.event
async def on_message(message):
@ -51,7 +51,7 @@ Or in Python 3.5+:
Because there is a lot of typing, a utility decorator (:meth:`Client.async_event`) is provided
for easier registration. For example:
.. code-block:: python
.. code-block:: python3
@client.async_event
def on_message(message):
@ -70,7 +70,7 @@ was changed.
Before:
.. code-block:: python
.. code-block:: python3
def on_channel_update(channel): pass
def on_member_update(member): pass
@ -82,7 +82,7 @@ Before:
After:
.. code-block:: python
.. code-block:: python3
def on_channel_update(before, after): pass
def on_member_update(before, after): pass
@ -104,13 +104,13 @@ for the computation to be done. For example...
Before:
.. code-block:: python
.. code-block:: python3
client.send_message(message.channel, 'Hello')
After:
.. code-block:: python
.. code-block:: python3
yield from client.send_message(message.channel, 'Hello')
@ -137,7 +137,7 @@ The affected attributes are as follows:
Some examples of previously valid behaviour that is now invalid
.. code-block:: python
.. code-block:: python3
if client.servers[0].name == "test":
# do something
@ -145,7 +145,7 @@ Some examples of previously valid behaviour that is now invalid
Since they are no longer ``list``\s, they no longer support indexing or any operation other than iterating.
In order to get the old behaviour you should explicitly cast it to a list.
.. code-block:: python
.. code-block:: python3
servers = list(client.servers)
# work with servers
@ -165,7 +165,7 @@ The common places where this was changed was in the server region, member status
Before:
.. code-block:: python
.. code-block:: python3
server.region == 'us-west'
member.status == 'online'
@ -173,7 +173,7 @@ Before:
After:
.. code-block:: python
.. code-block:: python3
server.region == discord.ServerRegion.us_west
member.status = discord.Status.online
@ -276,14 +276,14 @@ However, in order to do that you must pass in your credentials to :meth:`Client.
Basically, before:
.. code-block:: python
.. code-block:: python3
client.login('token')
client.run()
After:
.. code-block:: python
.. code-block:: python3
client.run('token')
@ -298,7 +298,7 @@ This is a utility function that abstracts the event loop for you. There's no nee
the run call to be blocking and out of your control. Indeed, if you want control of the
event loop then doing so is quite straightforward:
.. code-block:: python
.. code-block:: python3
import discord
import asyncio

View File

@ -15,7 +15,7 @@ Let's make a bot that replies to a specific message and walk you through it.
It looks something like this:
.. code-block:: python
.. code-block:: python3
import discord