Current section
Files
Jump to
Current section
Files
src/telega@models@dice.erl
-module(telega@models@dice).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([new_send_dice_parameters/1, encode_send_dice_parameters/1]).
-export_type([send_dice_parameters/0]).
-type send_dice_parameters() :: {send_dice_parameters,
integer(),
gleam@option:option(integer()),
gleam@option:option(binary()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(telega@models@reply:reply_parameters())}.
-spec new_send_dice_parameters(integer()) -> send_dice_parameters().
new_send_dice_parameters(Chat_id) ->
{send_dice_parameters, Chat_id, none, none, none, none, none}.
-spec encode_send_dice_parameters(send_dice_parameters()) -> gleam@json:json().
encode_send_dice_parameters(Params) ->
Chat_id = [{<<"chat_id"/utf8>>, gleam@json:int(erlang:element(2, Params))}],
Message_thread_id = telega@models@common:option_to_json_object_list(
erlang:element(3, Params),
<<"message_thread_id"/utf8>>,
fun gleam@json:int/1
),
Emoji = telega@models@common:option_to_json_object_list(
erlang:element(4, Params),
<<"emoji"/utf8>>,
fun gleam@json:string/1
),
Disable_notification = telega@models@common:option_to_json_object_list(
erlang:element(5, Params),
<<"disable_notification"/utf8>>,
fun gleam@json:bool/1
),
Protect_content = telega@models@common:option_to_json_object_list(
erlang:element(6, Params),
<<"protect_content"/utf8>>,
fun gleam@json:bool/1
),
Reply_parameters = telega@models@common:option_to_json_object_list(
erlang:element(7, Params),
<<"reply_parameters"/utf8>>,
fun telega@models@reply:encode_reply_parameters/1
),
_pipe = [Chat_id,
Message_thread_id,
Emoji,
Disable_notification,
Protect_content,
Reply_parameters],
_pipe@1 = gleam@list:concat(_pipe),
gleam@json:object(_pipe@1).