Skip to content

Commit 9069984

Browse files
authored
Merge branch 'master' into unittest
2 parents c2db9a4 + f553fde commit 9069984

File tree

9 files changed

+112
-5
lines changed

9 files changed

+112
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ These changes are available on the `master` branch, but have not yet been releas
1212

1313
### Added
1414

15+
- Added new parameters (`author`, `footer`, `image`, `thumbnail`) to `discord.Embed`.
16+
([#1996](https://github.com/Pycord-Development/pycord/pull/1996))
1517
- Added new events `on_bridge_command`, `on_bridge_command_completion`, and
1618
`on_bridge_command_error`.
1719
([#1916](https://github.com/Pycord-Development/pycord/pull/1916))
@@ -36,6 +38,11 @@ These changes are available on the `master` branch, but have not yet been releas
3638
- Removed `@client.once()` in favour of `@client.listen(once=True)`.
3739
([#1957](https://github.com/Pycord-Development/pycord/pull/1957))
3840

41+
### Changed
42+
43+
- Suppressed FFMPEG output when recording voice channels.
44+
([#1993](https://github.com/Pycord-Development/pycord/pull/1993))
45+
3946
### Fixed
4047

4148
- Fixed `AttributeError` caused by

discord/embeds.py

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
__all__ = (
3535
"Embed",
3636
"EmbedField",
37+
"EmbedAuthor",
38+
"EmbedFooter",
3739
)
3840

3941

@@ -62,7 +64,7 @@ def __repr__(self) -> str:
6264
inner = ", ".join(
6365
(f"{k}={v!r}" for k, v in self.__dict__.items() if not k.startswith("_"))
6466
)
65-
return f"EmbedProxy({inner})"
67+
return f"{type(self).__name__}({inner})"
6668

6769
def __getattr__(self, attr: str) -> _EmptyEmbed:
6870
return EmptyEmbed
@@ -103,6 +105,64 @@ class _EmbedAuthorProxy(Protocol):
103105
proxy_icon_url: MaybeEmpty[str]
104106

105107

108+
class EmbedAuthor(EmbedProxy):
109+
"""Represents the author on the :class:`Embed` object.
110+
111+
.. versionadded:: 2.5
112+
113+
Attributes
114+
----------
115+
name: :class:`str`
116+
The name of the author.
117+
url: :class:`str`
118+
The URL of the hyperlink created in the author's name.
119+
icon_url: :class:`str`
120+
The URL of the author icon image.
121+
"""
122+
123+
def __init__(
124+
self,
125+
name: str,
126+
url: MaybeEmpty[str] = EmptyEmbed,
127+
icon_url: MaybeEmpty[str] = EmptyEmbed,
128+
proxy_icon_url: MaybeEmpty[str] = EmptyEmbed,
129+
) -> None:
130+
layer = {
131+
k: v
132+
for k, v in locals().items()
133+
if k in {"name", "url", "icon_url", "proxy_icon_url"}
134+
and v is not EmptyEmbed
135+
}
136+
super().__init__(layer)
137+
138+
139+
class EmbedFooter(EmbedProxy):
140+
"""Represents the footer on the :class:`Embed` object.
141+
142+
.. versionadded:: 2.5
143+
144+
Attributes
145+
----------
146+
text: :class:`str`
147+
The text inside the footer.
148+
icon_url: :class:`str`
149+
The URL of the footer icon image.
150+
"""
151+
152+
def __init__(
153+
self,
154+
text: str,
155+
icon_url: MaybeEmpty[str] = EmptyEmbed,
156+
proxy_icon_url: MaybeEmpty[str] = EmptyEmbed,
157+
) -> None:
158+
layer = {
159+
k: v
160+
for k, v in locals().items()
161+
if k in {"text", "icon_url", "proxy_icon_url"} and v is not EmptyEmbed
162+
}
163+
super().__init__(layer)
164+
165+
106166
class EmbedField:
107167
"""Represents a field on the :class:`Embed` object.
108168
@@ -246,6 +306,10 @@ def __init__(
246306
description: MaybeEmpty[Any] = EmptyEmbed,
247307
timestamp: datetime.datetime = None,
248308
fields: list[EmbedField] | None = None,
309+
author: MaybeEmpty[EmbedAuthor] = EmptyEmbed,
310+
footer: MaybeEmpty[EmbedFooter] = EmptyEmbed,
311+
image: MaybeEmpty[str] = EmptyEmbed,
312+
thumbnail: MaybeEmpty[str] = EmptyEmbed,
249313
):
250314
self.colour = colour if colour is not EmptyEmbed else color
251315
self.title = title
@@ -266,6 +330,18 @@ def __init__(
266330
self.timestamp = timestamp
267331
self._fields: list[EmbedField] = fields or []
268332

333+
if author is not EmptyEmbed:
334+
self.set_author(**author.__dict__)
335+
336+
if footer is not EmptyEmbed:
337+
self.set_footer(**footer.__dict__)
338+
339+
if image is not EmptyEmbed:
340+
self.set_image(url=image)
341+
342+
if thumbnail is not EmptyEmbed:
343+
self.set_thumbnail(url=thumbnail)
344+
269345
@classmethod
270346
def from_dict(cls: type[E], data: Mapping[str, Any]) -> E:
271347
"""Converts a :class:`dict` to a :class:`Embed` provided it is in the
@@ -426,14 +502,14 @@ def timestamp(self, value: MaybeEmpty[datetime.datetime]):
426502
)
427503

428504
@property
429-
def footer(self) -> _EmbedFooterProxy:
505+
def footer(self) -> EmbedFooter:
430506
"""Returns an ``EmbedProxy`` denoting the footer contents.
431507
432508
See :meth:`set_footer` for possible values you can access.
433509
434510
If the attribute has no value then :attr:`Empty` is returned.
435511
"""
436-
return EmbedProxy(getattr(self, "_footer", {})) # type: ignore
512+
return EmbedFooter(**getattr(self, "_footer", {}))
437513

438514
def set_footer(
439515
self: E,
@@ -618,14 +694,14 @@ def provider(self) -> _EmbedProviderProxy:
618694
return EmbedProxy(getattr(self, "_provider", {})) # type: ignore
619695

620696
@property
621-
def author(self) -> _EmbedAuthorProxy:
697+
def author(self) -> EmbedAuthor:
622698
"""Returns an ``EmbedProxy`` denoting the author contents.
623699
624700
See :meth:`set_author` for possible values you can access.
625701
626702
If the attribute has no value then :attr:`Empty` is returned.
627703
"""
628-
return EmbedProxy(getattr(self, "_author", {})) # type: ignore
704+
return EmbedAuthor(**getattr(self, "_author", {})) # type: ignore
629705

630706
def set_author(
631707
self: E,

discord/sinks/m4a.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def format_audio(self, audio):
6767
"s16le",
6868
"-ar",
6969
"48000",
70+
"-loglevel",
71+
"error",
7072
"-ac",
7173
"2",
7274
"-i",

discord/sinks/mka.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def format_audio(self, audio):
6464
"s16le",
6565
"-ar",
6666
"48000",
67+
"-loglevel",
68+
"error",
6769
"-ac",
6870
"2",
6971
"-i",

discord/sinks/mkv.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def format_audio(self, audio):
6464
"s16le",
6565
"-ar",
6666
"48000",
67+
"-loglevel",
68+
"error",
6769
"-ac",
6870
"2",
6971
"-i",

discord/sinks/mp3.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def format_audio(self, audio):
6464
"s16le",
6565
"-ar",
6666
"48000",
67+
"-loglevel",
68+
"error",
6769
"-ac",
6870
"2",
6971
"-i",

discord/sinks/mp4.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def format_audio(self, audio):
6767
"s16le",
6868
"-ar",
6969
"48000",
70+
"-loglevel",
71+
"error",
7072
"-ac",
7173
"2",
7274
"-i",

discord/sinks/ogg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def format_audio(self, audio):
6464
"s16le",
6565
"-ar",
6666
"48000",
67+
"-loglevel",
68+
"error",
6769
"-ac",
6870
"2",
6971
"-i",

docs/api/data_classes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ Embed
7272
.. autoclass:: EmbedField
7373
:members:
7474

75+
.. attributetable:: EmbedAuthor
76+
77+
.. autoclass:: EmbedAuthor
78+
:members:
79+
80+
81+
.. attributetable:: EmbedFooter
82+
83+
.. autoclass:: EmbedFooter
84+
:members:
85+
86+
7587

7688
Flags
7789
-----

0 commit comments

Comments
 (0)