Skip to content

Commit

Permalink
Merge branch 'master' into voice_messages
Browse files Browse the repository at this point in the history
Signed-off-by: Ice Wolfy <[email protected]>
  • Loading branch information
Icebluewolf authored Dec 27, 2024
2 parents 1185576 + 3298cd0 commit 1802149
Show file tree
Hide file tree
Showing 93 changed files with 5,156 additions and 4,545 deletions.
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.1
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
62 changes: 52 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ 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 the following missing permissions: `Permissions.use_soundboard`,
`Permissions.use_external_sounds`, and
`Permissions.view_creator_monetization_analytics`.
([#2620](https://github.com/Pycord-Development/pycord/pull/2620))
- Added `VoiceMessage` subclass of `File` to allow voice messages to be sent.
([#2579](https://github.com/Pycord-Development/pycord/pull/2579))

Expand All @@ -33,6 +47,25 @@ These changes are available on the `master` branch, but have not yet been releas
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 `ctx` parameter of a `SlashCommand` not being `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))
- Fixed attachment metadata being set incorrectly in interaction responses causing it to be ignored.
([#2579](https://github.com/Pycord-Development/pycord/pull/2579))

Expand All @@ -43,11 +76,20 @@ These changes are available on the `master` branch, but have not yet been releas
([#2496](https://github.com/Pycord-Development/pycord/pull/2496))
- ⚠️ **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))
- Updated `Guild.filesize_limit` to 10 MB instead of 25 MB following Discord's API
changes. ([#2671](https://github.com/Pycord-Development/pycord/pull/2671))

### 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

Expand All @@ -69,9 +111,9 @@ These changes are available on the `master` branch, but have not yet been releas
`SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed `PartialMessage` causing errors when created from `PartialMessageable`.
([#2568](https://github.com/Pycord-Development/pycord/pull/2500))
- Fixed the `guild` attribute of `Member`s recieved from a `UserCommand` being `None`.
- 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` not including attachment data.
- 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))
Expand Down Expand Up @@ -128,7 +170,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 @@ -153,7 +195,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 @@ -354,15 +396,15 @@ These changes are available on the `master` branch, but have not yet been releas
([#2075](https://github.com/Pycord-Development/pycord/pull/2075))
- Fixed `before_invoke` not being run for `SlashCommandGroup`.
([#2091](https://github.com/Pycord-Development/pycord/pull/2091))
- Fixed `AttributeError` when accessing a `Select` object's values when it hasn't been
- Fixed `AttributeError` when accessing a `Select` object's values when it has not been
interacted with. ([#2104](https://github.com/Pycord-Development/pycord/pull/2104))
- Fixed `before_invoke` being run twice for slash subcommands.
([#2139](https://github.com/Pycord-Development/pycord/pull/2139))
- Fixed `Guild._member_count` sometimes not being set.
([#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 All @@ -385,7 +427,7 @@ These changes are available on the `master` branch, but have not yet been releas
([#2196](https://github.com/Pycord-Development/pycord/pull/2196))
- Fixed `AttributeError` when running permission checks without the `bot` scope.
([#2113](https://github.com/Pycord-Development/pycord/issues/2113))
- Fixed `Option` not working on bridge commands because `ext.commands.Command` doesn't
- Fixed `Option` not working on bridge commands because `ext.commands.Command` does not
recognize them. ([#2256](https://github.com/Pycord-Development/pycord/pull/2256))
- Fixed offset-aware tasks causing `TypeError` when being prepared.
([#2271](https://github.com/Pycord-Development/pycord/pull/2271))
Expand Down Expand Up @@ -485,7 +527,7 @@ These changes are available on the `master` branch, but have not yet been releas
### Fixed

- Fixed bugs in `Page.update_files` where file objects stored in memory were causing an
`AttributeError`, and `io.BytesIO` files didn't send properly more than once.
`AttributeError`, and `io.BytesIO` files did not send properly more than once.
([#1869](https://github.com/Pycord-Development/pycord/pull/1869) &
[#1881](https://github.com/Pycord-Development/pycord/pull/1881))
- Fixed bridge groups missing the `parent` attribute.
Expand Down Expand Up @@ -840,9 +882,9 @@ These changes are available on the `master` branch, but have not yet been releas
([#1453](https://github.com/Pycord-Development/pycord/pull/1453))
- Update `thread.members` on `thread.fetch_members`.
([#1464](https://github.com/Pycord-Development/pycord/pull/1464))
- Fix the error when Discord doesn't send the `app_permissions` data in `Interaction`.
- Fix the error when Discord does not send the `app_permissions` data in `Interaction`.
([#1467](https://github.com/Pycord-Development/pycord/pull/1467))
- Fix AttributeError when voice client `play()` function isn't completed yet.
- Fix AttributeError when voice client `play()` function is not completed yet.
([#1360](https://github.com/Pycord-Development/pycord/pull/1360))

## [2.0.0-rc.1] - 2022-05-17
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 @@ -1776,7 +1778,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 @@ -1801,7 +1803,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

0 comments on commit 1802149

Please sign in to comment.