glyde/event/messages

MESSAGE_* dispatches: deletes and reactions. Create and update decode straight to glyde/message.

Types

Not a mirror of ReactionRemove: the add carries member, message_author_id and burst_colors, and the remove carries none.

pub type ReactionAdd {
  ReactionAdd(
    user_id: id.Id(id.User),
    channel_id: id.Id(id.Channel),
    message_id: id.Id(id.Message),
    guild_id: option.Option(id.Id(id.Guild)),
    member: option.Option(member.GuildMember),
    emoji: emoji.Emoji,
    message_author_id: option.Option(id.Id(id.User)),
    burst: Bool,
    burst_colors: List(String),
    type_: message.ReactionType,
  )
}

Constructors

Three fields fewer than ReactionAdd, which is Discord’s shape.

pub type ReactionRemove {
  ReactionRemove(
    user_id: id.Id(id.User),
    channel_id: id.Id(id.Channel),
    message_id: id.Id(id.Message),
    guild_id: option.Option(id.Id(id.Guild)),
    emoji: emoji.Emoji,
    burst: Bool,
    type_: message.ReactionType,
  )
}

Constructors

Values

pub fn delete_bulk_decoder(
  build: fn(
    List(id.Id(id.Message)),
    id.Id(id.Channel),
    option.Option(id.Id(id.Guild)),
  ) -> event,
) -> decode.Decoder(event)

MESSAGE_DELETE_BULK, as message ids, channel id, guild id.

pub fn delete_decoder(
  build: fn(
    id.Id(id.Message),
    id.Id(id.Channel),
    option.Option(id.Id(id.Guild)),
  ) -> event,
) -> decode.Decoder(event)

MESSAGE_DELETE, as message id, channel id, guild id.

pub fn reaction_add_decoder() -> decode.Decoder(ReactionAdd)
pub fn reaction_remove_all_decoder(
  build: fn(
    id.Id(id.Channel),
    id.Id(id.Message),
    option.Option(id.Id(id.Guild)),
  ) -> event,
) -> decode.Decoder(event)

MESSAGE_REACTION_REMOVE_ALL, as channel id, message id, guild id.

pub fn reaction_remove_decoder() -> decode.Decoder(ReactionRemove)

No member, no message_author_id, no burst_colors. Copying the add decoder keeps them, and decode.field on an absent key drops the event.

pub fn reaction_remove_emoji_decoder(
  build: fn(
    id.Id(id.Channel),
    id.Id(id.Message),
    option.Option(id.Id(id.Guild)),
    emoji.Emoji,
  ) -> event,
) -> decode.Decoder(event)

MESSAGE_REACTION_REMOVE_EMOJI, as channel id, message id, guild id, emoji.

Search Document