aboutsummaryrefslogtreecommitdiff
path: root/discord/utils.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-10-17 18:25:23 -0400
committerRapptz <[email protected]>2017-01-03 09:51:54 -0500
commitd1d54a468a88323a8ef7798ff084a1371d5893ec (patch)
tree21dd315df95acd2c8d6cf63cc51fa4cadc0c7155 /discord/utils.py
parentStateful Message and remove Invite.xkcd since it is removed. (diff)
downloaddiscord.py-d1d54a468a88323a8ef7798ff084a1371d5893ec.tar.xz
discord.py-d1d54a468a88323a8ef7798ff084a1371d5893ec.zip
Rename Server to Guild everywhere.
Diffstat (limited to 'discord/utils.py')
-rw-r--r--discord/utils.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/discord/utils.py b/discord/utils.py
index 5b19c8c3..35a3034f 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -91,9 +91,9 @@ def deprecated(instead=None):
return decorated
return actual_decorator
-def oauth_url(client_id, permissions=None, server=None, redirect_uri=None):
+def oauth_url(client_id, permissions=None, guild=None, redirect_uri=None):
"""A helper function that returns the OAuth2 URL for inviting the bot
- into servers.
+ into guilds.
Parameters
-----------
@@ -102,16 +102,16 @@ def oauth_url(client_id, permissions=None, server=None, redirect_uri=None):
permissions : :class:`Permissions`
The permissions you're requesting. If not given then you won't be requesting any
permissions.
- server : :class:`Server`
- The server to pre-select in the authorization screen, if available.
+ guild : :class:`Guild`
+ The guild to pre-select in the authorization screen, if available.
redirect_uri : str
An optional valid redirect URI.
"""
url = 'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot'.format(client_id)
if permissions is not None:
url = url + '&permissions=' + str(permissions.value)
- if server is not None:
- url = url + "&guild_id=" + server.id
+ if guild is not None:
+ url = url + "&guild_id=" + guild.id
if redirect_uri is not None:
from urllib.parse import urlencode
url = url + "&response_type=code&" + urlencode({'redirect_uri': redirect_uri})
@@ -144,7 +144,7 @@ def find(predicate, seq):
"""A helper to return the first element found in the sequence
that meets the predicate. For example: ::
- member = find(lambda m: m.name == 'Mighty', channel.server.members)
+ member = find(lambda m: m.name == 'Mighty', channel.guild.members)
would find the first :class:`Member` whose name is 'Mighty' and return it.
If an entry is not found, then ``None`` is returned.
@@ -190,19 +190,19 @@ def get(iterable, **attrs):
.. code-block:: python
- member = discord.utils.get(message.server.members, name='Foo')
+ member = discord.utils.get(message.guild.members, name='Foo')
Multiple attribute matching:
.. code-block:: python
- channel = discord.utils.get(server.channels, name='Foo', type=ChannelType.voice)
+ channel = discord.utils.get(guild.channels, name='Foo', type=ChannelType.voice)
Nested attribute matching:
.. code-block:: python
- channel = discord.utils.get(client.get_all_channels(), server__name='Cool', name='general')
+ channel = discord.utils.get(client.get_all_channels(), guild__name='Cool', name='general')
Parameters
-----------