Skip to main content

stoat/ext/
embed.rs

1use stoat_models::v0::SendableEmbed;
2
3pub trait EmbedExt {
4    fn icon_url(self, icon_url: String) -> Self;
5    fn url(self, url: String) -> Self;
6    fn title(self, title: String) -> Self;
7    fn description(self, description: String) -> Self;
8    fn media(self, media: String) -> Self;
9    fn colour(self, colour: String) -> Self;
10}
11
12impl EmbedExt for SendableEmbed {
13    fn icon_url(mut self, icon_url: String) -> Self {
14        self.icon_url = Some(icon_url);
15        self
16    }
17
18    fn url(mut self, url: String) -> Self {
19        self.icon_url = Some(url);
20        self
21    }
22
23    fn title(mut self, title: String) -> Self {
24        self.title = Some(title);
25        self
26    }
27
28    fn description(mut self, description: String) -> Self {
29        self.description = Some(description);
30        self
31    }
32
33    fn media(mut self, media: String) -> Self {
34        self.media = Some(media);
35        self
36    }
37
38    fn colour(mut self, colour: String) -> Self {
39        self.colour = Some(colour);
40        self
41    }
42}