aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-05-22 07:21:23 -0400
committerRapptz <[email protected]>2017-05-22 07:21:23 -0400
commitf5888765871b9f6ba1b7affca9271b1a3d0c8a8e (patch)
tree91d014b91dc7e9c8b3e3233a20f4a621975d3095
parentRaise when an invalid permission is passed to PermissionOverwrite. (diff)
downloaddiscord.py-f5888765871b9f6ba1b7affca9271b1a3d0c8a8e.tar.xz
discord.py-f5888765871b9f6ba1b7affca9271b1a3d0c8a8e.zip
Use Python3Lexer instead of PythonLexer for pygments.
-rw-r--r--discord/ext/commands/bot.py8
-rw-r--r--discord/ext/commands/core.py8
-rw-r--r--discord/guild.py4
-rw-r--r--discord/member.py2
-rw-r--r--discord/user.py2
-rw-r--r--discord/utils.py6
-rw-r--r--docs/intro.rst2
-rw-r--r--docs/migrating.rst10
-rw-r--r--docs/migrating_to_async.rst30
-rw-r--r--docs/quickstart.rst2
10 files changed, 37 insertions, 37 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 9a7c5023..01ea05dc 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -49,7 +49,7 @@ def when_mentioned_or(*prefixes):
Example
--------
- .. code-block:: python
+ .. code-block:: python3
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'))
@@ -227,7 +227,7 @@ class BotBase(GroupMixin):
Example
---------
- .. code-block:: python
+ .. code-block:: python3
@bot.check
def whitelist(ctx):
@@ -373,7 +373,7 @@ class BotBase(GroupMixin):
Example
--------
- .. code-block:: python
+ .. code-block:: python3
async def on_ready(): pass
async def my_message(message): pass
@@ -422,7 +422,7 @@ class BotBase(GroupMixin):
Example
--------
- .. code-block:: python
+ .. code-block:: python3
@bot.listen()
async def on_message(message):
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 2662a31b..3655deaf 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -998,7 +998,7 @@ def check(predicate):
Creating a basic check to see if the command invoker is you.
- .. code-block:: python
+ .. code-block:: python3
def check_if_it_is_me(ctx):
return ctx.message.author.id == 85309593344815104
@@ -1010,7 +1010,7 @@ def check(predicate):
Transforming common checks into its own decorator:
- .. code-block:: python
+ .. code-block:: python3
def is_me():
def predicate(ctx):
@@ -1076,7 +1076,7 @@ def has_any_role(*names):
Example
--------
- .. code-block:: python
+ .. code-block:: python3
@bot.command()
@commands.has_any_role('Library Devs', 'Moderators')
@@ -1106,7 +1106,7 @@ def has_permissions(**perms):
Example
---------
- .. code-block:: python
+ .. code-block:: python3
@bot.command()
@commands.has_permissions(manage_messages=True)
diff --git a/discord/guild.py b/discord/guild.py
index 1ce331d3..bea3456a 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -476,13 +476,13 @@ class Guild(Hashable):
Creating a basic channel:
- .. code-block:: python
+ .. code-block:: python3
channel = await guild.create_text_channel('cool-channel')
Creating a "secret" channel:
- .. code-block:: python
+ .. code-block:: python3
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
diff --git a/discord/member.py b/discord/member.py
index 1fb4b492..7b969869 100644
--- a/discord/member.py
+++ b/discord/member.py
@@ -293,7 +293,7 @@ class Member(discord.abc.Messageable, _BaseUser):
Basically equivalent to:
- .. code-block:: python
+ .. code-block:: python3
channel.permissions_for(self)
diff --git a/discord/user.py b/discord/user.py
index 7d95d239..634e821c 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -128,7 +128,7 @@ class BaseUser(_BaseUser):
Basically equivalent to:
- .. code-block:: python
+ .. code-block:: python3
channel.permissions_for(self)
diff --git a/discord/utils.py b/discord/utils.py
index 2f9f61f9..35044836 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -188,19 +188,19 @@ def get(iterable, **attrs):
Basic usage:
- .. code-block:: python
+ .. code-block:: python3
member = discord.utils.get(message.guild.members, name='Foo')
Multiple attribute matching:
- .. code-block:: python
+ .. code-block:: python3
channel = discord.utils.get(guild.channels, name='Foo', type=ChannelType.voice)
Nested attribute matching:
- .. code-block:: python
+ .. code-block:: python3
channel = discord.utils.get(client.get_all_channels(), guild__name='Cool', name='general')
diff --git a/docs/intro.rst b/docs/intro.rst
index b3804be1..6a8a4d71 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -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
diff --git a/docs/migrating.rst b/docs/migrating.rst
index 13b869aa..2a2ad72a 100644
--- a/docs/migrating.rst
+++ b/docs/migrating.rst
@@ -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):
diff --git a/docs/migrating_to_async.rst b/docs/migrating_to_async.rst
index c4b7e1db..109ad409 100644
--- a/docs/migrating_to_async.rst
+++ b/docs/migrating_to_async.rst
@@ -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
diff --git a/docs/quickstart.rst b/docs/quickstart.rst
index 28d2f59a..12e97016 100644
--- a/docs/quickstart.rst
+++ b/docs/quickstart.rst
@@ -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