mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Document the change in behaviour of bool(flag_obj)
This commit is contained in:
parent
8d047d9e1d
commit
ca0b444047
@ -239,6 +239,12 @@ class SystemChannelFlags(BaseFlags):
|
|||||||
Returns an iterator of ``(name, value)`` pairs. This allows it
|
Returns an iterator of ``(name, value)`` pairs. This allows it
|
||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
value: :class:`int`
|
value: :class:`int`
|
||||||
@ -361,6 +367,12 @@ class MessageFlags(BaseFlags):
|
|||||||
Returns an iterator of ``(name, value)`` pairs. This allows it
|
Returns an iterator of ``(name, value)`` pairs. This allows it
|
||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. versionadded:: 1.3
|
.. versionadded:: 1.3
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
@ -509,6 +521,12 @@ class PublicUserFlags(BaseFlags):
|
|||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
Note that aliases are not shown.
|
Note that aliases are not shown.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. versionadded:: 1.4
|
.. versionadded:: 1.4
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
@ -693,6 +711,12 @@ class Intents(BaseFlags):
|
|||||||
Returns an iterator of ``(name, value)`` pairs. This allows it
|
Returns an iterator of ``(name, value)`` pairs. This allows it
|
||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any intent is enabled.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
value: :class:`int`
|
value: :class:`int`
|
||||||
@ -1278,6 +1302,12 @@ class MemberCacheFlags(BaseFlags):
|
|||||||
Returns an iterator of ``(name, value)`` pairs. This allows it
|
Returns an iterator of ``(name, value)`` pairs. This allows it
|
||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
value: :class:`int`
|
value: :class:`int`
|
||||||
@ -1421,6 +1451,10 @@ class ApplicationFlags(BaseFlags):
|
|||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
Note that aliases are not shown.
|
Note that aliases are not shown.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
@ -1556,6 +1590,10 @@ class ChannelFlags(BaseFlags):
|
|||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
Note that aliases are not shown.
|
Note that aliases are not shown.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
@ -1652,6 +1690,10 @@ class AutoModPresets(ArrayFlags):
|
|||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
Note that aliases are not shown.
|
Note that aliases are not shown.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
value: :class:`int`
|
value: :class:`int`
|
||||||
@ -1736,6 +1778,10 @@ class MemberFlags(BaseFlags):
|
|||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
Note that aliases are not shown.
|
Note that aliases are not shown.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether any flag is set to ``True``.
|
||||||
|
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
|
@ -119,6 +119,12 @@ class Permissions(BaseFlags):
|
|||||||
to be, for example, constructed as a dict or a list of pairs.
|
to be, for example, constructed as a dict or a list of pairs.
|
||||||
Note that aliases are not shown.
|
Note that aliases are not shown.
|
||||||
|
|
||||||
|
.. describe:: bool(b)
|
||||||
|
|
||||||
|
Returns whether the permissions object has any permissions set to ``True``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
value: :class:`int`
|
value: :class:`int`
|
||||||
|
@ -1006,6 +1006,20 @@ Due to a breaking API change by Discord, :meth:`Guild.bans` no longer returns a
|
|||||||
async for ban in guild.bans(limit=1000):
|
async for ban in guild.bans(limit=1000):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
Flag classes now have a custom ``bool()`` implementation
|
||||||
|
--------------------------------------------------------
|
||||||
|
|
||||||
|
To allow library users to easily check whether an instance of a flag class has any flags enabled,
|
||||||
|
using `bool` on them will now only return ``True`` if at least one flag is enabled.
|
||||||
|
|
||||||
|
This means that evaluating instances of the following classes in a bool context (such as ``if obj:``) may no longer return ``True``:
|
||||||
|
|
||||||
|
- :class:`Intents`
|
||||||
|
- :class:`MemberCacheFlags`
|
||||||
|
- :class:`MessageFlags`
|
||||||
|
- :class:`Permissions`
|
||||||
|
- :class:`PublicUserFlags`
|
||||||
|
- :class:`SystemChannelFlags`
|
||||||
|
|
||||||
Function Signature Changes
|
Function Signature Changes
|
||||||
----------------------------
|
----------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user