Skip to content

Commit 8d965d1

Browse files
authored
Merge branch 'master' into fix/command-decorator-typing
2 parents 235e4bc + c6a202a commit 8d965d1

6 files changed

Lines changed: 13 additions & 11 deletions

File tree

.github/workflows/docs-json-export.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
id: generate-json
3636
run: python scripts/docs_json_exporter.py
3737
- name: Upload docs.json as artifact
38-
uses: actions/upload-artifact@v6.0.0
38+
uses: actions/upload-artifact@v7.0.0
3939
id: artifact-upload
4040
with:
4141
name: Pycord Docs JSON

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
exclude: \.(po|pot|yml|yaml)$
1313
- repo: https://github.com/PyCQA/autoflake
14-
rev: v2.3.2
14+
rev: v2.3.3
1515
hooks:
1616
- id: autoflake
1717
# args:
@@ -26,7 +26,7 @@ repos:
2626
- id: pyupgrade
2727
exclude: \.(po|pot|yml|yaml)$
2828
- repo: https://github.com/PyCQA/isort
29-
rev: 7.0.0
29+
rev: 8.0.0
3030
hooks:
3131
- id: isort
3232
exclude: \.(po|pot|yml|yaml)$

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ These changes are available on the `master` branch, but have not yet been releas
2929
([#3063](https://github.com/Pycord-Development/pycord/pull/3063))
3030
- Changed `User.nameplate` to be an alias for `User.collectibles.nameplate`.
3131
([#3107](https://github.com/Pycord-Development/pycord/pull/3107))
32+
- Changed `FileComponent.name` and `FileComponent.size` to be optional.
33+
([#3115](https://github.com/Pycord-Development/pycord/pull/3115))
3234

3335
### Fixed
3436

discord/components.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,9 @@ class FileComponent(Component):
11271127
----------
11281128
file: :class:`UnfurledMediaItem`
11291129
The file's media item.
1130-
name: :class:`str`
1130+
name: Optional[:class:`str`]
11311131
The file's name.
1132-
size: :class:`int`
1132+
size: Optional[:class:`int`]
11331133
The file's size in bytes.
11341134
spoiler: Optional[:class:`bool`]
11351135
Whether the file has the spoiler overlay.
@@ -1148,8 +1148,8 @@ class FileComponent(Component):
11481148
def __init__(self, data: FileComponentPayload, state=None):
11491149
self.type: ComponentType = try_enum(ComponentType, data["type"])
11501150
self.id: int = data.get("id")
1151-
self.name: str = data.get("name")
1152-
self.size: int = data.get("size")
1151+
self.name: str | None = data.get("name")
1152+
self.size: int | None = data.get("size")
11531153
self.file: UnfurledMediaItem = UnfurledMediaItem.from_dict(
11541154
data.get("file", {}), state=state
11551155
)

discord/types/components.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ class FileComponent(BaseComponent):
142142
type: Literal[13]
143143
file: UnfurledMediaItem
144144
spoiler: NotRequired[bool]
145-
name: str
146-
size: int
145+
name: NotRequired[str]
146+
size: NotRequired[int]
147147

148148

149149
class SeparatorComponent(BaseComponent):

discord/ui/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ def spoiler(self, spoiler: bool) -> None:
119119
self.underlying.spoiler = spoiler
120120

121121
@property
122-
def name(self) -> str:
122+
def name(self) -> str | None:
123123
"""The name of this file, if provided by Discord."""
124124
return self.underlying.name
125125

126126
@property
127-
def size(self) -> int:
127+
def size(self) -> int | None:
128128
"""The size of this file in bytes, if provided by Discord."""
129129
return self.underlying.size
130130

0 commit comments

Comments
 (0)