Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1bb5ac3
Bump 2.0.0 Changelog.
JustaSqu1d Jul 9, 2022
fedee05
fix: channel data being removed on Option._invoke
baronkobama Jul 10, 2022
7accb95
feat: add additional operations to `BaseFlags` (#1486)
celsiusnarhwal Jul 12, 2022
751242b
Fix type issues in options.py (#1473)
Dorukyum Jul 13, 2022
f9a5319
2.0 Migration Guide + Changelog re-write (#1488)
JustaSqu1d Jul 15, 2022
283db54
Add interaction support for View.message and add disable_on_timeout t…
WhoIsConch Jul 17, 2022
6980db8
Emoji size changes (#1517)
UP929312 Jul 20, 2022
8e941f3
docs(guild): fix grammar in Guild channel properties
Jul 20, 2022
8286bed
Update pylint requirement from ~=2.14.4 to ~=2.14.5 (#1512)
dependabot[bot] Jul 23, 2022
d9e6d82
Update mypy requirement from ~=0.961 to ~=0.971
dependabot[bot] Jul 19, 2022
ede04b7
Update content retrieval from AutoModActionExecution (#1521)
NeloBlivion Jul 24, 2022
3fe9d18
Merge pull request #1476 from baronkobama/code-cleanup
baronkobama Jul 24, 2022
0841e7f
Set store=False as default in load_extension(s)
NeloBlivion Jul 22, 2022
9f5919a
Fix incorrect operations
Dorukyum Jul 25, 2022
cd70d8d
feat: Slash Command Mentions
JustaSqu1d Jul 25, 2022
c93c8ba
Update pytest-asyncio requirement from ~=0.18.3 to ~=0.19.0
dependabot[bot] Jul 15, 2022
ff92eb6
Fix `Option` raising AttributeError for `str` and `min_length or max_…
yoggys Jul 26, 2022
02ed0a5
Docs rewrite (#1504)
JustaSqu1d Jul 27, 2022
cf5f6d2
Set option.input_type when OptionType is passed
Dorukyum Jul 28, 2022
a27ba55
Allow different option name in option decorator
Dorukyum Jul 29, 2022
0fb5e5d
Tiny improvement relating to an example for slash commands
UP929312 Jul 29, 2022
ea0611d
Set option default to None when Optional is used
Dorukyum Jul 30, 2022
89d20ce
Implement app_commands_badge in flags.py (#1535)
lol219 Jul 30, 2022
a2d5787
Change from "baronkobama" on Discord
UP929312 Jul 30, 2022
ea4452e
Adding RPC endpoint support (Client.fetch_application) (#1536)
lol219 Jul 31, 2022
a8a4a29
fix: SlashCommandGroup descriptions
Middledot Jul 31, 2022
fde4ded
fix: enum options breaking & incorrect...
Middledot Aug 1, 2022
27c088b
fix(docs): update privileged intent information (#1542)
JustaSqu1d Aug 2, 2022
a56d801
Adjust category and guild _channels attributes to work with NoneType …
NeloBlivion Aug 5, 2022
81a8621
Add emoji validation to SelectOption's
Middledot Aug 6, 2022
cffae79
Bump next version (2.1.0) (#1480)
Lulalaby Aug 6, 2022
17af9d0
Adding `on_check_failure` to `View` class (#799)
Kile Aug 6, 2022
8731e1f
Improve sticker creation checks (#1546)
Middledot Aug 6, 2022
8eb120d
Fix thread message edge case
Middledot Aug 7, 2022
c98060f
Add overloads to load_extension(s)
Dorukyum Jul 25, 2022
db38261
Correct location of app_commands_badge flag (#1553)
Middledot Aug 8, 2022
c7bdab2
Add set_mfa_required method (#1552)
Middledot Aug 9, 2022
9ebeaca
Improved example to be easier.
TheGiga Aug 10, 2022
edc605d
Store resume_gateway_url
Dorukyum Aug 10, 2022
f71b47f
Connect using resume_gateway_url
Dorukyum Aug 10, 2022
7418cd4
Merge pull request #1559 from Dorukyum/resume_gateway_url
BobDotCom Aug 11, 2022
99b08d2
Avoid unnecessary call to `sync_commands` (#1563)
BobDotCom Aug 12, 2022
413d012
use custom_id to create timeout task
LuisWollenschneider Aug 12, 2022
369e44d
ext.bridge improvements (#1496)
Middledot Aug 13, 2022
e90f150
Fix for application-based bots without the bot scope
NeloBlivion Aug 15, 2022
f06e95c
Fallback on Object
NeloBlivion Aug 16, 2022
2d15753
Adjust guild object check
NeloBlivion Aug 16, 2022
2c3f794
Merge pull request #1568 from NeloBlivion/patch-11
BobDotCom Aug 16, 2022
d5119eb
Documentation improvements on bridge commands (#1569)
UP929312 Aug 16, 2022
b372330
Fixed documentation error link (#1571)
UP929312 Aug 18, 2022
f0e2027
Respect limit argument in Guild.bans()
NeloBlivion Aug 18, 2022
9e38de6
Changed styling for most of the examples. (#1566)
TheGiga Aug 18, 2022
04da5e8
Fix to the codespell test error. (#1581)
TheGiga Aug 20, 2022
dddf38d
Fix on_scheduled_event_update event (#1580)
NeloBlivion Aug 20, 2022
357364b
Fix converter instance check
Dorukyum Aug 20, 2022
966f560
Rework vulnerability handling (#1584)
Lulalaby Aug 21, 2022
c12e640
Fixed small bug in `ApplicationCommand` (#1585)
chrisdewa Aug 21, 2022
31d1deb
feat(docs): Message Content Intent in Migration Guide (#1583)
JustaSqu1d Aug 22, 2022
ec1561e
Fix SlashCommandGroup description not being truly optional
NeloBlivion Aug 23, 2022
8475f90
Merge pull request #1575 from NeloBlivion/patch-13
NeloBlivion Aug 23, 2022
d74278f
Fix `Interaction.edit_original_message()` InteractionMessage state (#…
camelwater Aug 23, 2022
bb46862
Fix Example Typo/Syntax Error
JustaSqu1d Aug 24, 2022
3b1a281
Fix required parameters validation error (#1589)
Middledot Aug 24, 2022
d6b91cf
commands.has_permissions() return True in DM channels (fix #1576) (#1…
yoggys Aug 25, 2022
d022361
Merge branch 'v2.x' into merge-conflicts
BobDotCom Aug 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .github/ISSUE_TEMPLATE/vulnerability_report.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
## Reporting a Vulnerability

If you find a vulnerability you have two ways to report it:
- Write us on https://pycord.dev/discord
- Open an [issue](https://github.com/Pycord-Development/pycord/issues/new/choose)
- Write a dm to one of our core developers on https://pycord.dev/discord
- Write an email to admin@pycord.dev
4 changes: 2 additions & 2 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install codespell
- run: codespell --ignore-words-list="groupt,nd,ot"
- run: pip install codespell==2.1.0
- run: codespell --ignore-words-list="groupt,nd,ot,ro,falsy,BU" --exclude-file=".github/workflows/codespell.yml"
7 changes: 5 additions & 2 deletions discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
__author__ = "Pycord Development"
__license__ = "MIT"
__copyright__ = "Copyright 2015-2021 Rapptz & Copyright 2021-present Pycord Development"
__version__ = "2.0.1"
__version__ = "2.1.0"


__path__ = __import__("pkgutil").extend_path(__path__, __name__)

Expand All @@ -25,6 +26,7 @@
from .appinfo import *
from .asset import *
from .audit_logs import *
from .automod import *
from .bot import *
from .channel import *
from .client import *
Expand Down Expand Up @@ -75,6 +77,7 @@ class VersionInfo(NamedTuple):
serial: int


version_info: VersionInfo = VersionInfo(major=2, minor=0, micro=1, releaselevel="final", serial=0)
version_info: VersionInfo = VersionInfo(major=2, minor=1, micro=0, releaselevel="final", serial=0)


logging.getLogger(__name__).addHandler(logging.NullHandler())
48 changes: 22 additions & 26 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@ async def _purge_messages_helper(
return ret


class _Undefined:
def __repr__(self) -> str:
return "see-below"


_undefined: Any = _Undefined()


@runtime_checkable
class Snowflake(Protocol):
"""An ABC that details the common operations on a Discord model.
Expand Down Expand Up @@ -382,7 +374,7 @@ async def _move(
payload = []
for index, c in enumerate(channels):
d: Dict[str, Any] = {"id": c.id, "position": index}
if parent_id is not _undefined and c.id == self.id:
if parent_id is not MISSING and c.id == self.id:
d.update(parent_id=parent_id, lock_permissions=lock_permissions)
payload.append(d)

Expand All @@ -392,7 +384,7 @@ async def _edit(self, options: Dict[str, Any], reason: Optional[str]) -> Optiona
try:
parent = options.pop("category")
except KeyError:
parent_id = _undefined
parent_id = MISSING
else:
parent_id = parent and parent.id

Expand Down Expand Up @@ -420,7 +412,7 @@ async def _edit(self, options: Dict[str, Any], reason: Optional[str]) -> Optiona
try:
position = options.pop("position")
except KeyError:
if parent_id is not _undefined:
if parent_id is not MISSING:
if lock_permissions:
category = self.guild.get_channel(parent_id)
if category:
Expand Down Expand Up @@ -603,7 +595,7 @@ def category(self) -> Optional[CategoryChannel]:

@property
def permissions_synced(self) -> bool:
""":class:`bool`: Whether or not the permissions for this channel are synced with the
""":class:`bool`: Whether the permissions for this channel are synced with the
category it belongs to.

If there is no category then this is ``False``.
Expand Down Expand Up @@ -658,7 +650,7 @@ def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
# (or otherwise) are then OR'd together.
# After the role permissions are resolved, the member permissions
# have to take into effect.
# After all that is done.. you have to do the following:
# After all that is done, you have to do the following:

# If manage permissions is True, then all permissions are set to True.

Expand Down Expand Up @@ -781,7 +773,7 @@ async def set_permissions(
self,
target: Union[Member, Role],
*,
overwrite: Optional[Union[PermissionOverwrite, _Undefined]] = ...,
overwrite: Optional[PermissionOverwrite] = ...,
reason: Optional[str] = ...,
) -> None:
...
Expand All @@ -796,7 +788,7 @@ async def set_permissions(
) -> None:
...

async def set_permissions(self, target, *, overwrite=_undefined, reason=None, **permissions):
async def set_permissions(self, target, *, overwrite=MISSING, reason=None, **permissions):
r"""|coro|

Sets the channel specific permission overwrites for a target in the
Expand Down Expand Up @@ -874,7 +866,7 @@ async def set_permissions(self, target, *, overwrite=_undefined, reason=None, **
else:
raise InvalidArgument("target parameter must be either Member or Role")

if overwrite is _undefined:
if overwrite is MISSING:
if len(permissions) == 0:
raise InvalidArgument("No overwrite provided.")
try:
Expand Down Expand Up @@ -1046,7 +1038,7 @@ async def move(self, **kwargs) -> None:
Raises
-------
InvalidArgument
An invalid position was given or a bad mix of arguments were passed.
An invalid position was given or a bad mix of arguments was passed.
Forbidden
You do not have permissions to move the channel.
HTTPException
Expand Down Expand Up @@ -1152,20 +1144,22 @@ async def create_invite(
.. versionadded:: 2.0

target_user: Optional[:class:`User`]
The user whose stream to display for this invite, required if `target_type` is `TargetType.stream`. The user must be streaming in the channel.
The user whose stream to display for this invite, required if `target_type` is `TargetType.stream`.
The user must be streaming in the channel.

.. versionadded:: 2.0

target_application_id: Optional[:class:`int`]
The id of the embedded application for the invite, required if `target_type` is `TargetType.embedded_application`.
The id of the embedded application for the invite, required if `target_type` is
`TargetType.embedded_application`.

.. versionadded:: 2.0

target_event: Optional[:class:`ScheduledEvent`]
target_event: Optional[:class:`.ScheduledEvent`]
The scheduled event object to link to the event.
Shortcut to :meth:`Invite.set_scheduled_event`
Shortcut to :meth:`.Invite.set_scheduled_event`

See :meth:`Invite.set_scheduled_event` for more
See :meth:`.Invite.set_scheduled_event` for more
info on event invite linking.

.. versionadded:: 2.0
Expand Down Expand Up @@ -1383,11 +1377,13 @@ async def send(

.. versionadded:: 1.4

reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`,
:class:`~discord.PartialMessage`]
A reference to the :class:`~discord.Message` to which you are replying, this can be created using
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
whether this mentions the author of the referenced message using the :attr:`~discord.AllowedMentions.replied_user`
attribute of ``allowed_mentions`` or by setting ``mention_author``.
whether this mentions the author of the referenced message using the
:attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
setting ``mention_author``.

.. versionadded:: 1.6

Expand Down Expand Up @@ -1732,7 +1728,7 @@ def history(
If a datetime is provided, it is recommended to use a UTC aware datetime.
If the datetime is naive, it is assumed to be local time.
When using this argument, the maximum limit is 101. Note that if the limit is an
even number then this will return at most limit + 1 messages.
even number, then this will return at most limit + 1 messages.
oldest_first: Optional[:class:`bool`]
If set to ``True``, return messages in oldest->newest order. Defaults to ``True`` if
``after`` is specified, otherwise ``False``.
Expand Down
17 changes: 8 additions & 9 deletions discord/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
from .types.activity import Activity as ActivityPayload
from .types.activity import (
ActivityAssets,
ActivityButton,
ActivityParty,
ActivityTimestamps,
)
Expand Down Expand Up @@ -166,15 +165,15 @@ class Activity(BaseActivity):
The user's current state. For example, "In Game".
details: Optional[:class:`str`]
The detail of the user's current activity.
timestamps: :class:`dict`
timestamps: Dict[:class:`str`, :class:`int`]
A dictionary of timestamps. It contains the following optional keys:

- ``start``: Corresponds to when the user started doing the
activity in milliseconds since Unix epoch.
- ``end``: Corresponds to when the user will finish doing the
activity in milliseconds since Unix epoch.

assets: :class:`dict`
assets: Dict[:class:`str`, :class:`str`]
A dictionary representing the images and their hover text of an activity.
It contains the following optional keys:

Expand All @@ -183,12 +182,12 @@ class Activity(BaseActivity):
- ``small_image``: A string representing the ID for the small image asset.
- ``small_text``: A string representing the text when hovering over the small image asset.

party: :class:`dict`
party: Dict[:class:`str`, Union[:class:`str`, List[:class:`int`]]]
A dictionary representing the activity party. It contains the following optional keys:

- ``id``: A string representing the party ID.
- ``size``: A list of up to two integer elements denoting (current_size, maximum_size).
buttons: Union[List[:class:`dict`], List[:class:`str`]]
buttons: Union[List[Dict[:class:`str`, :class:`str`]], List[:class:`str`]]
A list of dictionaries representing custom buttons shown in a rich presence.
Each dictionary contains the following keys:

Expand All @@ -197,7 +196,7 @@ class Activity(BaseActivity):

.. note::

Bots cannot access a user's activity button URLs. Therefore the type of this attribute
Bots cannot access a user's activity button URLs. Therefore, the type of this attribute
will be List[:class:`str`] when received through the gateway.

.. versionadded:: 2.0
Expand Down Expand Up @@ -475,8 +474,8 @@ class Streaming(BaseActivity):

url: :class:`str`
The stream's URL.
assets: :class:`dict`
A dictionary comprising of similar keys than those in :attr:`Activity.assets`.
assets: Dict[:class:`str`, :class:`str`]
A dictionary comprised of similar keys than those in :attr:`Activity.assets`.
"""

__slots__ = ("platform", "name", "game", "url", "details", "assets")
Expand Down Expand Up @@ -509,7 +508,7 @@ def twitch_name(self):
"""Optional[:class:`str`]: If provided, the twitch name of the user streaming.

This corresponds to the ``large_image`` key of the :attr:`Streaming.assets`
dictionary if it starts with ``twitch:``. Typically set by the Discord client.
dictionary if it starts with ``twitch:``. Typically this is set by the Discord client.
"""

try:
Expand Down
4 changes: 2 additions & 2 deletions discord/appinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AppInfo:
Whether the bot can be invited by anyone or if it is locked
to the application owner.
bot_require_code_grant: :class:`bool`
Whether the bot requires the completion of the full oauth2 code
Whether the bot requires the completion of the full OAuth2 code
grant flow to join.
rpc_origins: Optional[List[:class:`str`]]
A list of RPC origin URLs, if RPC is enabled.
Expand Down Expand Up @@ -188,7 +188,7 @@ def cover_image(self) -> Optional[Asset]:
@property
def guild(self) -> Optional[Guild]:
"""Optional[:class:`Guild`]: If this application is a game sold on Discord,
this field will be the guild to which it has been linked
this field will be the guild to which it has been linked.

.. versionadded:: 1.3
"""
Expand Down
2 changes: 1 addition & 1 deletion discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class AuditLogEntry(Hashable):
The reason this action was done.
extra: Any
Extra information that this entry has that might be useful.
For most actions, this is ``None``. However in some cases it
For most actions, this is ``None``. However, in some cases it
contains extra information. See :class:`AuditLogAction` for
which actions have this field filled out.
"""
Expand Down
13 changes: 7 additions & 6 deletions discord/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ class AutoModActionMetadata:
Attributes
-----------
channel_id: :class:`int`
The ID of the channel to send the message to. Only for actions of type :attr:`AutoModActionType.send_alert_message`.
The ID of the channel to send the message to.
Only for actions of type :attr:`AutoModActionType.send_alert_message`.
timeout_duration: :class:`datetime.timedelta`
How long the member that triggered the action should be timed out for. Only for actions of type :attr:`AutoModActionType.timeout`.
How long the member that triggered the action should be timed out for.
Only for actions of type :attr:`AutoModActionType.timeout`.
"""
# maybe add a table of action types and attributes?

Expand Down Expand Up @@ -124,7 +126,6 @@ def __repr__(self) -> str:
return f"<AutoModActionMetadata {inner}>"



class AutoModAction:
"""Represents an action for a guild's auto moderation rule.

Expand Down Expand Up @@ -200,7 +201,7 @@ def to_dict(self) -> Dict:
return data

@classmethod
def from_dict(cls, data: AutoModActionMetadataPayload):
def from_dict(cls, data: AutoModTriggerMetadataPayload):
kwargs = {}

if (keyword_filter := data.get("keyword_filter")) is not None:
Expand Down Expand Up @@ -339,8 +340,8 @@ def exempt_roles(self) -> List[Union[Role, Object]]:

@cached_property
def exempt_channels(self) -> List[Union[Union[TextChannel, ForumChannel, VoiceChannel], Object]]:
"""List[Union[Union[:class:`TextChannel`, :class:`ForumChannel`, :class:`VoiceChannel`], :class:`Object`]]: The channels
that are exempt from this rule.
"""List[Union[Union[:class:`TextChannel`, :class:`ForumChannel`, :class:`VoiceChannel`], :class:`Object`]]:
The channels that are exempt from this rule.

If a channel is not found in the guild's cache,
then it will be returned as an :class:`Object`.
Expand Down
Loading