Skip to content

Commit 567f32a

Browse files
Add set_video() helper to the embed (#690)
* fix: unable to send custom classes to instantiate Embed * fix: remove useless __init__ statements * ci: correct from checks. * feat: add Embed.set_video() helper method * ci: correct from checks. Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a983c0b commit 567f32a

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

interactions/api/models/message.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,12 +1248,34 @@ def set_image(
12481248

12491249
self.image = EmbedImageStruct(url=url, proxy_url=proxy_url, height=height, width=width)
12501250

1251+
def set_video(
1252+
self,
1253+
url: str,
1254+
proxy_url: Optional[str] = None,
1255+
height: Optional[int] = None,
1256+
width: Optional[int] = None,
1257+
) -> None:
1258+
"""
1259+
Sets the embed's video
1260+
1261+
:param url: Url of the video
1262+
:type url: str
1263+
:param proxy_url?: A proxied url of the video
1264+
:type proxy_url?: Optional[str]
1265+
:param height?: The video's height
1266+
:type height?: Optional[int]
1267+
:param width?: The video's width
1268+
:type width?: Optional[int]
1269+
"""
1270+
1271+
self.video = EmbedImageStruct(url=url, proxy_url=proxy_url, height=height, width=width)
1272+
12511273
def set_thumbnail(
12521274
self,
12531275
url: str,
12541276
proxy_url: Optional[str] = None,
1255-
height: int = None,
1256-
width: Optional[str] = None,
1277+
height: Optional[int] = None,
1278+
width: Optional[int] = None,
12571279
) -> None:
12581280
"""
12591281
Sets the embed's thumbnail

interactions/api/models/message.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,5 @@ class Embed(DictSerializerMixin):
296296
def set_author(self, name: str, url: Optional[str] = None, icon_url: Optional[str] = None, proxy_icon_url: Optional[str] = None) -> None: ...
297297
def set_footer(self, text: str, icon_url: Optional[str] = None, proxy_icon_url: Optional[str] = None) -> None: ...
298298
def set_image(self, url: str, proxy_url: Optional[str] = None, height: Optional[int] = None, width: Optional[int] = None) -> None: ...
299+
def set_video(self, url: str, proxy_url: Optional[str] = None, height: Optional[int] = None, width: Optional[int] = None) -> None: ...
299300
def set_thumbnail(self, url: str, proxy_url: Optional[str] = None, height: Optional[int] = None, width: Optional[int] = None) -> None: ...

0 commit comments

Comments
 (0)