Browse Source

Use describe instead of tables for supported operations.

pull/572/head
Rapptz 8 years ago
parent
commit
f73eb087c9
  1. 108
      discord/channel.py
  2. 38
      discord/emoji.py
  3. 28
      discord/game.py
  4. 28
      discord/guild.py
  5. 28
      discord/invite.py
  6. 30
      discord/member.py
  7. 30
      discord/reaction.py
  8. 52
      discord/role.py
  9. 56
      discord/user.py

108
discord/channel.py

@ -44,19 +44,21 @@ def _single_delete_strategy(messages, *, reason):
class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild text channel.
Supported Operations:
+-----------+---------------------------------------+
| Operation | Description |
+===========+=======================================+
| x == y | Checks if two channels are equal. |
+-----------+---------------------------------------+
| x != y | Checks if two channels are not equal. |
+-----------+---------------------------------------+
| hash(x) | Returns the channel's hash. |
+-----------+---------------------------------------+
| str(x) | Returns the channel's name. |
+-----------+---------------------------------------+
.. describe:: x == y
Checks if two channels are equal.
.. describe:: x != y
Checks if two channels are not equal.
.. describe:: hash(x)
Returns the channel's hash.
.. describe:: str(x)
Returns the channel's name.
Attributes
-----------
@ -300,19 +302,21 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild voice channel.
Supported Operations:
.. describe:: x == y
Checks if two channels are equal.
.. describe:: x != y
Checks if two channels are not equal.
.. describe:: hash(x)
Returns the channel's hash.
.. describe:: str(x)
+-----------+---------------------------------------+
| Operation | Description |
+===========+=======================================+
| x == y | Checks if two channels are equal. |
+-----------+---------------------------------------+
| x != y | Checks if two channels are not equal. |
+-----------+---------------------------------------+
| hash(x) | Returns the channel's hash. |
+-----------+---------------------------------------+
| str(x) | Returns the channel's name. |
+-----------+---------------------------------------+
Returns the channel's name.
Attributes
-----------
@ -410,19 +414,21 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
class DMChannel(discord.abc.Messageable, Hashable):
"""Represents a Discord direct message channel.
Supported Operations:
.. describe:: x == y
+-----------+-------------------------------------------------+
| Operation | Description |
+===========+=================================================+
| x == y | Checks if two channels are equal. |
+-----------+-------------------------------------------------+
| x != y | Checks if two channels are not equal. |
+-----------+-------------------------------------------------+
| hash(x) | Returns the channel's hash. |
+-----------+-------------------------------------------------+
| str(x) | Returns a string representation of the channel |
+-----------+-------------------------------------------------+
Checks if two channels are equal.
.. describe:: x != y
Checks if two channels are not equal.
.. describe:: hash(x)
Returns the channel's hash.
.. describe:: str(x)
Returns a string representation of the channel
Attributes
----------
@ -489,19 +495,21 @@ class DMChannel(discord.abc.Messageable, Hashable):
class GroupChannel(discord.abc.Messageable, Hashable):
"""Represents a Discord group channel.
Supported Operations:
+-----------+-------------------------------------------------+
| Operation | Description |
+===========+=================================================+
| x == y | Checks if two channels are equal. |
+-----------+-------------------------------------------------+
| x != y | Checks if two channels are not equal. |
+-----------+-------------------------------------------------+
| hash(x) | Returns the channel's hash. |
+-----------+-------------------------------------------------+
| str(x) | Returns a string representation of the channel |
+-----------+-------------------------------------------------+
.. describe:: x == y
Checks if two channels are equal.
.. describe:: x != y
Checks if two channels are not equal.
.. describe:: hash(x)
Returns the channel's hash.
.. describe:: str(x)
Returns a string representation of the channel
Attributes
----------

38
discord/emoji.py

