glyde/model/member

A guild member: the account plus everything true of it in one guild only.

roles is the only field every wire shape carries. Interaction resolved data drops user, deaf and mute; GUILD_MEMBER_UPDATE drops flags.

Types

pub type GuildMember {
  GuildMember(
    user: option.Option(user.User),
    nick: option.Option(String),
    avatar: option.Option(String),
    banner: option.Option(String),
    roles: List(id.Id(id.Role)),
    joined_at: option.Option(String),
    premium_since: option.Option(String),
    deaf: option.Option(Bool),
    mute: option.Option(Bool),
    flags: option.Option(flags.Flags(GuildMemberFlag)),
    pending: option.Option(Bool),
    permissions: option.Option(permissions.Permissions),
    communication_disabled_until: option.Option(String),
  )
}

Constructors

  • GuildMember(
      user: option.Option(user.User),
      nick: option.Option(String),
      avatar: option.Option(String),
      banner: option.Option(String),
      roles: List(id.Id(id.Role)),
      joined_at: option.Option(String),
      premium_since: option.Option(String),
      deaf: option.Option(Bool),
      mute: option.Option(Bool),
      flags: option.Option(flags.Flags(GuildMemberFlag)),
      pending: option.Option(Bool),
      permissions: option.Option(permissions.Permissions),
      communication_disabled_until: option.Option(String),
    )

    Arguments

    user

    Absent in resolved data, where the id is the map key, and on the partial member in MESSAGE_CREATE and MESSAGE_UPDATE.

    avatar

    Per-guild avatar hash, not the account one.

    joined_at

    Null means the member was invited as a guest. Absent on some partials.

    premium_since

    ISO-8601, when the member started boosting the guild.

    flags

    None on the shapes that drop the key, GUILD_MEMBER_UPDATE included. Defaulting it to 0 would let a cache merge clear flags nobody cleared.

    pending

    Only the GUILD_ events send this, so absent is not the same as false.

    permissions

    Interactions only, and scoped to the interaction’s channel, not the guild.

    communication_disabled_until

    ISO-8601 expiry of a timeout. A past time is not a timeout either, so compare it against the clock instead of testing for null.

pub type GuildMemberFlag {
  DidRejoin
  CompletedOnboarding
  BypassesVerification
  StartedOnboarding
  IsGuest
  StartedHomeActions
  CompletedHomeActions
  AutomodQuarantinedUsername
  DmSettingsUpsellAcknowledged
  AutomodQuarantinedGuildTag
}

Constructors

  • DidRejoin
  • CompletedOnboarding
  • BypassesVerification
  • StartedOnboarding
  • IsGuest
  • StartedHomeActions
  • CompletedHomeActions
  • AutomodQuarantinedUsername
  • DmSettingsUpsellAcknowledged
  • AutomodQuarantinedGuildTag

Values

pub fn display_name(member: GuildMember) -> option.Option(String)

The per-guild nickname, then whatever the account itself answers.

pub fn has_flag(
  bits: flags.Flags(GuildMemberFlag),
  flag: GuildMemberFlag,
) -> Bool
pub fn member_flags(
  of chosen: List(GuildMemberFlag),
) -> flags.Flags(GuildMemberFlag)

Build the flags an edit sends. Anything decoded off the wire should be edited with with_flag instead, so bits this build cannot name survive.

Search Document