grottohub / glyph

A purely Gleam Discord library built from the ground up with stratus.
24 stars 4 forks source link

finish implementing model for `MessagePayload` #3

Closed grottohub closed 3 months ago

grottohub commented 3 months ago

right now, the library only supports the content field when sending a message. this is probably the most important model to finish fleshing out as it provides richer options for structuring your message.

see the model here, and the Discord docs here.

as with previous models, make sure to fully define the types used by a MessagePayload (such as also creating an Embed model).

important: since this is a payload, it does not need a decoder, but it does need an encoder (from model to json)

teesh3rt commented 3 months ago

thank you (im jan pona)

tygore587 commented 3 months ago

Hi, i wanted to get into gleam a bit but i'm totally new in this space. I normally use dotnet for everything.

Do I need anything as a headstart before starting on this issue or what would you recommend to look at before starting? I just wanted to take their tour beforehand.

grottohub commented 3 months ago

hey @tygore587 👋🏻 if you're entirely new to gleam, definitely run through the tour. this issue will primarily cover the concept of records.

encoding is fairly straightforward (matching the proper field to it's relevant data structure and value), but there may be some gotchas for nested fields, non-trivial types, etc. so definitely feel free to ask questions!