diff options
| author | Rapptz <[email protected]> | 2020-01-18 19:57:47 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-01-18 20:04:00 -0500 |
| commit | a2b241446ed36cb848b5eb0c3a7a5d96ba4939ff (patch) | |
| tree | eea9df884de9cc5d679ec1e9324197d0b92b1789 | |
| parent | [commands] Context.send_help properly sends to on_help_command_error (diff) | |
| download | discord.py-a2b241446ed36cb848b5eb0c3a7a5d96ba4939ff.tar.xz discord.py-a2b241446ed36cb848b5eb0c3a7a5d96ba4939ff.zip | |
[commands] Document BucketType separately
| -rw-r--r-- | discord/ext/commands/core.py | 12 | ||||
| -rw-r--r-- | docs/ext/commands/api.rst | 32 |
2 files changed, 34 insertions, 10 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 97c2634c..3e05014f 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -1776,15 +1776,7 @@ def cooldown(rate, per, type=BucketType.default): of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of ``type`` which must be of enum - type ``BucketType`` which could be either: - - - ``BucketType.default`` for a global basis. - - ``BucketType.user`` for a per-user basis. - - ``BucketType.guild`` for a per-guild basis. - - ``BucketType.channel`` for a per-channel basis. - - ``BucketType.member`` for a per-member basis. - - ``BucketType.category`` for a per-category basis. - - ``BucketType.role`` for a per-role basis (added in v1.3.0). + type :class:`.BucketType`. If a cooldown is triggered, then :exc:`.CommandOnCooldown` is triggered in :func:`.on_command_error` and the local error handler. @@ -1797,7 +1789,7 @@ def cooldown(rate, per, type=BucketType.default): The number of times a command can be used before triggering a cooldown. per: :class:`float` The amount of seconds to wait for a cooldown when it's been triggered. - type: ``BucketType`` + type: :class:`.BucketType` The type of cooldown to have. """ diff --git a/docs/ext/commands/api.rst b/docs/ext/commands/api.rst index d16cb805..a8f7e001 100644 --- a/docs/ext/commands/api.rst +++ b/docs/ext/commands/api.rst @@ -111,6 +111,38 @@ Help Commands .. autoclass:: discord.ext.commands.Paginator :members: +Enums +------ + +.. class:: discord.ext.commands.BucketType + + Specifies a type of bucket for, e.g. a cooldown. + + .. attribute:: default + + The default bucket operates on a global basis. + .. attribute:: user + + The user bucket operates on a per-user basis. + .. attribute:: guild + + The guild bucket operates on a per-guild basis. + .. attribute:: channel + + The channel bucket operates on a per-channel basis. + .. attribute:: member + + The member bucket operates on a per-member basis. + .. attribute:: category + + The category bucket operates on a per-category basis. + .. attribute:: role + + The role bucket operates on a per-role basis. + + .. versionadded:: 1.3.0 + + .. _ext_commands_api_checks: Checks |