Skip to content

Commit db174cc

Browse files
authored
Merge branch 'master' into partial-autocomplete
Signed-off-by: Paillat <[email protected]>
2 parents d47bec3 + bda1dfe commit db174cc

File tree

547 files changed

+53981
-12638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

547 files changed

+53981
-12638
lines changed

.github/workflows/docs-localization-download.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
working-directory: ./docs
4141
- name: "Crowdin"
4242
id: crowdin
43-
uses: crowdin/github-action@v2.7.0
43+
uses: crowdin/github-action@v2.9.1
4444
with:
4545
upload_sources: false
4646
upload_translations: false

.github/workflows/docs-localization-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
4545
working-directory: ./docs
4646
- name: "Crowdin"
47-
uses: crowdin/github-action@v2.7.0
47+
uses: crowdin/github-action@v2.9.1
4848
with:
4949
upload_sources: true
5050
upload_translations: false

.github/workflows/todo-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: "Checkout Repository"
2424
uses: actions/checkout@v4
2525
- name: "Track TODO Action"
26-
uses: ribtoks/[email protected].14-beta
26+
uses: ribtoks/[email protected].15-beta
2727
with:
2828
TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929
REPO: ${{ github.repository }}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
# - --remove-duplicate-keys
2222
# - --remove-unused-variables
2323
- repo: https://github.com/asottile/pyupgrade
24-
rev: v3.19.1
24+
rev: v3.20.0
2525
hooks:
2626
- id: pyupgrade
2727
exclude: \.(po|pot|yml|yaml)$
@@ -87,7 +87,7 @@ repos:
8787
args: [--prose-wrap=always, --print-width=88]
8888
exclude: \.(po|pot|yml|yaml)$
8989
- repo: https://github.com/DanielNoord/pydocstringformatter
90-
rev: v0.7.3
90+
rev: v0.7.5
9191
hooks:
9292
- id: pydocstringformatter
9393
exclude: \.(po|pot|yml|yaml)$

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ These changes are available on the `master` branch, but have not yet been releas
5454
- Added the ability to use functions with any number of optional arguments and functions
5555
returning an awaitable as `Option.autocomplete`.
5656
([#2669](https://github.com/Pycord-Development/pycord/pull/2669))
57+
- Add missing `Guild` feature flags and `Guild.edit` parameters.
58+
([#2672](https://github.com/Pycord-Development/pycord/pull/2672))
5759
- Added the ability to change the API's base URL with `Route.API_BASE_URL`.
5860
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
59-
- Added the ability to pass a `datetime.time` object to `format_dt`
61+
- Added the ability to pass a `datetime.time` object to `format_dt`.
6062
([#2747](https://github.com/Pycord-Development/pycord/pull/2747))
63+
- Added support for type hinting slash command options with `typing.Annotated`.
64+
([#2782](https://github.com/Pycord-Development/pycord/pull/2782))
65+
- Added conversion to `Member` in `MentionableConverter`.
66+
([#2775](https://github.com/Pycord-Development/pycord/pull/2775))
67+
- Added `discord.Interaction.created_at`.
68+
([#2801](https://github.com/Pycord-Development/pycord/pull/2801))
6169

6270
### Fixed
6371

@@ -108,12 +116,24 @@ These changes are available on the `master` branch, but have not yet been releas
108116
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
109117
- Fixed missing `None` type hints in `Select.__init__`.
110118
([#2746](https://github.com/Pycord-Development/pycord/pull/2746))
119+
- Fixed `TypeError` when using `Flag` with Python 3.11+.
120+
([#2759](https://github.com/Pycord-Development/pycord/pull/2759))
121+
- Fixed `TypeError` when specifying `thread_name` in `Webhook.send`.
122+
([#2761](https://github.com/Pycord-Development/pycord/pull/2761))
111123
- Updated `valid_locales` to support `in` and `es-419`.
112124
([#2767](https://github.com/Pycord-Development/pycord/pull/2767))
113125
- Fixed `Webhook.edit` not working with `attachments=[]`.
114126
([#2779](https://github.com/Pycord-Development/pycord/pull/2779))
115127
- Fixed GIF-based `Sticker` returning the wrong `url`.
116128
([#2781](https://github.com/Pycord-Development/pycord/pull/2781))
129+
- Fixed `VoiceClient` crashing randomly while receiving audio
130+
([#2800](https://github.com/Pycord-Development/pycord/pull/2800))
131+
- Fixed `VoiceClient.connect` failing to do initial connection.
132+
([#2812](https://github.com/Pycord-Development/pycord/pull/2812))
133+
- Fixed `AttributeError` when printing a File component's `__repr__`.
134+
([#2843](https://github.com/Pycord-Development/pycord/pull/2843))
135+
- Fixed `TypeError` when using `@option` with certain annotations and along with
136+
`channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835))
117137

118138
### Changed
119139

@@ -131,6 +151,10 @@ These changes are available on the `master` branch, but have not yet been releas
131151
changes. ([#2671](https://github.com/Pycord-Development/pycord/pull/2671))
132152
- `Entitlement.ends_at` can now be `None`.
133153
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
154+
- Changed the default value of `ApplicationCommand.nsfw` to `False`.
155+
([#2797](https://github.com/Pycord-Development/pycord/pull/2797))
156+
- Upgraded voice websocket version to v8.
157+
([#2812](https://github.com/Pycord-Development/pycord/pull/2812))
134158

135159
### Deprecated
136160

@@ -141,6 +165,11 @@ These changes are available on the `master` branch, but have not yet been releas
141165
- Deprecated `Interaction.cached_channel` in favor of `Interaction.channel`.
142166
([#2658](https://github.com/Pycord-Development/pycord/pull/2658))
143167

168+
### Removed
169+
170+
- Removed deprecated support for `Option` in `BridgeCommand`, use `BridgeOption`
171+
instead. ([#2731](https://github.com/Pycord-Development/pycord/pull/2731))
172+
144173
## [2.6.1] - 2024-09-15
145174

146175
### Fixed

crowdin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ preserve_hierarchy: true
55

66
commit_message: "docs: Update translations"
77

8-
export_languages: ["de", "ja", "fr", "it", "hi", "ko", "pt-BR", "es-ES", "zh-CN"]
8+
export_languages: ["de", "ja", "fr", "it", "hi", "ko", "pt-BR", "es-ES", "zh-CN", "tr"]
99

1010
bundles:
1111
- 1

discord/abc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,12 @@ async def send(
16151615
)
16161616

16171617
components = view.to_components()
1618+
if view.is_components_v2():
1619+
if embeds or content:
1620+
raise TypeError(
1621+
"cannot send embeds or content with a view using v2 component logic"
1622+
)
1623+
flags.is_components_v2 = True
16181624
else:
16191625
components = None
16201626

@@ -1679,8 +1685,10 @@ async def send(
16791685

16801686
ret = state.create_message(channel=channel, data=data)
16811687
if view:
1682-
state.store_view(view, ret.id)
1688+
if view.is_dispatchable():
1689+
state.store_view(view, ret.id)
16831690
view.message = ret
1691+
view.refresh(ret.components)
16841692

16851693
if delete_after is not None:
16861694
await ret.delete(delay=delete_after)

discord/asset.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ class Asset(AssetMixin):
144144
145145
.. describe:: hash(x)
146146
147-
Returns the hash of the asset.
147+
Returns the asset's url's hash.
148+
149+
This is equivalent to hash(:attr:`url`).
148150
"""
149151

150152
__slots__: tuple[str, ...] = (

discord/bot.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,17 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool:
328328
]:
329329
# We have a difference
330330
return True
331-
elif getattr(cmd, check, None) != match.get(check):
332-
# We have a difference
333-
if (
331+
elif (attr := getattr(cmd, check, None)) != (
332+
found := match.get(check)
333+
):
334+
# We might have a difference
335+
if "localizations" in check and bool(attr) == bool(found):
336+
# unlike other attrs, localizations are MISSING by default
337+
continue
338+
elif (
334339
check == "default_permission"
335-
and getattr(cmd, check) is True
336-
and match.get(check) is None
340+
and attr is True
341+
and found is None
337342
):
338343
# This is a special case
339344
# TODO: Remove for perms v2
@@ -879,15 +884,15 @@ async def process_application_commands(
879884

880885
ctx = await self.get_application_context(interaction)
881886
if command:
882-
ctx.command = command
887+
interaction.command = command
883888
await self.invoke_application_command(ctx)
884889

885890
async def on_application_command_auto_complete(
886891
self, interaction: Interaction, command: ApplicationCommand
887892
) -> None:
888893
async def callback() -> None:
889894
ctx = await self.get_autocomplete_context(interaction)
890-
ctx.command = command
895+
interaction.command = command
891896
return await command.invoke_autocomplete_callback(ctx)
892897

893898
autocomplete_task = self._bot.loop.create_task(callback())

discord/channel.py

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626
from __future__ import annotations
2727

2828
import datetime
29-
from typing import TYPE_CHECKING, Any, Callable, Iterable, Mapping, TypeVar, overload
29+
from typing import (
30+
TYPE_CHECKING,
31+
Any,
32+
Callable,
33+
Iterable,
34+
Mapping,
35+
Sequence,
36+
TypeVar,
37+
overload,
38+
)
3039

3140
import discord.abc
3241

@@ -45,7 +54,7 @@
4554
)
4655
from .errors import ClientException, InvalidArgument
4756
from .file import File
48-
from .flags import ChannelFlags
57+
from .flags import ChannelFlags, MessageFlags
4958
from .invite import Invite
5059
from .iterators import ArchivedThreadIterator
5160
from .mixins import Hashable
@@ -71,12 +80,15 @@
7180

7281
if TYPE_CHECKING:
7382
from .abc import Snowflake, SnowflakeTime
83+
from .embeds import Embed
7484
from .guild import Guild
7585
from .guild import GuildChannel as GuildChannelType
7686
from .member import Member, VoiceState
87+
from .mentions import AllowedMentions
7788
from .message import EmojiInputType, Message, PartialMessage
7889
from .role import Role
7990
from .state import ConnectionState
91+
from .sticker import GuildSticker, StickerItem
8092
from .types.channel import CategoryChannel as CategoryChannelPayload
8193
from .types.channel import DMChannel as DMChannelPayload
8294
from .types.channel import ForumChannel as ForumChannelPayload
@@ -87,6 +99,7 @@
8799
from .types.channel import VoiceChannel as VoiceChannelPayload
88100
from .types.snowflake import SnowflakeList
89101
from .types.threads import ThreadArchiveDuration
102+
from .ui.view import View
90103
from .user import BaseUser, ClientUser, User
91104
from .webhook import Webhook
92105

@@ -1181,18 +1194,20 @@ async def edit(self, *, reason=None, **options):
11811194
async def create_thread(
11821195
self,
11831196
name: str,
1184-
content=None,
1197+
content: str | None = None,
11851198
*,
1186-
embed=None,
1187-
embeds=None,
1188-
file=None,
1189-
files=None,
1190-
stickers=None,
1191-
delete_message_after=None,
1192-
nonce=None,
1193-
allowed_mentions=None,
1194-
view=None,
1195-
applied_tags=None,
1199+
embed: Embed | None = None,
1200+
embeds: list[Embed] | None = None,
1201+
file: File | None = None,
1202+
files: list[File] | None = None,
1203+
stickers: Sequence[GuildSticker | StickerItem] | None = None,
1204+
delete_message_after: float | None = None,
1205+
nonce: int | str | None = None,
1206+
allowed_mentions: AllowedMentions | None = None,
1207+
view: View | None = None,
1208+
applied_tags: list[ForumTag] | None = None,
1209+
suppress: bool = False,
1210+
silent: bool = False,
11961211
auto_archive_duration: ThreadArchiveDuration = MISSING,
11971212
slowmode_delay: int = MISSING,
11981213
reason: str | None = None,
@@ -1292,13 +1307,24 @@ async def create_thread(
12921307
else:
12931308
allowed_mentions = allowed_mentions.to_dict()
12941309

1310+
flags = MessageFlags(
1311+
suppress_embeds=bool(suppress),
1312+
suppress_notifications=bool(silent),
1313+
)
1314+
12951315
if view:
12961316
if not hasattr(view, "__discord_ui_view__"):
12971317
raise InvalidArgument(
12981318
f"view parameter must be View not {view.__class__!r}"
12991319
)
13001320

13011321
components = view.to_components()
1322+
if view.is_components_v2():
1323+
if embeds or content:
1324+
raise TypeError(
1325+
"cannot send embeds or content with a view using v2 component logic"
1326+
)
1327+
flags.is_components_v2 = True
13021328
else:
13031329
components = None
13041330

@@ -1337,6 +1363,7 @@ async def create_thread(
13371363
or self.default_auto_archive_duration,
13381364
rate_limit_per_user=slowmode_delay or self.slowmode_delay,
13391365
applied_tags=applied_tags,
1366+
flags=flags.value,
13401367
reason=reason,
13411368
)
13421369
finally:
@@ -1346,7 +1373,7 @@ async def create_thread(
13461373

13471374
ret = Thread(guild=self.guild, state=self._state, data=data)
13481375
msg = ret.get_partial_message(int(data["last_message_id"]))
1349-
if view:
1376+
if view and view.is_dispatchable():
13501377
state.store_view(view, msg.id)
13511378

13521379
if delete_message_after is not None:

0 commit comments

Comments
 (0)