Current section

Files

Jump to
discord_gleam src discord_gleam@ws@packets@identify.erl
Raw

src/discord_gleam@ws@packets@identify.erl

-module(discord_gleam@ws@packets@identify).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/discord_gleam/ws/packets/identify.gleam").
-export([create_packet/2, create_resume_packet/3]).
-file("src/discord_gleam/ws/packets/identify.gleam", 4).
-spec create_packet(binary(), discord_gleam@discord@intents:intents()) -> binary().
create_packet(Token, Intents) ->
_pipe = gleam@json:object(
[{<<"op"/utf8>>, gleam@json:int(2)},
{<<"d"/utf8>>,
gleam@json:object(
[{<<"token"/utf8>>, gleam@json:string(Token)},
{<<"intents"/utf8>>,
gleam@json:int(
discord_gleam@discord@intents:intents_to_bitfield(
Intents
)
)},
{<<"properties"/utf8>>,
gleam@json:object(
[{<<"os"/utf8>>,
gleam@json:string(<<"gleam"/utf8>>)},
{<<"browser"/utf8>>,
gleam@json:string(
<<"discord_gleam"/utf8>>
)},
{<<"device"/utf8>>,
gleam@json:string(
<<"discord_gleam"/utf8>>
)}]
)}]
)}]
),
gleam@json:to_string(_pipe).
-file("src/discord_gleam/ws/packets/identify.gleam", 26).
-spec create_resume_packet(binary(), binary(), integer()) -> binary().
create_resume_packet(Token, Session_id, Sequence) ->
_pipe = gleam@json:object(
[{<<"op"/utf8>>, gleam@json:int(6)},
{<<"d"/utf8>>,
gleam@json:object(
[{<<"token"/utf8>>, gleam@json:string(Token)},
{<<"session_id"/utf8>>, gleam@json:string(Session_id)},
{<<"seq"/utf8>>, gleam@json:int(Sequence)}]
)}]
),
gleam@json:to_string(_pipe).