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.

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 : 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 : 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"
})

Parameters

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

Returns

Activity