Skip to content

ActivityBuilder

ActivityBuilder is used to construct an activity object for a Discord bot - including name, type, and streaming URL.

Usage:

local activity = ActivityBuilder.new()
:setActivityName("Playing a game")
:setActivityType(ActivityBuilder.Type.Game)
:setStreamingURL("https://twitch.tv/example")

Properties

Type

ActivityBuilder.Type  :: table

An enumeration of activity types.

  • Game: 0
  • Streaming: 1
  • Listening: 2
  • Watching: 3
  • Competing: 5

Methods

setActivityName

ActivityBuilder : setActivityName (

     activityName: string
)  -> Builders.ActivityBuilder

Sets the name of the activity.

setActivityType

ActivityBuilder : setActivityType (

     activityType: number
)  -> Builders.ActivityBuilder

Sets the type of the activity.

setStreamingURL

ActivityBuilder : setStreamingURL (

     streamURL: string
)  -> Builders.ActivityBuilder

Sets the streaming URL of the activity. Only YouTube and Twitch URLs are allowed.

toPayloadObject

ActivityBuilder : toPayloadObject ()  -> Network.Resolvable

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

Functions

new

ActivityBuilder . new ()  -> ()

Creates a new instance of ActivityBuilder.