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): class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild text channel. """Represents a Discord guild text channel.
Supported Operations: .. describe:: x == y
+-----------+---------------------------------------+ Checks if two channels are equal.
| Operation | Description |
+===========+=======================================+ .. describe:: x != y
| x == y | Checks if two channels are equal. |
+-----------+---------------------------------------+ Checks if two channels are not equal.
| x != y | Checks if two channels are not equal. |
+-----------+---------------------------------------+ .. describe:: hash(x)
| hash(x) | Returns the channel's hash. |
+-----------+---------------------------------------+ Returns the channel's hash.
| str(x) | Returns the channel's name. |
+-----------+---------------------------------------+ .. describe:: str(x)
Returns the channel's name.
Attributes Attributes
----------- -----------
@ -300,19 +302,21 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable): class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild voice channel. """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)
+-----------+---------------------------------------+ Returns the channel's name.
| 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. |
+-----------+---------------------------------------+
Attributes Attributes
----------- -----------
@ -410,19 +414,21 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
class DMChannel(discord.abc.Messageable, Hashable): class DMChannel(discord.abc.Messageable, Hashable):
"""Represents a Discord direct message channel. """Represents a Discord direct message channel.
Supported Operations: .. describe:: x == y
+-----------+-------------------------------------------------+ Checks if two channels are equal.
| Operation | Description |
+===========+=================================================+ .. describe:: x != y
| x == y | Checks if two channels are equal. |
+-----------+-------------------------------------------------+ Checks if two channels are not equal.
| x != y | Checks if two channels are not equal. |
+-----------+-------------------------------------------------+ .. describe:: hash(x)
| hash(x) | Returns the channel's hash. |
+-----------+-------------------------------------------------+ Returns the channel's hash.
| str(x) | Returns a string representation of the channel |
+-----------+-------------------------------------------------+ .. describe:: str(x)
Returns a string representation of the channel
Attributes Attributes
---------- ----------
@ -489,19 +495,21 @@ class DMChannel(discord.abc.Messageable, Hashable):
class GroupChannel(discord.abc.Messageable, Hashable): class GroupChannel(discord.abc.Messageable, Hashable):
"""Represents a Discord group channel. """Represents a Discord group channel.
Supported Operations: .. describe:: x == y
+-----------+-------------------------------------------------+ Checks if two channels are equal.
| Operation | Description |
+===========+=================================================+ .. describe:: x != y
| x == y | Checks if two channels are equal. |
+-----------+-------------------------------------------------+ Checks if two channels are not equal.
| x != y | Checks if two channels are not equal. |
+-----------+-------------------------------------------------+ .. describe:: hash(x)
| hash(x) | Returns the channel's hash. |
+-----------+-------------------------------------------------+ Returns the channel's hash.
| str(x) | Returns a string representation of the channel |
+-----------+-------------------------------------------------+ .. describe:: str(x)
Returns a string representation of the channel
Attributes 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 Depending on the way this object was created, some of the attributes can
have a value of ``None``. have a value of ``None``.
Supported Operations: .. describe:: x == y
+-----------+-----------------------------------------+ Checks if two emoji are the same.
| Operation | Description |
+===========+=========================================+ .. describe:: x != y
| x == y | Checks if two emoji are the same. |
+-----------+-----------------------------------------+ Checks if two emoji are not the same.
| x != y | Checks if two emoji are not the same. |
+-----------+-----------------------------------------+ .. describe:: hash(x)
| hash(x) | Return the emoji's hash. |
+-----------+-----------------------------------------+ Return the emoji's hash.
| iter(x) | Returns an iterator of (field, value) |
| | pairs. This allows this class to be | .. describe:: iter(x)
| | used as an iterable in list/dict/etc. |
| | constructions. | 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:: str(x)
Returns the emoji rendered for discord.
Attributes Attributes
----------- -----------

28
discord/game.py

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

28
discord/guild.py

@ -50,19 +50,21 @@ class Guild(Hashable):
This is referred to as a "server" in the official Discord UI. This is referred to as a "server" in the official Discord UI.
Supported Operations: .. describe:: x == y
+-----------+-------------------------------------+ Checks if two guilds are equal.
| Operation | Description |
+===========+=====================================+ .. describe:: x != y
| x == y | Checks if two guilds are equal. |
+-----------+-------------------------------------+ Checks if two guilds are not equal.
| x != y | Checks if two guilds are not equal. |
+-----------+-------------------------------------+ .. describe:: hash(x)
| hash(x) | Returns the guild's hash. |
+-----------+-------------------------------------+ Returns the guild's hash.
| str(x) | Returns the guild's name. |
+-----------+-------------------------------------+ .. describe:: str(x)
Returns the guild's name.
Attributes 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 Depending on the way this object was created, some of the attributes can
have a value of ``None``. have a value of ``None``.
Supported Operations: .. describe:: x == y
+-----------+--------------------------------------+ Checks if two invites are equal.
| Operation | Description |
+===========+======================================+ .. describe:: x != y
| x == y | Checks if two invites are equal. |
+-----------+--------------------------------------+ Checks if two invites are not equal.
| x != y | Checks if two invites are not equal. |
+-----------+--------------------------------------+ .. describe:: hash(x)
| hash(x) | Return the invite's hash. |
+-----------+--------------------------------------+ Returns the invite hash.
| str(x) | Returns the invite's URL. |
+-----------+--------------------------------------+ .. describe:: str(x)
Returns the invite URL.
Attributes Attributes
----------- -----------

30
discord/member.py

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

30
discord/reaction.py

@ -32,19 +32,23 @@ class Reaction:
Depending on the way this object was created, some of the attributes can Depending on the way this object was created, some of the attributes can
have a value of ``None``. have a value of ``None``.
Similar to members, the same reaction to a different message are equal. .. describe:: x == y
Supported Operations: 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".
| Operation | Description |
+===========+===========================================+ .. describe:: x != y
| x == y | Checks if two reactions are the same. |
+-----------+-------------------------------------------+ Checks if two reactions are not equal.
| x != y | Checks if two reactions are not the same. |
+-----------+-------------------------------------------+ .. describe:: hash(x)
| hash(x) | Return the emoji's hash. |
+-----------+-------------------------------------------+ Returns the reaction's hash.
.. describe:: str(x)
Returns the channel's name.
Attributes Attributes
----------- -----------

52
discord/role.py

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

56
discord/user.py

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

Loading…
Cancel
Save