Organise documentation

This commit is contained in:
NCPlayz
2019-03-16 21:43:55 +00:00
committed by Rapptz
parent 5e65ec978c
commit fb02191b80
30 changed files with 417 additions and 419 deletions

View File

@ -422,20 +422,20 @@ class Guild(Hashable):
Parameters
-----------
format: str
format: :class:`str`
The format to attempt to convert the icon to.
size: int
size: :class:`int`
The size of the image to display.
Returns
--------
str
The resulting CDN URL.
Raises
------
InvalidArgument
Bad image format passed to ``format`` or invalid ``size``.
Returns
--------
:class:`str`
The resulting CDN URL.
"""
if not valid_icon_size(size):
raise InvalidArgument("size must be a power of 2 between 16 and 4096")
@ -460,20 +460,20 @@ class Guild(Hashable):
Parameters
-----------
format: str
format: :class:`str`
The format to attempt to convert the banner to.
size: int
size: :class:`int`
The size of the image to display.
Returns
--------
str
The resulting CDN URL.
Raises
------
InvalidArgument
Bad image format passed to ``format`` or invalid ``size``.
Returns
--------
:class:`str`
The resulting CDN URL.
"""
if not valid_icon_size(size):
raise InvalidArgument("size must be a power of 2 between 16 and 4096")
@ -498,20 +498,20 @@ class Guild(Hashable):
Parameters
-----------
format: str
format: :class:`str`
The format to attempt to convert the splash to.
size: int
size: :class:`int`
The size of the image to display.
Returns
--------
str
The resulting CDN URL.
Raises
------
InvalidArgument
Bad image format passed to ``format`` or invalid ``size``.
Returns
--------
:class:`str`
The resulting CDN URL.
"""
if not valid_icon_size(size):
raise InvalidArgument("size must be a power of 2 between 16 and 4096")
@ -573,7 +573,7 @@ class Guild(Hashable):
Parameters
-----------
name: str
name: :class:`str`
The name of the member to lookup with an optional discriminator.
Returns
@ -649,11 +649,11 @@ class Guild(Hashable):
overwrites with the target (either a :class:`Member` or a :class:`Role`)
as the key and a :class:`PermissionOverwrite` as the value.
Note
--------
Creating a channel of a specified position will not update the position of
other channels to follow suit. A follow-up call to :meth:`~TextChannel.edit`
will be required to update the position of the channel in the channel list.
.. note::
Creating a channel of a specified position will not update the position of
other channels to follow suit. A follow-up call to :meth:`~TextChannel.edit`
will be required to update the position of the channel in the channel list.
Examples
----------
@ -765,10 +765,10 @@ class Guild(Hashable):
Leaves the guild.
Note
--------
You cannot leave the guild that you own, you must delete it instead
via :meth:`delete`.
.. note::
You cannot leave the guild that you own, you must delete it instead
via :meth:`delete`.
Raises
--------
@ -803,18 +803,18 @@ class Guild(Hashable):
Parameters
----------
name: str
name: :class:`str`
The new name of the guild.
description: str
description: :class:`str`
The new description of the guild. This is only available to guilds that
contain `VERIFIED` in :attr:`Guild.features`.
icon: bytes
icon: :class:`bytes`
A :term:`py:bytes-like object` representing the icon. Only PNG/JPEG supported.
Could be ``None`` to denote removal of the icon.
banner: bytes
banner: :class:`bytes`
A :term:`py:bytes-like object` representing the banner.
Could be ``None`` to denote removal of the banner.
splash: bytes
splash: :class:`bytes`
A :term:`py:bytes-like object` representing the invite splash.
Only PNG/JPEG supported. Could be ``None`` to denote removing the
splash. Only available for partnered guilds with ``INVITE_SPLASH``
@ -823,7 +823,7 @@ class Guild(Hashable):
The new region for the guild's voice communication.
afk_channel: Optional[:class:`VoiceChannel`]
The new channel that is the AFK channel. Could be ``None`` for no AFK channel.
afk_timeout: int
afk_timeout: :class:`int`
The number of seconds until someone is moved to the AFK channel.
owner: :class:`Member`
The new owner of the guild to transfer ownership to. Note that you must
@ -834,11 +834,11 @@ class Guild(Hashable):
The new default notification level for the guild.
explicit_content_filter: :class:`ContentFilter`
The new explicit content filter for the guild.
vanity_code: str
vanity_code: :class:`str`
The new vanity code for the guild.
system_channel: Optional[:class:`TextChannel`]
The new channel that is used for the system channel. Could be ``None`` for no system channel.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason for editing this guild. Shows up on the audit log.
Raises
@ -1026,9 +1026,9 @@ class Guild(Hashable):
Parameters
-----------
days: int
days: :class:`int`
The number of days before counting as inactive.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason for doing this action. Shows up on the audit log.
Raises
@ -1042,7 +1042,7 @@ class Guild(Hashable):
Returns
---------
int
:class:`int`
The number of members pruned.
"""
@ -1082,7 +1082,7 @@ class Guild(Hashable):
Parameters
-----------
days: int
days: :class:`int`
The number of days before counting as inactive.
Raises
@ -1096,7 +1096,7 @@ class Guild(Hashable):
Returns
---------
int
:class:`int`
The number of members estimated to be pruned.
"""
@ -1150,27 +1150,27 @@ class Guild(Hashable):
Parameters
-----------
name: str
name: :class:`str`
The emoji name. Must be at least 2 characters.
image: bytes
image: :class:`bytes`
The :term:`py:bytes-like object` representing the image data to use.
Only JPG, PNG and GIF images are supported.
roles: Optional[list[:class:`Role`]]
roles: Optional[List[:class:`Role`]]
A :class:`list` of :class:`Role`\s that can use this emoji. Leave empty to make it available to everyone.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason for creating this emoji. Shows up on the audit log.
Returns
--------
:class:`Emoji`
The created emoji.
Raises
-------
Forbidden
You are not allowed to create emojis.
HTTPException
An error occurred creating an emoji.
Returns
--------
:class:`Emoji`
The created emoji.
"""
img = utils._bytes_to_base64_data(image)
@ -1191,27 +1191,22 @@ class Guild(Hashable):
Parameters
-----------
name: str
name: :class:`str`
The role name. Defaults to 'new role'.
permissions: :class:`Permissions`
The permissions to have. Defaults to no permissions.
colour: :class:`Colour`
The colour for the role. Defaults to :meth:`Colour.default`.
This is aliased to ``color`` as well.
hoist: bool
hoist: :class:`bool`
Indicates if the role should be shown separately in the member list.
Defaults to False.
mentionable: bool
mentionable: :class:`bool`
Indicates if the role should be mentionable by others.
Defaults to False.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason for creating this role. Shows up on the audit log.
Returns
--------
:class:`Role`
The newly created role.
Raises
-------
Forbidden
@ -1220,6 +1215,11 @@ class Guild(Hashable):
Editing the role failed.
InvalidArgument
An invalid keyword argument was given.
Returns
--------
:class:`Role`
The newly created role.
"""
try:
@ -1261,7 +1261,7 @@ class Guild(Hashable):
-----------
user: :class:`abc.Snowflake`
The user to kick from their guild.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason the user got kicked.
Raises
@ -1287,10 +1287,10 @@ class Guild(Hashable):
-----------
user: :class:`abc.Snowflake`
The user to ban from their guild.
delete_message_days: int
delete_message_days: :class:`int`
The number of days worth of messages to delete from the user
in the guild. The minimum is 0 and the maximum is 7.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason the user got banned.
Raises
@ -1316,7 +1316,7 @@ class Guild(Hashable):
-----------
user: :class:`abc.Snowflake`
The user to unban.
reason: Optional[str]
reason: Optional[:class:`str`]
The reason for doing this action. Shows up on the audit log.
Raises
@ -1339,17 +1339,17 @@ class Guild(Hashable):
You must have the :attr:`~Permissions.manage_guild` permission to use
this as well.
Returns
--------
:class:`Invite`
The special vanity invite.
Raises
-------
Forbidden
You do not have the proper permissions to get this.
HTTPException
Retrieving the vanity invite failed.
Returns
--------
:class:`Invite`
The special vanity invite.
"""
# we start with { code: abc }
@ -1392,38 +1392,6 @@ class Guild(Hashable):
You must have the :attr:`~Permissions.view_audit_log` permission to use this.
Parameters
-----------
limit: Optional[int]
The number of entries to retrieve. If ``None`` retrieve all entries.
before: Union[:class:`abc.Snowflake`, datetime]
Retrieve entries before this date or entry.
If a date is provided it must be a timezone-naive datetime representing UTC time.
after: Union[:class:`abc.Snowflake`, datetime]
Retrieve entries after this date or entry.
If a date is provided it must be a timezone-naive datetime representing UTC time.
reverse: bool
If set to true, return entries in oldest->newest order. If unspecified,
this defaults to ``False`` for most cases. However if passing in a
``after`` parameter then this is set to ``True``. This avoids getting entries
out of order in the ``after`` case.
user: :class:`abc.Snowflake`
The moderator to filter entries from.
action: :class:`AuditLogAction`
The action to filter with.
Yields
--------
:class:`AuditLogEntry`
The audit log entry.
Raises
-------
Forbidden
You are not allowed to fetch audit logs
HTTPException
An error occurred while fetching the audit logs.
Examples
----------
@ -1441,6 +1409,38 @@ class Guild(Hashable):
entries = await guild.audit_logs(limit=None, user=guild.me).flatten()
await channel.send('I made {} moderation actions.'.format(len(entries)))
Parameters
-----------
limit: Optional[:class:`int`]
The number of entries to retrieve. If ``None`` retrieve all entries.
before: Union[:class:`abc.Snowflake`, datetime]
Retrieve entries before this date or entry.
If a date is provided it must be a timezone-naive datetime representing UTC time.
after: Union[:class:`abc.Snowflake`, datetime]
Retrieve entries after this date or entry.
If a date is provided it must be a timezone-naive datetime representing UTC time.
reverse: :class:`bool`
If set to true, return entries in oldest->newest order. If unspecified,
this defaults to ``False`` for most cases. However if passing in a
``after`` parameter then this is set to ``True``. This avoids getting entries
out of order in the ``after`` case.
user: :class:`abc.Snowflake`
The moderator to filter entries from.
action: :class:`AuditLogAction`
The action to filter with.
Raises
-------
Forbidden
You are not allowed to fetch audit logs
HTTPException
An error occurred while fetching the audit logs.
Yields
--------
:class:`AuditLogEntry`
The audit log entry.
"""
if user:
user = user.id