Browse Source

Documentation fixes for Permissions related code.

pull/95/head
Rapptz 9 years ago
parent
commit
855fa7e553
  1. 2
      discord/channel.py
  2. 18
      discord/permissions.py
  3. 2
      docs/migrating.rst

2
discord/channel.py

@ -255,7 +255,7 @@ class PrivateChannel(Hashable):
Returns
--------
:class:`Permission`
:class:`Permissions`
The resolved permissions for the user.
"""

18
discord/permissions.py

@ -39,15 +39,15 @@ class Permissions:
| hash(x) | Return the permission's hash. |
+-----------+------------------------------------------+
The properties provided are two way. You can set and retrieve individual bits using the properties as if they
were regular bools. This allows you to edit permissions.
Attributes
-----------
value
The raw value. This value is a bit array field of a 32-bit integer
representing the currently available permissions. You should query
permissions via the properties rather than using this raw value.
The properties provided are two way. You can set and retrieve individual bits using the properties as if they
were regular bools. This allows you to edit permissions.
"""
__slots__ = [ 'value' ]
@ -65,19 +65,19 @@ class Permissions:
@classmethod
def none(cls):
"""A factory method that creates a :class:`Permission` with all
"""A factory method that creates a :class:`Permissions` with all
permissions set to False."""
return cls(0)
@classmethod
def all(cls):
"""A factory method that creates a :class:`Permission` with all
"""A factory method that creates a :class:`Permissions` with all
permissions set to True."""
return cls(0b00000011111100111111110000111111)
@classmethod
def all_channel(cls):
"""A :class:`Permission` with all channel-specific permissions set to
"""A :class:`Permissions` with all channel-specific permissions set to
True and the server-specific ones set to False. The server-specific
permissions are currently:
@ -89,19 +89,19 @@ class Permissions:
@classmethod
def general(cls):
"""A factory method that creates a :class:`Permission` with all
"""A factory method that creates a :class:`Permissions` with all
"General" permissions set to True."""
return cls(0b00000000000000000000000000111111)
@classmethod
def text(cls):
"""A factory method that creates a :class:`Permission` with all
"""A factory method that creates a :class:`Permissions` with all
"Text" permissions set to True."""
return cls(0b00000000000000111111110000000000)
@classmethod
def voice(cls):
"""A factory method that creates a :class:`Permission` with all
"""A factory method that creates a :class:`Permissions` with all
"Voice" permissions set to True."""
return cls(0b00000011111100000000000000000000)

2
docs/migrating.rst

@ -250,7 +250,7 @@ Functions have been renamed.
| ``Client.set_channel_permissions`` | :meth:`Client.edit_channel_permissions` |
+------------------------------------+-------------------------------------------+
All the :class:`Permission` related attributes have been renamed and the `can_` prefix has been
All the :class:`Permissions` related attributes have been renamed and the `can_` prefix has been
dropped. So for example, ``can_manage_messages`` has become ``manage_messages``.
.. _migrating-kwargs:

Loading…
Cancel
Save