Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from Pycord-Development:master #56

Merged
merged 61 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ac4e173
docs: Update localizations from Crowdin (#2570)
NyuwBot Sep 6, 2024
646e51a
fix: user context command members having a `None` guild (#2573)
plun1331 Sep 10, 2024
94a68f7
fix: remove broken link
Lulalaby Sep 11, 2024
2c47eab
chore(deps-dev): update pytest requirement from ~=8.3.2 to ~=8.3.3 in…
dependabot[bot] Sep 11, 2024
1533fe5
fix: webhooks not sending attachment info (#2513)
NeloBlivion Sep 11, 2024
5a03f9d
Revert "fix: remove broken link"
Lulalaby Sep 12, 2024
74d2827
chore: update changelog
Dorukyum Sep 15, 2024
cd53c9c
chore: update changelog with v2.6.1
Dorukyum Sep 15, 2024
96180fb
fix: Single Member Enums Fail Converting To Option (#2577)
Icebluewolf Sep 16, 2024
0fdbb21
docs: update changelog to be consistent (#2583)
JustaSqu1d Sep 20, 2024
e09c607
chore(deps): bump levenshtein from 0.25.1 to 0.26.0 in the minor-vers…
dependabot[bot] Sep 20, 2024
bef59ac
fix: make FFmpegOpusAudio codec behave as docs suggest (#2581)
felix920506 Sep 20, 2024
1051ffa
chore(deps-dev): update pylint requirement from ~=3.2.7 to ~=3.3.0 in…
dependabot[bot] Sep 21, 2024
ebde918
fix: audio plays in fast forward for first few seconds (#2584)
felix920506 Sep 21, 2024
836533d
chore(deps-dev): bump bandit from 1.7.9 to 1.7.10 in the patch-versio…
dependabot[bot] Sep 24, 2024
a2117ad
chore(deps-dev): update pylint requirement from ~=3.3.0 to ~=3.3.1 in…
dependabot[bot] Sep 25, 2024
d39caa0
feat: Add optional filter parameter to utils.basic_autocomplete (#2590)
sweetbrulee Sep 28, 2024
c430fbb
fix: `is_owner()` `user` type hint (#2593)
controlado Sep 30, 2024
f6b914e
fix: add Member import for typehinting (#2596)
plun1331 Oct 4, 2024
d7d3afb
fix: Send correct data to http.create_test_entitlement() (#2595)
lukenamop Oct 4, 2024
e8311f2
fix: don't try to do an interaction_check if there isn't a user avail…
Revnoplex Oct 4, 2024
aa50958
ci(deps): bump ribtoks/tdg-github-action from 0.4.12.pre.beta to 0.4.…
dependabot[bot] Oct 8, 2024
c67d956
chore(deps-dev): bump pre-commit from 3.8.0 to 4.0.0 in the major-ver…
dependabot[bot] Oct 8, 2024
6c384c7
chore(pre-commit): pre-commit autoupdate (#2599)
pre-commit-ci[bot] Oct 8, 2024
8952eda
fix(docs): remove broken link
Lulalaby Oct 9, 2024
454a146
chore(deps-dev): bump pre-commit from 4.0.0 to 4.0.1 in the patch-ver…
dependabot[bot] Oct 9, 2024
c23d8fc
fix: category cooldown commands works in dms like other guild cooldow…
Revnoplex Oct 10, 2024
1273941
docs: Add missing error for Message.edit (#2604)
iyad-f Oct 10, 2024
9a83a2a
feat: Add function to get elapsed time of playing audio on VoiceClien…
felix920506 Oct 11, 2024
602c38b
chore(pre-commit): pre-commit autoupdate (#2607)
pre-commit-ci[bot] Oct 14, 2024
fce7396
chore(deps-dev): update mypy requirement from ~=1.11.2 to ~=1.12.0 (#…
dependabot[bot] Oct 15, 2024
33adf22
refactor: python implementation of `audioop.mul` (#2176)
davidhozic Oct 17, 2024
72ba1b1
feat: app emojis (#2501)
NeloBlivion Oct 17, 2024
d101120
chore(deps-dev): update mypy requirement from ~=1.12.0 to ~=1.13.0 (#…
dependabot[bot] Oct 23, 2024
1c9c5bb
fix: prevent unclosed client session / unclosed connector (#2618)
honzajavorek Oct 23, 2024
9a6cbff
docs: fix minor changelog grammar and wording (#2619)
JustaSqu1d Oct 24, 2024
e25ea6f
fix: handle improper 1000 closures by discord (#2632)
Quintenvw Oct 29, 2024
e8ddfcd
chore(deps): bump levenshtein from 0.26.0 to 0.26.1 in the patch-vers…
dependabot[bot] Oct 29, 2024
8ed5ae5
chore(pre-commit): pre-commit autoupdate (#2629)
pre-commit-ci[bot] Oct 29, 2024
7c7886e
docs: :memo: Add `@bridge_option` to docs (#2630)
Paillat-dev Oct 29, 2024
7e7cbdd
fix: :bug: Union type cannot be used in `ctx`. (#2611)
Paillat-dev Oct 29, 2024
05cf45e
fix: TypeError when adding skus to entitlements() method (#2628)
UnBonWhisky Oct 29, 2024
48c5950
feat: add missing with_counts parameter to fetch_guilds method (#2615)
BruhDark Nov 3, 2024
968a586
feat: :sparkles: Add missing soundboard and monetization permissions …
Paillat-dev Nov 3, 2024
d29f73d
docs: :memo: Add timeout time to `View` docstring (#2638)
Paillat-dev Nov 7, 2024
1f17777
fix: sending polls with PartialWebhook (#2624)
tyrantlink Nov 8, 2024
85319f9
fix: add missing channel type 16 (#2639)
Lulalaby Nov 8, 2024
bfcc89d
chore(deps): update setuptools requirement from <=72.2.0,>=62.6 to >=…
dependabot[bot] Nov 8, 2024
0f1a079
chore: add note about python version support since it differs from th…
Lulalaby Nov 11, 2024
49cb48a
chore(deps): bump sphinx-intl from 2.2.0 to 2.3.0 in the minor-versio…
dependabot[bot] Nov 11, 2024
c8eee71
chore(deps): update setuptools requirement from <=75.3.0,>=62.6 to >=…
dependabot[bot] Nov 11, 2024
63e1ab0
chore(deps): update setuptools requirement from <=75.4.0,>=62.6 to >=…
dependabot[bot] Nov 13, 2024
e4946ec
fix: :bug: Fix `None` default role in user installed apps. (#2650)
Paillat-dev Nov 14, 2024
5355945
chore(deps-dev): bump bandit from 1.7.10 to 1.8.0 in the minor-versio…
dependabot[bot] Nov 27, 2024
1b2972b
chore(deps): update setuptools requirement from <=75.5.0,>=62.6 to >=…
dependabot[bot] Nov 27, 2024
da90e33
docs: :memo: Better documentation for latency properties (#2653)
Paillat-dev Nov 28, 2024
f3fc4b1
chore(deps): bump sphinx-intl from 2.3.0 to 2.3.1 in the patch-versio…
dependabot[bot] Dec 3, 2024
397edcb
chore(deps-dev): update pytest requirement from ~=8.3.3 to ~=8.3.4 (#…
dependabot[bot] Dec 3, 2024
db5b466
chore(deps-dev): update pylint requirement from ~=3.3.1 to ~=3.3.2 (#…
dependabot[bot] Dec 3, 2024
52ee8fb
fix: use `property` instead of `NewType(...)` to fix type annotations…
probablyjassin Dec 3, 2024
cab0a37
docs: Update localizations from Crowdin (#2605)
NyuwBot Dec 12, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/todo-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Track TODO Action"
uses: ribtoks/[email protected].12-beta
uses: ribtoks/[email protected].13-beta
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: \.(po|pot|yml|yaml)$
Expand All @@ -21,7 +21,7 @@ repos:
# - --remove-duplicate-keys
# - --remove-unused-variables
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.0
hooks:
- id: pyupgrade
exclude: \.(po|pot|yml|yaml)$
Expand All @@ -31,7 +31,7 @@ repos:
- id: isort
exclude: \.(po|pot|yml|yaml)$
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
args: [--safe, --quiet]
Expand Down
77 changes: 68 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ possible (see our [Version Guarantees] for more info).

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

⚠️ **This Version Removes Support For Python 3.8** ⚠️
⚠️ **This version removes support for Python 3.8.** ⚠️

### Added

Expand All @@ -22,36 +22,95 @@ These changes are available on the `master` branch, but have not yet been releas
`tags`. ([#2520](https://github.com/Pycord-Development/pycord/pull/2520))
- Added `Member.guild_banner` and `Member.display_banner` properties.
([#2556](https://github.com/Pycord-Development/pycord/pull/2556))
- Added support for Application Emojis.
([#2501](https://github.com/Pycord-Development/pycord/pull/2501))
- Added `cache_app_emojis` parameter to `Client`.
([#2501](https://github.com/Pycord-Development/pycord/pull/2501))
- Added `elapsed` method to `VoiceClient`.
([#2587](https://github.com/Pycord-Development/pycord/pull/2587/))
- Added optional `filter` parameter to `utils.basic_autocomplete()`.
([#2590](https://github.com/Pycord-Development/pycord/pull/2590))
- Added missing `with_counts` parameter to `fetch_guilds` method.
([#2615](https://github.com/Pycord-Development/pycord/pull/2615))
- Added missing permissions: `Permissions.use_soundboard`,
`Permissions.use_external_sounds` and
`Permissions.view_creator_monetization_analytics`.
([#2620](https://github.com/Pycord-Development/pycord/pull/2620))

### Fixed

- Fixed `Enum` options not setting the correct type when only one choice is available.
([#2577](https://github.com/Pycord-Development/pycord/pull/2577))
- Fixed `codec` option for `FFmpegOpusAudio` class to make it in line with
documentation. ([#2581](https://github.com/Pycord-Development/pycord/pull/2581))
- Fixed a possible bug where audio would play too fast at the beginning of audio files.
([#2584](https://github.com/Pycord-Development/pycord/pull/2584))
- Fixed paginator not responding when using `Paginator.edit()` with default parameters.
([#2594](https://github.com/Pycord-Development/pycord/pull/2594))
- Fixed the `is_owner()` `user` type hint: `User` -> `User | Member`.
([#2593](https://github.com/Pycord-Development/pycord/pull/2593))
- Fixed `Guild.create_test_entitlement()` and `User.create_test_entitlement()` using the
guild/user ID instead of the application ID.
([#2595](https://github.com/Pycord-Development/pycord/pull/2595))
- Fixed `BucketType.category` cooldown commands not functioning correctly in private
channels. ([#2603](https://github.com/Pycord-Development/pycord/pull/2603))
- Fixed `SlashCommand`'s `ctx` parameter couldn't be `Union` type.
([#2611](https://github.com/Pycord-Development/pycord/pull/2611))
- Fixed `TypeError` when passing `skus` parameter in `Client.entitlements()`.
([#2627](https://github.com/Pycord-Development/pycord/issues/2627))
- Fixed `AttributeError` when sending polls with `PartialWebook`.
([#2624](https://github.com/Pycord-Development/pycord/pull/2624))
- Fixed `AttributeError` when accessing `Member.guild_permissions` for user installed
apps. ([#2650](https://github.com/Pycord-Development/pycord/pull/2650))
- Fixed type annotations of cached properties.
([#2635](https://github.com/Pycord-Development/pycord/issues/2635))

### Changed

- Renamed `cover` property of `ScheduledEvent` and `cover` argument of
`ScheduledEvent.edit` to `image`.
([#2496](https://github.com/Pycord-Development/pycord/pull/2496))
- ⚠️ **This Version Removes Support For Python 3.8** ⚠️
- ⚠️ **Removed support for Python 3.8.**
([#2521](https://github.com/Pycord-Development/pycord/pull/2521))
- `Emoji` has been renamed to `GuildEmoji`.
([#2501](https://github.com/Pycord-Development/pycord/pull/2501))
- Replaced audioop (deprecated module) implementation of `PCMVolumeTransformer.read`
method with a pure Python equivalent.
([#2176](https://github.com/Pycord-Development/pycord/pull/2176))

### Deprecated

- Deprecated `AppInfo.summary` in favor of `AppInfo.description`.
([#2520](https://github.com/Pycord-Development/pycord/pull/2520))
- Deprecated `Emoji` in favor of `GuildEmoji`.
([#2501](https://github.com/Pycord-Development/pycord/pull/2501))

## [2.6.1] - 2024-09-15

### Fixed

- Fixed `EntitlementIterator` behavior with `limit > 100`.
- Fixed premature garbage collection of tasks.
([#2510](https://github.com/Pycord-Development/pycord/pull/2510))
- Fixed `EntitlementIterator` type hints and behavior with `limit > 100`.
([#2555](https://github.com/Pycord-Development/pycord/pull/2555))
- Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside
`@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed the typehint in `ConnectionState._polls` to reflect actual behavior, changing it
from `Guild` to `Poll`.
- Fixed the type hint in `ConnectionState._polls` to reflect actual behavior, changing
it from `Guild` to `Poll`.
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and
`RawMessagePollVoteEvent`.
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to
`SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed `PartialMessage`s causing errors when created from `PartialMessageable`.
- Fixed `PartialMessage` causing errors when created from `PartialMessageable`.
([#2568](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed the `guild` attribute of `Member`s received from a `UserCommand` being `None`.
([#2573](https://github.com/Pycord-Development/pycord/pull/2573))
- Fixed `Webhook.send`, which did not include attachment data.
([#2513](https://github.com/Pycord-Development/pycord/pull/2513))
- Fixed inverted type hints in `CheckAnyFailure`.
([#2502](https://github.com/Pycord-Development/pycord/pull/2502))

## [2.6.0] - 2024-07-09

Expand Down Expand Up @@ -105,7 +164,7 @@ These changes are available on the `master` branch, but have not yet been releas
([#2407](https://github.com/Pycord-Development/pycord/pull/2407))
- Fixed invalid data being passed to `Interaction._guild` in certain cases.
([#2411](https://github.com/Pycord-Development/pycord/pull/2411))
- Fixed option typehints being ignored when using `parameter_name`.
- Fixed option type hints being ignored when using `parameter_name`.
([#2417](https://github.com/Pycord-Development/pycord/pull/2417))
- Fixed parameter `embed=None` causing `AttributeError` on `PartialMessage.edit`.
([#2446](https://github.com/Pycord-Development/pycord/pull/2446))
Expand All @@ -130,7 +189,7 @@ These changes are available on the `master` branch, but have not yet been releas

- Changed the type of `Guild.bitrate_limit` to `int`.
([#2387](https://github.com/Pycord-Development/pycord/pull/2387))
- HTTP requests that fail with a 503 status are now re-tried.
- HTTP requests that fail with a 503 status are now retried.
([#2395](https://github.com/Pycord-Development/pycord/pull/2395))
- `option` decorator now accepts `input_type`.
([#2417](https://github.com/Pycord-Development/pycord/pull/2417))
Expand Down Expand Up @@ -339,7 +398,7 @@ These changes are available on the `master` branch, but have not yet been releas
([#2145](https://github.com/Pycord-Development/pycord/pull/2145))
- Fixed `Thread.applied_tags` not being updated.
([#2146](https://github.com/Pycord-Development/pycord/pull/2146))
- Fixed type hinting of `author` property of `ApplicationContext` to include
- Fixed type-hinting of `author` property of `ApplicationContext` to include
type-hinting of `User` or `Member`.
([#2148](https://github.com/Pycord-Development/pycord/pull/2148))
- Fixed missing `delete_after` parameter in overload type-hinting for `Webhook.send()`.
Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Pycord is a modern, easy to use, feature-rich, and async ready API wrapper for D

======

Note
----

Pycord supports Python ``3.9`` - ``3.12``

Key Features
------------

Expand Down
10 changes: 6 additions & 4 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ async def _edit(
except KeyError:
pass
else:
if isinstance(default_reaction_emoji, _EmojiTag): # Emoji, PartialEmoji
if isinstance(
default_reaction_emoji, _EmojiTag
): # GuildEmoji, PartialEmoji
default_reaction_emoji = default_reaction_emoji._to_partial()
elif isinstance(default_reaction_emoji, int):
default_reaction_emoji = PartialEmoji(
Expand All @@ -523,7 +525,7 @@ async def _edit(
default_reaction_emoji = PartialEmoji.from_str(default_reaction_emoji)
else:
raise InvalidArgument(
"default_reaction_emoji must be of type: Emoji | int | str"
"default_reaction_emoji must be of type: GuildEmoji | int | str"
)

options["default_reaction_emoji"] = (
Expand Down Expand Up @@ -1792,7 +1794,7 @@ def can_send(self, *objects) -> bool:
"Message": "send_messages",
"Embed": "embed_links",
"File": "attach_files",
"Emoji": "use_external_emojis",
"GuildEmoji": "use_external_emojis",
"GuildSticker": "use_external_stickers",
}
# Can't use channel = await self._get_channel() since its async
Expand All @@ -1817,7 +1819,7 @@ def can_send(self, *objects) -> bool:
mapping.get(type(obj).__name__) or mapping[obj.__name__]
)

if type(obj).__name__ == "Emoji":
if type(obj).__name__ == "GuildEmoji":
if (
obj._to_partial().is_unicode_emoji
or obj.guild_id == channel.guild.id
Expand Down
6 changes: 3 additions & 3 deletions discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import datetime

from . import abc
from .emoji import Emoji
from .emoji import GuildEmoji
from .guild import Guild
from .member import Member
from .role import Role
Expand Down Expand Up @@ -617,7 +617,7 @@ def target(
| User
| Role
| Invite
| Emoji
| GuildEmoji
| StageInstance
| GuildSticker
| Thread
Expand Down Expand Up @@ -689,7 +689,7 @@ def _convert_target_invite(self, target_id: int) -> Invite:
pass
return obj

def _convert_target_emoji(self, target_id: int) -> Emoji | Object:
def _convert_target_emoji(self, target_id: int) -> GuildEmoji | Object:
return self._state.get_emoji(target_id) or Object(id=target_id)

def _convert_target_message(self, target_id: int) -> Member | User | None:
Expand Down
18 changes: 15 additions & 3 deletions discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@
import sys
import traceback
from abc import ABC, abstractmethod
from typing import Any, Callable, Coroutine, Generator, Literal, Mapping, TypeVar
from typing import (
TYPE_CHECKING,
Any,
Callable,
Coroutine,
Generator,
Literal,
Mapping,
TypeVar,
)

from .client import Client
from .cog import CogMixin
Expand All @@ -56,6 +65,9 @@
from .user import User
from .utils import MISSING, async_all, find, get

if TYPE_CHECKING:
from .member import Member

CoroFunc = Callable[..., Coroutine[Any, Any, Any]]
CFT = TypeVar("CFT", bound=CoroFunc)

Expand Down Expand Up @@ -1407,7 +1419,7 @@ def after_invoke(self, coro):
self._after_invoke = coro
return coro

async def is_owner(self, user: User) -> bool:
async def is_owner(self, user: User | Member) -> bool:
"""|coro|

Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
Expand All @@ -1422,7 +1434,7 @@ async def is_owner(self, user: User) -> bool:

Parameters
----------
user: :class:`.abc.User`
user: Union[:class:`.abc.User`, :class:`.member.Member`]
The user to check for.

Returns
Expand Down
12 changes: 6 additions & 6 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

from . import utils
from .asset import Asset
from .emoji import Emoji
from .emoji import GuildEmoji
from .enums import (
ChannelType,
EmbeddedActivity,
Expand Down Expand Up @@ -143,7 +143,7 @@ def __init__(
self.emoji = PartialEmoji.from_str(emoji)
else:
raise TypeError(
"emoji must be a Emoji, PartialEmoji, or str and not"
"emoji must be a GuildEmoji, PartialEmoji, or str and not"
f" {emoji.__class__!r}"
)

Expand Down Expand Up @@ -1018,7 +1018,7 @@ class ForumChannel(_TextChannel):
The initial slowmode delay to set on newly created threads in this channel.

.. versionadded:: 2.3
default_reaction_emoji: Optional[:class:`str` | :class:`discord.Emoji`]
default_reaction_emoji: Optional[:class:`str` | :class:`discord.GuildEmoji`]
The default forum reaction emoji.

.. versionadded:: 2.5
Expand Down Expand Up @@ -1087,7 +1087,7 @@ async def edit(
default_auto_archive_duration: ThreadArchiveDuration = ...,
default_thread_slowmode_delay: int = ...,
default_sort_order: SortOrder = ...,
default_reaction_emoji: Emoji | int | str | None = ...,
default_reaction_emoji: GuildEmoji | int | str | None = ...,
available_tags: list[ForumTag] = ...,
require_tag: bool = ...,
overwrites: Mapping[Role | Member | Snowflake, PermissionOverwrite] = ...,
Expand Down Expand Up @@ -1138,10 +1138,10 @@ async def edit(self, *, reason=None, **options):
The default sort order type to use to order posts in this channel.

.. versionadded:: 2.3
default_reaction_emoji: Optional[:class:`discord.Emoji` | :class:`int` | :class:`str`]
default_reaction_emoji: Optional[:class:`discord.GuildEmoji` | :class:`int` | :class:`str`]
The default reaction emoji.
Can be a unicode emoji or a custom emoji in the forms:
:class:`Emoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').
:class:`GuildEmoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').

.. versionadded:: 2.5
available_tags: List[:class:`ForumTag`]
Expand Down
Loading
Loading