Alchemy.User (alchemy v0.6.8)

This module contains functions and types related to discord users.

Link to this section Summary

Types

t()

Represents a discord User. The default values exist to cover missing fields.

A shortened version of a Guild struct, through the view of a User.

Functions

Used to get the url for a user's avatar

Returns a string that mentions a user when used in a message

Link to this section Types

Specs

snowflake() :: String.t()

Specs

t() :: %Alchemy.User{
  avatar: String.t(),
  bot: Boolean,
  discriminator: String.t(),
  email: :hidden | String.t(),
  id: String.t(),
  username: String.t(),
  verified: :hidden | Boolean
}

Represents a discord User. The default values exist to cover missing fields.

  • id

    represents a unique user id

  • username

    represents a user's current username

  • discriminator

    4 digit tag to differenciate usernames

  • avatar

    A string representing their avatar hash. Use avatar_url to get the corresponding url from a User object

  • bot

    Whether or not the user is a bot - default: false

A bot usually doesn't have the authorization necessary to access these 2, so they're usually missing.

  • verified

    Whether the account is verified - default: :hidden

  • email

    The user's email - default: :hidden

Specs

token() :: String.t()

Specs

url() :: String.t()
Link to this type

user_guild()

Specs

user_guild() :: %Alchemy.UserGuild{
  icon: String.t(),
  id: snowflake(),
  name: String.t(),
  owner: Boolean,
  permissions: Integer
}

A shortened version of a Guild struct, through the view of a User.

  • id

    Represents the guild's id.

  • name

    Represents the guild's name.

  • icon

    A string representing the guild's icon hash.

  • owner

    Whether the user linked to the guild owns it.

  • permissions

    Bitwise of the user's enabled/disabled permissions.

Link to this section Functions

Link to this function

avatar_url(user)

Used to get the url for a user's avatar

type must be one of "png", "webp", "jpg", "gif"

size must be one of 128, 256, 512, 1024, 2048

Examples

> User.avatar_url(user)
https://cdn.discordapp.com/avatars/...
Link to this function

avatar_url(user, type, size)

Specs

avatar_url(t(), String.t(), Integer) :: url()

Returns a string that mentions a user when used in a message