@ -38,24 +38,26 @@ class Emoji(Hashable):
Depending on the way this object was created, some of the attributes can
have a value of ``None``.
Supported Operations:
+-----------+-----------------------------------------+
| Operation | Description |
+===========+=========================================+
| x == y | Checks if two emoji are the same. |
+-----------+-----------------------------------------+
| x != y | Checks if two emoji are not the same. |
+-----------+-----------------------------------------+
| hash(x) | Return the emoji's hash. |
+-----------+-----------------------------------------+
| iter(x) | Returns an iterator of (field, value) |
| | pairs. This allows this class to be |
| | used as an iterable in list/dict/etc. |
| | constructions. |
+-----------+-----------------------------------------+
| str(x) | Returns the emoji rendered for discord. |
+-----------+-----------------------------------------+
.. describe:: x == y
Checks if two emoji are the same.
.. describe:: x != y
Checks if two emoji are not the same.
.. describe:: hash(x)
Return the emoji's hash.
.. describe:: iter(x)
Returns an iterator of ``(field, value)`` pairs. This allows this class
to be used as an iterable in list/dict/etc constructions.
.. describe:: str(x)
Returns the emoji rendered for discord.
Attributes
-----------

28
discord/game.py

@ -27,19 +27,21 @@ DEALINGS IN THE SOFTWARE.
class Game:
"""Represents a Discord game.
Supported Operations:
+-----------+------------------------------------+
| Operation | Description |
+===========+====================================+
| x == y | Checks if two games are equal. |
+-----------+------------------------------------+
| x != y | Checks if two games are not equal. |
+-----------+------------------------------------+
| hash(x) | Return the games's hash. |
+-----------+------------------------------------+
| str(x) | Returns the games's name. |
+-----------+------------------------------------+
.. describe:: x == y
Checks if two games are equal.
.. describe:: x != y
Checks if two games are not equal.
.. describe:: hash(x)
Returns the game's hash.
.. describe:: str(x)
Returns the game's name.
Attributes
-----------

28
discord/guild.py

@ -50,19 +50,21 @@ class Guild(Hashable):
This is referred to as a "server" in the official Discord UI.
Supported Operations:
+-----------+-------------------------------------+
| Operation | Description |
+===========+=====================================+
| x == y | Checks if two guilds are equal. |
+-----------+-------------------------------------+
| x != y | Checks if two guilds are not equal. |
+-----------+-------------------------------------+
| hash(x) | Returns the guild's hash. |
+-----------+-------------------------------------+
| str(x) | Returns the guild's name. |
+-----------+-------------------------------------+
.. describe:: x == y
Checks if two guilds are equal.
.. describe:: x != y
Checks if two guilds are not equal.
.. describe:: hash(x)
Returns the guild's hash.
.. describe:: str(x)
Returns the guild's name.
Attributes
----------

28
discord/invite.py

@ -36,19 +36,21 @@ class Invite(Hashable):
Depending on the way this object was created, some of the attributes can
have a value of ``None``.
Supported Operations:
+-----------+--------------------------------------+
| Operation | Description |
+===========+======================================+
| x == y | Checks if two invites are equal. |
+-----------+--------------------------------------+
| x != y | Checks if two invites are not equal. |
+-----------+--------------------------------------+
| hash(x) | Return the invite's hash. |
+-----------+--------------------------------------+
| str(x) | Returns the invite's URL. |
+-----------+--------------------------------------+
.. describe:: x == y
Checks if two invites are equal.
.. describe:: x != y
Checks if two invites are not equal.
.. describe:: hash(x)
Returns the invite hash.
.. describe:: str(x)
Returns the invite URL.
Attributes
-----------

30
discord/member.py

@ -112,19 +112,23 @@ class Member(discord.abc.Messageable):
This implements a lot of the functionality of :class:`User`.
Supported Operations:
+-----------+-----------------------------------------------+
| Operation | Description |
+===========+===============================================+
| x == y | Checks if two members are equal. |
+-----------+-----------------------------------------------+
| x != y | Checks if two members are not equal. |
+-----------+-----------------------------------------------+
| hash(x) | Return the member's hash. |
+-----------+-----------------------------------------------+
| str(x) | Returns the member's name with discriminator. |
+-----------+-----------------------------------------------+
.. describe:: x == y
Checks if two members are equal.
Note that this works with :class:`User` instances too.
.. describe:: x != y
Checks if two members are not equal.
Note that this works with :class:`User` instances too.
.. describe:: hash(x)
Returns the member's hash.
.. describe:: str(x)
Returns the member's name with the discriminator.
Attributes
----------

30
discord/reaction.py

@ -32,19 +32,23 @@ class Reaction:
Depending on the way this object was created, some of the attributes can
have a value of ``None``.
Similar to members, the same reaction to a different message are equal.
Supported Operations:
+-----------+-------------------------------------------+
| Operation | Description |
+===========+===========================================+
| x == y | Checks if two reactions are the same. |
+-----------+-------------------------------------------+
| x != y | Checks if two reactions are not the same. |
+-----------+-------------------------------------------+
| hash(x) | Return the emoji's hash. |
+-----------+-------------------------------------------+
.. describe:: x == y
Checks if two reactions are equal. This works by checking if the emoji
is the same. So two messages with the same reaction will be considered
"equal".
.. describe:: x != y
Checks if two reactions are not equal.
.. describe:: hash(x)
Returns the reaction's hash.
.. describe:: str(x)
Returns the channel's name.
Attributes
-----------

52
discord/role.py

@ -35,27 +35,37 @@ from .utils import snowflake_time
class Role(Hashable):
"""Represents a Discord role in a :class:`Guild`.
Supported Operations:
+-----------+------------------------------------------------------------------+
| Operation | Description |
+===========+==================================================================+
| x == y | Checks if two roles are equal. |
+-----------+------------------------------------------------------------------+
| x != y | Checks if two roles are not equal. |
+-----------+------------------------------------------------------------------+
| x > y | Checks if a role is higher than another in the hierarchy. |
+-----------+------------------------------------------------------------------+
| x < y | Checks if a role is lower than another in the hierarchy. |
+-----------+------------------------------------------------------------------+
| x >= y | Checks if a role is higher or equal to another in the hierarchy. |
+-----------+------------------------------------------------------------------+
| x <= y | Checks if a role is lower or equal to another in the hierarchy. |
+-----------+------------------------------------------------------------------+
| hash(x) | Return the role's hash. |
+-----------+------------------------------------------------------------------+
| str(x) | Returns the role's name. |
+-----------+------------------------------------------------------------------+
.. describe:: x == y
Checks if two roles are equal.
.. describe:: x != y
Checks if two roles are not equal.
.. describe:: x > y
Checks if a role is higher than another in the hierarchy.
.. describe:: x < y
Checks if a role is lower than another in the hierarchy.
.. describe:: x >= y
Checks if a role is higher or equal to another in the hierarchy.
.. describe:: x <= y
Checks if a role is lower or equal to another in the hierarchy.
.. describe:: hash(x)
Return the role's hash.
.. describe:: str(x)
Returns the role's name.
Attributes
----------

