-module(glyph@builders@embed). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([new/0, title/2, description/2, url/2, provider/3, field/4, footer_text/2, footer_icon_url/2, image/2, image_height/2, image_width/2, thumbnail/2, thumbnail_height/2, thumbnail_width/2, video/2, video_height/2, video_width/2, author/2, author_url/2, author_icon/2, color/2]). -export_type([embed_color/0]). -type embed_color() :: white | greyple | black | dark_but_not_black | not_quite_black | blurple | green | yellow | fuschia | red. -spec new() -> glyph@models@discord:embed(). new() -> {embed, none, none, none, none, none, none, none, none, none, none, none, none}. -spec title(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). title(E, Title) -> erlang:setelement(2, E, {some, Title}). -spec description(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). description(E, Description) -> erlang:setelement(3, E, {some, Description}). -spec url(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). url(E, Url) -> erlang:setelement(4, E, {some, Url}). -spec provider( glyph@models@discord:embed(), gleam@option:option(binary()), gleam@option:option(binary()) ) -> glyph@models@discord:embed(). provider(E, Name, Url) -> erlang:setelement(11, E, {some, {embed_provider, Name, Url}}). -spec field(glyph@models@discord:embed(), binary(), binary(), boolean()) -> glyph@models@discord:embed(). field(E, Name, Value, Inline) -> Fields = gleam@option:unwrap(erlang:element(13, E), []), New_field = {embed_field, Name, Value, {some, Inline}}, erlang:setelement(13, E, {some, gleam@list:append(Fields, [New_field])}). -spec empty_footer() -> glyph@models@discord:embed_footer(). empty_footer() -> {embed_footer, <<""/utf8>>, none, none}. -spec footer_text(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). footer_text(E, Text) -> Footer = gleam@option:unwrap(erlang:element(7, E), empty_footer()), Updated_footer = erlang:setelement(2, Footer, Text), erlang:setelement(7, E, {some, Updated_footer}). -spec footer_icon_url(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). footer_icon_url(E, Icon_url) -> Footer = gleam@option:unwrap(erlang:element(7, E), empty_footer()), Updated_footer = erlang:setelement(3, Footer, {some, Icon_url}), erlang:setelement(7, E, {some, Updated_footer}). -spec empty_image() -> glyph@models@discord:embed_image(). empty_image() -> {embed_image, <<""/utf8>>, none, none, none}. -spec image(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). image(E, Image_url) -> Image = gleam@option:unwrap(erlang:element(8, E), empty_image()), Updated_image = erlang:setelement(2, Image, Image_url), erlang:setelement(8, E, {some, Updated_image}). -spec image_height(glyph@models@discord:embed(), integer()) -> glyph@models@discord:embed(). image_height(E, Height) -> Image = gleam@option:unwrap(erlang:element(8, E), empty_image()), Updated_image = erlang:setelement(4, Image, {some, Height}), erlang:setelement(8, E, {some, Updated_image}). -spec image_width(glyph@models@discord:embed(), integer()) -> glyph@models@discord:embed(). image_width(E, Width) -> Image = gleam@option:unwrap(erlang:element(8, E), empty_image()), Updated_image = erlang:setelement(5, Image, {some, Width}), erlang:setelement(8, E, {some, Updated_image}). -spec empty_thumbnail() -> glyph@models@discord:embed_thumbnail(). empty_thumbnail() -> {embed_thumbnail, <<""/utf8>>, none, none, none}. -spec thumbnail(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). thumbnail(E, Thumbnail_url) -> Thumbnail = gleam@option:unwrap(erlang:element(9, E), empty_thumbnail()), Updated_thumbnail = erlang:setelement(2, Thumbnail, Thumbnail_url), erlang:setelement(9, E, {some, Updated_thumbnail}). -spec thumbnail_height(glyph@models@discord:embed(), integer()) -> glyph@models@discord:embed(). thumbnail_height(E, Height) -> Thumbnail = gleam@option:unwrap(erlang:element(9, E), empty_thumbnail()), Updated_thumbnail = erlang:setelement(4, Thumbnail, {some, Height}), erlang:setelement(9, E, {some, Updated_thumbnail}). -spec thumbnail_width(glyph@models@discord:embed(), integer()) -> glyph@models@discord:embed(). thumbnail_width(E, Width) -> Thumbnail = gleam@option:unwrap(erlang:element(9, E), empty_thumbnail()), Updated_thumbnail = erlang:setelement(5, Thumbnail, {some, Width}), erlang:setelement(9, E, {some, Updated_thumbnail}). -spec empty_video() -> glyph@models@discord:embed_video(). empty_video() -> {embed_video, none, none, none, none}. -spec video(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). video(E, Video_url) -> Video = gleam@option:unwrap(erlang:element(10, E), empty_video()), Updated_video = erlang:setelement(2, Video, {some, Video_url}), erlang:setelement(10, E, {some, Updated_video}). -spec video_height(glyph@models@discord:embed(), integer()) -> glyph@models@discord:embed(). video_height(E, Height) -> Video = gleam@option:unwrap(erlang:element(10, E), empty_video()), Updated_video = erlang:setelement(4, Video, {some, Height}), erlang:setelement(10, E, {some, Updated_video}). -spec video_width(glyph@models@discord:embed(), integer()) -> glyph@models@discord:embed(). video_width(E, Width) -> Video = gleam@option:unwrap(erlang:element(10, E), empty_video()), Updated_video = erlang:setelement(5, Video, {some, Width}), erlang:setelement(10, E, {some, Updated_video}). -spec empty_author() -> glyph@models@discord:embed_author(). empty_author() -> {embed_author, <<""/utf8>>, none, none, none}. -spec author(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). author(E, Name) -> Author = gleam@option:unwrap(erlang:element(12, E), empty_author()), Updated_author = erlang:setelement(2, Author, Name), erlang:setelement(12, E, {some, Updated_author}). -spec author_url(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). author_url(E, Url) -> Author = gleam@option:unwrap(erlang:element(12, E), empty_author()), Updated_author = erlang:setelement(3, Author, {some, Url}), erlang:setelement(12, E, {some, Updated_author}). -spec author_icon(glyph@models@discord:embed(), binary()) -> glyph@models@discord:embed(). author_icon(E, Icon_url) -> Author = gleam@option:unwrap(erlang:element(12, E), empty_author()), Updated_author = erlang:setelement(4, Author, {some, Icon_url}), erlang:setelement(12, E, {some, Updated_author}). -spec color_to_int(embed_color()) -> integer(). color_to_int(C) -> case C of white -> 16777215; greyple -> 10070709; black -> 23033786; dark_but_not_black -> 2895667; not_quite_black -> 2303786; blurple -> 5793266; green -> 5763719; yellow -> 16705372; fuschia -> 15418782; red -> 15548997 end. -spec color(glyph@models@discord:embed(), embed_color()) -> glyph@models@discord:embed(). color(E, Color) -> erlang:setelement(6, E, {some, color_to_int(Color)}).