Skip to content

Commit 979f6c1

Browse files
authored
Merge branch 'master' into Add_tread_archive_duration_enum
Signed-off-by: BOXER <[email protected]>
2 parents 595aaeb + 4392105 commit 979f6c1

File tree

542 files changed

+53876
-12563
lines changed

Some content is hidden

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

542 files changed

+53876
-12563
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.1
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.1
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,16 @@ These changes are available on the `master` branch, but have not yet been releas
5151
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
5252
- Added `Message.forward_to`, `Message.snapshots`, and other related attributes.
5353
([#2598](https://github.com/Pycord-Development/pycord/pull/2598))
54+
- Add missing `Guild` feature flags and `Guild.edit` parameters.
55+
([#2672](https://github.com/Pycord-Development/pycord/pull/2672))
5456
- Added the ability to change the API's base URL with `Route.API_BASE_URL`.
5557
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
5658
- Added the ability to pass a `datetime.time` object to `format_dt`.
5759
([#2747](https://github.com/Pycord-Development/pycord/pull/2747))
60+
- Added support for type hinting slash command options with `typing.Annotated`.
61+
([#2782](https://github.com/Pycord-Development/pycord/pull/2782))
62+
- Added conversion to `Member` in `MentionableConverter`.
63+
([#2775](https://github.com/Pycord-Development/pycord/pull/2775))
5864
- Added `discord.Interaction.created_at`.
5965
([#2801](https://github.com/Pycord-Development/pycord/pull/2801))
6066
- Added `ThreadAutoArchiveDuration` enum to improve clarity of thread archive durations.
@@ -121,6 +127,12 @@ These changes are available on the `master` branch, but have not yet been releas
121127
([#2781](https://github.com/Pycord-Development/pycord/pull/2781))
122128
- Fixed `VoiceClient` crashing randomly while receiving audio
123129
([#2800](https://github.com/Pycord-Development/pycord/pull/2800))
130+
- Fixed `VoiceClient.connect` failing to do initial connection.
131+
([#2812](https://github.com/Pycord-Development/pycord/pull/2812))
132+
- Fixed `AttributeError` when printing a File component's `__repr__`.
133+
([#2843](https://github.com/Pycord-Development/pycord/pull/2843))
134+
- Fixed `TypeError` when using `@option` with certain annotations and along with
135+
`channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835))
124136

125137
### Changed
126138

@@ -140,6 +152,8 @@ These changes are available on the `master` branch, but have not yet been releas
140152
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
141153
- Changed the default value of `ApplicationCommand.nsfw` to `False`.
142154
([#2797](https://github.com/Pycord-Development/pycord/pull/2797))
155+
- Upgraded voice websocket version to v8.
156+
([#2812](https://github.com/Pycord-Development/pycord/pull/2812))
143157

144158
### Deprecated
145159

@@ -152,8 +166,8 @@ These changes are available on the `master` branch, but have not yet been releas
152166

153167
### Removed
154168

155-
- Removed deprecated support for `Option` in `BridgeCommand`. Use `BridgeOption`
156-
instead. ([#2731])(https://github.com/Pycord-Development/pycord/pull/2731))
169+
- Removed deprecated support for `Option` in `BridgeCommand`, use `BridgeOption`
170+
instead. ([#2731](https://github.com/Pycord-Development/pycord/pull/2731))
157171

158172
## [2.6.1] - 2024-09-15
159173

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,15 @@ async def process_application_commands(
884884

885885
ctx = await self.get_application_context(interaction)
886886
if command:
887-
ctx.command = command
887+
interaction.command = command
888888
await self.invoke_application_command(ctx)
889889

890890
async def on_application_command_auto_complete(
891891
self, interaction: Interaction, command: ApplicationCommand
892892
) -> None:
893893
async def callback() -> None:
894894
ctx = await self.get_autocomplete_context(interaction)
895-
ctx.command = command
895+
interaction.command = command
896896
return await command.invoke_autocomplete_callback(ctx)
897897

898898
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

@@ -48,7 +57,7 @@
4857
)
4958
from .errors import ClientException, InvalidArgument
5059
from .file import File
51-
from .flags import ChannelFlags
60+
from .flags import ChannelFlags, MessageFlags
5261
from .invite import Invite
5362
from .iterators import ArchivedThreadIterator
5463
from .mixins import Hashable
@@ -74,12 +83,15 @@
7483

7584
if TYPE_CHECKING:
7685
from .abc import Snowflake, SnowflakeTime
86+
from .embeds import Embed
7787
from .guild import Guild
7888
from .guild import GuildChannel as GuildChannelType
7989
from .member import Member, VoiceState
90+
from .mentions import AllowedMentions
8091
from .message import EmojiInputType, Message, PartialMessage
8192
from .role import Role
8293
from .state import ConnectionState
94+
from .sticker import GuildSticker, StickerItem
8395
from .types.channel import CategoryChannel as CategoryChannelPayload
8496
from .types.channel import DMChannel as DMChannelPayload
8597
from .types.channel import ForumChannel as ForumChannelPayload
@@ -90,6 +102,7 @@
90102
from .types.channel import VoiceChannel as VoiceChannelPayload
91103
from .types.snowflake import SnowflakeList
92104
from .types.threads import ThreadArchiveDuration
105+
from .ui.view import View
93106
from .user import BaseUser, ClientUser, User
94107
from .webhook import Webhook
95108

@@ -1187,18 +1200,20 @@ async def edit(self, *, reason=None, **options):
11871200
async def create_thread(
11881201
self,
11891202
name: str,
1190-
content=None,
1203+
content: str | None = None,
11911204
*,
1192-
embed=None,
1193-
embeds=None,
1194-
file=None,
1195-
files=None,
1196-
stickers=None,
1197-
delete_message_after=None,
1198-
nonce=None,
1199-
allowed_mentions=None,
1200-
view=None,
1201-
applied_tags=None,
1205+
embed: Embed | None = None,
1206+
embeds: list[Embed] | None = None,
1207+
file: File | None = None,
1208+
files: list[File] | None = None,
1209+
stickers: Sequence[GuildSticker | StickerItem] | None = None,
1210+
delete_message_after: float | None = None,
1211+
nonce: int | str | None = None,
1212+
allowed_mentions: AllowedMentions | None = None,
1213+
view: View | None = None,
1214+
applied_tags: list[ForumTag] | None = None,
1215+
suppress: bool = False,
1216+
silent: bool = False,
12021217
auto_archive_duration: ThreadArchiveDuration = MISSING,
12031218
slowmode_delay: int = MISSING,
12041219
reason: str | None = None,
@@ -1298,13 +1313,24 @@ async def create_thread(
12981313
else:
12991314
allowed_mentions = allowed_mentions.to_dict()
13001315

1316+
flags = MessageFlags(
1317+
suppress_embeds=bool(suppress),
1318+
suppress_notifications=bool(silent),
1319+
)
1320+
13011321
if view:
13021322
if not hasattr(view, "__discord_ui_view__"):
13031323
raise InvalidArgument(
13041324
f"view parameter must be View not {view.__class__!r}"
13051325
)
13061326

13071327
components = view.to_components()
1328+
if view.is_components_v2():
1329+
if embeds or content:
1330+
raise TypeError(
1331+
"cannot send embeds or content with a view using v2 component logic"
1332+
)
1333+
flags.is_components_v2 = True
13081334
else:
13091335
components = None
13101336

@@ -1343,6 +1369,7 @@ async def create_thread(
13431369
or self.default_auto_archive_duration,
13441370
rate_limit_per_user=slowmode_delay or self.slowmode_delay,
13451371
applied_tags=applied_tags,
1372+
flags=flags.value,
13461373
reason=reason,
13471374
)
13481375
finally:
@@ -1352,7 +1379,7 @@ async def create_thread(
13521379

13531380
ret = Thread(guild=self.guild, state=self._state, data=data)
13541381
msg = ret.get_partial_message(int(data["last_message_id"]))
1355-
if view:
1382+
if view and view.is_dispatchable():
13561383
state.store_view(view, msg.id)
13571384

13581385
if delete_message_after is not None:

0 commit comments

Comments
 (0)