56
discord/user.py

@ -175,19 +175,21 @@ class BaseUser:
class ClientUser(BaseUser):
"""Represents your Discord user.
Supported Operations:
+-----------+---------------------------------------------+
| Operation | Description |
+===========+=============================================+
| x == y | Checks if two users are equal. |
+-----------+---------------------------------------------+
| x != y | Checks if two users are not equal. |
+-----------+---------------------------------------------+
| hash(x) | Return the user's hash. |
+-----------+---------------------------------------------+
| str(x) | Returns the user's name with discriminator. |
+-----------+---------------------------------------------+
.. describe:: x == y
Checks if two users are equal.
.. describe:: x != y
Checks if two users are not equal.
.. describe:: hash(x)
Return the user's hash.
.. describe:: str(x)
Returns the user's name with discriminator.
Attributes
-----------
@ -382,19 +384,21 @@ class ClientUser(BaseUser):
class User(BaseUser, discord.abc.Messageable):
"""Represents a Discord user.
Supported Operations:
+-----------+---------------------------------------------+
| Operation | Description |
+===========+=============================================+
| x == y | Checks if two users are equal. |
+-----------+---------------------------------------------+
| x != y | Checks if two users are not equal. |
+-----------+---------------------------------------------+
| hash(x) | Return the user's hash. |
+-----------+---------------------------------------------+
| str(x) | Returns the user's name with discriminator. |
+-----------+---------------------------------------------+
.. describe:: x == y
Checks if two users are equal.
.. describe:: x != y
Checks if two users are not equal.
.. describe:: hash(x)
Return the user's hash.
.. describe:: str(x)
Returns the user's name with discriminator.
Attributes
-----------

Loading…
Cancel
Save