Skip to content

PresenceBuilder

PresenceBuilder is used to construct a presence object for a Discord bot, including activities, status, and AFK state.

Usage:

local presence = PresenceBuilder.new()
:addActivity(ActivityBuilder.new():setActivityName("Playing a game"))
:setStatus(PresenceBuilder.Status.Online)
:setAfk(false)
:setSince(os.time())

Properties

Status

PresenceBuilder.Status  :: table

An enumeration of presence statuses.

  • Online: “online”
  • DoNotDisturb: “dnd”
  • Idle: “idle”
  • Invisible: “invisible”
  • Offline: “offline”

Methods

addActivity

PresenceBuilder : addActivity (

     activity: ActivityBuilder
)  -> Builders.PresenceBuilder

Adds an activity to the presence.

setStatus

PresenceBuilder : setStatus (

     status: string
)  -> Builders.PresenceBuilder

Sets the status of the presence.

setAfk

PresenceBuilder : setAfk (

     isAfk: boolean
)  -> Builders.PresenceBuilder

Sets whether the presence is AFK.

setSince

PresenceBuilder : setSince (

     delta: number
)  -> Builders.PresenceBuilder

Sets the time since the presence was last updated.

toPayloadObject

PresenceBuilder : toPayloadObject ()  -> Network.Resolvable

Converts the presence to a JSON object that can be sent to the Discord API.

Functions

new

PresenceBuilder . new ()  -> ()

Creates a new instance of PresenceBuilder.