Skip to content

Activity

Implementation of Discord Activity as a Luau builder.

https://discord.com/developers/docs/events/gateway-events#activity-object

Note: Only YouTube and Twitch URLs are allowed for streaming.

Activity.name  :: string

The name of the activity that is displayed. A custom status does not show it, so it defaults to "Custom Status" there.

Activity.activityType  :: ActivityType

The type of activity being performed.

Activity.streamingURL  :: string?

The URL of the stream, only YouTube and Twitch URLs are supported.

Activity.state  :: string?

The text of a custom status, or the party status shown under the name on other activity types.

Activity : setActivityName ( name )  -> Activity

Sets the name of the activity.

Parameters

name: string

Returns

Activity
Activity : setActivityType ( activityType )  -> Activity

Sets the type of the activity.

Parameters

activityType: ActivityType

Returns

Activity
Activity : setStreamingURL ( streamURL )  -> Activity

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

Parameters

streamURL: string

Returns

Activity
Activity : setState ( state )  -> Activity

Sets the state of the activity: the text of a custom status, or the party status on other activity types.

Parameters

state: string

Returns

Activity
Activity : build ( )  -> JSON

Builds the activity JSON payload that can be parsed by the Discord API.

Returns

JSON
Activity . new ( resource )  -> Activity

Creates a new Activity.

local activity = Activity.new({
name = "Playing a game",
activityType = "Game",
streamingURL = "https://twitch.tv/example"
})
local customStatus = Activity.new({
activityType = "Custom",
state = "Watching over the staff team!"
})

Parameters

resource: {
name: string?,
activityType: apiTypes.ActivityType?,
streamingURL: string?,
state: string?,
}

Returns

Activity