Skip to content

SupUser

The SupUser object represents a user on Sup. It provides info about the user and methods for storing/retrieving user-specific data.

Example User
// Get info about the current user
sup.user.username // => "alice"
sup.user.displayName // => "Alice"
sup.user.pfp // => "SupImage: { ... }"
sup.user.banner // => "SupImage: { ... }"
sup.user.id // => "cabcdefghijklm0123456789"
// Get info about other users
sup.reply.author.username // => "bob"
sup.reply.author.displayName // => "Bob"
sup.reply.author.pfp // => "SupImage: { ... }"
sup.reply.author.banner // => "SupImage: { ... }"
sup.reply.author.id // => "cabcdefghijklm0123456789"

Properties

username

type: string

The user’s username.

displayName

type: string

The user’s display name.

pfp

type: SupImage

The user’s profile picture.

type: SupImage

The user’s profile banner.

id

type: string

The user’s unique ID.

Methods

set

type: function(key: string, value: any): void

Store a value in user-scoped state. For example:

sup.user.set("favoriteColor", "green");

The key can be any string, and the value can be any JSON-serializable object (including Sup classes like SupUser, SupImage, SupMessage, etc.).

get

type: function(key: string): any

Get a value from user-scoped state. For example:

const favoriteColor = sup.user.get("favoriteColor"); // "green"

keys

type: function(): string[]

Returns an array of all keys stored in this user’s scoped state.

const keys = sup.user.keys(); // ["favoriteColor", "gameScore", ...]