Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue-Robin-Taken authored Aug 10, 2024
2 parents fb609a0 + c58505e commit 02cb863
Show file tree
Hide file tree
Showing 62 changed files with 2,713 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run tdg-github-action
uses: ribtoks/[email protected].10-beta
uses: ribtoks/[email protected].11-beta
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
# - --remove-duplicate-keys
# - --remove-unused-variables
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand Down
54 changes: 53 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ possible (see our [Version Guarantees] for more info).

These changes are available on the `master` branch, but have not yet been released.

### Changed

- Renamed `cover` property of `ScheduledEvent` and `cover` argument of
`ScheduledEvent.edit` to `image`.
([#2496](https://github.com/Pycord-Development/pycord/pull/2496))

## [2.6.0] - 2024-07-09

### Added

- Added `banner` parameter to `ClientUser.edit`.
Expand All @@ -24,8 +32,22 @@ These changes are available on the `master` branch, but have not yet been releas
([#2421](https://github.com/Pycord-Development/pycord/pull/2421))
- Added `member` data to the `raw_reaction_remove` event.
([#2412](https://github.com/Pycord-Development/pycord/pull/2412))
- Added `Poll` and all related features.
([#2408](https://github.com/Pycord-Development/pycord/pull/2408))
- Added `stacklevel` param to `utils.warn_deprecated` and `utils.deprecated`.
([#2450](https://github.com/Pycord-Development/pycord/pull/2450))
- Added support for user-installable applications.
([#2409](https://github.com/Pycord-Development/pycord/pull/2409))
- Added support for one-time purchases for Discord monetization.
([#2438](https://github.com/Pycord-Development/pycord/pull/2438))
- Added `Attachment.title`.
([#2486](https://github.com/Pycord-Development/pycord/pull/2486))
- Added `MemberFlags`. ([#2489](https://github.com/Pycord-Development/pycord/pull/2489))
- Added `bypass_verification` parameter to `Member.edit`.
([#2489](https://github.com/Pycord-Development/pycord/pull/2489))
- Added `RoleFlags`. ([#2487](https://github.com/Pycord-Development/pycord/pull/2487))
- Added `MessageCall` information.
([#2488](https://github.com/Pycord-Development/pycord/pull/2488))

### Fixed

Expand All @@ -38,6 +60,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2390](https://github.com/Pycord-Development/pycord/pull/2390))
- Fixed `NameError` in some instances of `Interaction`.
([#2402](https://github.com/Pycord-Development/pycord/pull/2402))
- Fixed interactions being ignored due to `PartialMessage.id` being of type `str`.
([#2406](https://github.com/Pycord-Development/pycord/pull/2406))
- Fixed the type-hinting of `ScheduledEvent.subscribers` to reflect actual behavior.
([#2400](https://github.com/Pycord-Development/pycord/pull/2400))
- Fixed `ScheduledEvent.subscribers` behavior with `limit=None`.
Expand All @@ -54,6 +78,18 @@ These changes are available on the `master` branch, but have not yet been releas
([#2448](https://github.com/Pycord-Development/pycord/pull/2448))
- Fixed missing `application_id` in `Entitlement.delete`.
([#2458](https://github.com/Pycord-Development/pycord/pull/2458))
- Fixed issues with enums as `Option` types with long descriptions or too many values.
([#2463](https://github.com/Pycord-Development/pycord/pull/2463))
- Fixed many inaccurate type hints throughout the library.
([#2457](https://github.com/Pycord-Development/pycord/pull/2457))
- Fixed `AttributeError` due to `discord.Option` being initialised with `input_type` set
to `None`. ([#2464](https://github.com/Pycord-Development/pycord/pull/2464))
- Fixed `remove_application_command` causing issues while reloading extensions.
([#2480](https://github.com/Pycord-Development/pycord/pull/2480))
- Fixed outdated logic for filtering and sorting audit log entries.
([#2371](https://github.com/Pycord-Development/pycord/pull/2371))
- Further fixed logic when fetching audit logs.
([#2492](https://github.com/Pycord-Development/pycord/pull/2492))

### Changed

Expand All @@ -67,12 +103,27 @@ These changes are available on the `master` branch, but have not yet been releas
([#2417](https://github.com/Pycord-Development/pycord/pull/2417))
- `Guild.query_members` now accepts `limit=None` to retrieve all members.
([#2419](https://github.com/Pycord-Development/pycord/pull/2419))
- `ApplicationCommand.guild_only` is now deprecated in favor of
`ApplicationCommand.contexts`.
([#2409](https://github.com/Pycord-Development/pycord/pull/2409))
- `Message.interaction` is now deprecated in favor of `Message.interaction_metadata`.
([#2409](https://github.com/Pycord-Development/pycord/pull/2409))
- Replaced `Client.fetch_entitlements` with `Client.entitlements`, which returns an
`EntitlementIterator`.
([#2490](https://github.com/Pycord-Development/pycord/pull/2490))
- Changed the error message that appears when attempting to add a subcommand group to a
subcommand group. ([#2275](https://github.com/Pycord-Development/pycord/pull/2275))

### Removed

- Removed the `delete_message_days` parameter from ban methods. Please use
`delete_message_seconds` instead.
([#2421](https://github.com/Pycord-Development/pycord/pull/2421))
- Removed the `oldest_first` parameter from `Guild.audit_logs` in favor of the `before`
and `after` parameters.
([#2371](https://github.com/Pycord-Development/pycord/pull/2371))
- Removed the `vanity_code` parameter from `Guild.edit`.
([#2491](https://github.com/Pycord-Development/pycord/pull/2491))

## [2.5.0] - 2024-03-02

Expand Down Expand Up @@ -844,7 +895,8 @@ These changes are available on the `master` branch, but have not yet been releas
- Fix py3.10 UnionType checks issue.
([#1240](https://github.com/Pycord-Development/pycord/pull/1240))

[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.5.0...HEAD
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.6.0...HEAD
[2.6.0]: https://github.com/Pycord-Development/pycord/compare/v2.5.0...2.6.0
[2.5.0]: https://github.com/Pycord-Development/pycord/compare/v2.4.1...v2.5.0
[2.4.1]: https://github.com/Pycord-Development/pycord/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/Pycord-Development/pycord/compare/v2.3.3...v2.4.0
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Key Features
- Modern Pythonic API using ``async`` and ``await``.
- Proper rate limit handling.
- Optimised for both speed and memory usage.
- Full Application Command Support
- Full application API support.

Installing
----------
Expand Down
1 change: 1 addition & 0 deletions discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from .partial_emoji import *
from .permissions import *
from .player import *
from .poll import *
from .raw_models import *
from .reaction import *
from .role import *
Expand Down
28 changes: 22 additions & 6 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
from .guild import Guild
from .member import Member
from .message import Message, MessageReference, PartialMessage
from .poll import Poll
from .state import ConnectionState
from .threads import Thread
from .types.channel import Channel as ChannelPayload
Expand All @@ -115,7 +116,7 @@ async def _single_delete_strategy(


async def _purge_messages_helper(
channel: TextChannel | Thread | VoiceChannel,
channel: TextChannel | StageChannel | Thread | VoiceChannel,
*,
limit: int | None = 100,
check: Callable[[Message], bool] = MISSING,
Expand Down Expand Up @@ -1345,12 +1346,13 @@ async def send(
file: File = ...,
stickers: Sequence[GuildSticker | StickerItem] = ...,
delete_after: float = ...,
nonce: str | int = ...,
nonce: int | str = ...,
enforce_nonce: bool = ...,
allowed_mentions: AllowedMentions = ...,
reference: Message | MessageReference | PartialMessage = ...,
mention_author: bool = ...,
view: View = ...,
poll: Poll = ...,
suppress: bool = ...,
silent: bool = ...,
) -> Message: ...
Expand All @@ -1365,12 +1367,13 @@ async def send(
files: list[File] = ...,
stickers: Sequence[GuildSticker | StickerItem] = ...,
delete_after: float = ...,
nonce: str | int = ...,
nonce: int | str = ...,
enforce_nonce: bool = ...,
allowed_mentions: AllowedMentions = ...,
reference: Message | MessageReference | PartialMessage = ...,
mention_author: bool = ...,
view: View = ...,
poll: Poll = ...,
suppress: bool = ...,
silent: bool = ...,
) -> Message: ...
Expand All @@ -1385,12 +1388,13 @@ async def send(
file: File = ...,
stickers: Sequence[GuildSticker | StickerItem] = ...,
delete_after: float = ...,
nonce: str | int = ...,
nonce: int | str = ...,
enforce_nonce: bool = ...,
allowed_mentions: AllowedMentions = ...,
reference: Message | MessageReference | PartialMessage = ...,
mention_author: bool = ...,
view: View = ...,
poll: Poll = ...,
suppress: bool = ...,
silent: bool = ...,
) -> Message: ...
Expand All @@ -1405,12 +1409,13 @@ async def send(
files: list[File] = ...,
stickers: Sequence[GuildSticker | StickerItem] = ...,
delete_after: float = ...,
nonce: str | int = ...,
nonce: int | str = ...,
enforce_nonce: bool = ...,
allowed_mentions: AllowedMentions = ...,
reference: Message | MessageReference | PartialMessage = ...,
mention_author: bool = ...,
view: View = ...,
poll: Poll = ...,
suppress: bool = ...,
silent: bool = ...,
) -> Message: ...
Expand All @@ -1432,6 +1437,7 @@ async def send(
reference=None,
mention_author=None,
view=None,
poll=None,
suppress=None,
silent=None,
):
Expand Down Expand Up @@ -1465,7 +1471,7 @@ async def send(
The file to upload.
files: List[:class:`~discord.File`]
A list of files to upload. Must be a maximum of 10.
nonce: :class:`int`
nonce: Union[:class:`str`, :class:`int`]
The nonce to use for sending this message. If the message was successfully sent,
then the message will have a nonce with this value.
enforce_nonce: Optional[:class:`bool`]
Expand Down Expand Up @@ -1515,6 +1521,10 @@ async def send(
Whether to suppress push and desktop notifications for the message.
.. versionadded:: 2.4
poll: :class:`Poll`
The poll to send.
.. versionadded:: 2.6
Returns
-------
Expand Down Expand Up @@ -1594,6 +1604,9 @@ async def send(
else:
components = None

if poll:
poll = poll.to_dict()

if file is not None and files is not None:
raise InvalidArgument("cannot pass both file and files parameter to send()")

Expand All @@ -1616,6 +1629,7 @@ async def send(
stickers=stickers,
components=components,
flags=flags,
poll=poll,
)
finally:
file.close()
Expand Down Expand Up @@ -1643,6 +1657,7 @@ async def send(
stickers=stickers,
components=components,
flags=flags,
poll=poll,
)
finally:
for f in files:
Expand All @@ -1661,6 +1676,7 @@ async def send(
stickers=stickers,
components=components,
flags=flags,
poll=poll,
)

ret = state.create_message(channel=channel, data=data)
Expand Down
2 changes: 1 addition & 1 deletion discord/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def _from_user_banner(cls, state, user_id: int, banner_hash: str) -> Asset:
)

@classmethod
def _from_scheduled_event_cover(
def _from_scheduled_event_image(
cls, state, event_id: int, cover_hash: str
) -> Asset:
return cls(
Expand Down
16 changes: 8 additions & 8 deletions discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ def _transform_avatar(entry: AuditLogEntry, data: str | None) -> Asset | None:
return Asset._from_avatar(entry._state, entry._target_id, data) # type: ignore


def _transform_scheduled_event_cover(
def _transform_scheduled_event_image(
entry: AuditLogEntry, data: str | None
) -> Asset | None:
if data is None:
return None
return Asset._from_scheduled_event_cover(entry._state, entry._target_id, data)
return Asset._from_scheduled_event_image(entry._state, entry._target_id, data)


def _guild_hash_transformer(
Expand Down Expand Up @@ -193,16 +193,16 @@ def _transform_type(

def _transform_actions(
entry: AuditLogEntry, data: list[AutoModActionPayload] | None
) -> AutoModAction | None:
) -> list[AutoModAction] | None:
if data is None:
return None
else:
return [AutoModAction.from_dict(d) for d in data]


def _transform_trigger_metadata(
entry: AuditLogEntry, data: list[AutoModActionPayload] | None
) -> AutoModAction | None:
entry: AuditLogEntry, data: AutoModTriggerMetadataPayload | None
) -> AutoModTriggerMetadata | None:
if data is None:
return None
else:
Expand Down Expand Up @@ -274,7 +274,7 @@ class AuditLogChanges:
_enum_transformer(enums.ScheduledEventLocationType),
),
"command_id": ("command_id", _transform_snowflake),
"image_hash": ("cover", _transform_scheduled_event_cover),
"image_hash": ("image", _transform_scheduled_event_image),
"trigger_type": (None, _enum_transformer(enums.AutoModTriggerType)),
"event_type": (None, _enum_transformer(enums.AutoModEventType)),
"actions": (None, _transform_actions),
Expand Down Expand Up @@ -309,7 +309,7 @@ def __init__(
"$add_allow_list",
]:
self._handle_trigger_metadata(
self.before, self.after, entry, elem["new_value"], attr
self.before, self.after, entry, elem["new_value"], attr # type: ignore
)
continue
elif attr in [
Expand All @@ -318,7 +318,7 @@ def __init__(
"$remove_allow_list",
]:
self._handle_trigger_metadata(
self.after, self.before, entry, elem["new_value"], attr
self.after, self.before, entry, elem["new_value"], attr # type: ignore
)
continue

Expand Down
Loading

0 comments on commit 02cb863

Please sign in to comment.