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.
Summary
Properties
Activity.name :: stringActivity.activityType :: api_types.ActivityTypeActivity.streamingURL :: string?Activity.state :: string?Properties
Section titled “Properties”The name of the activity that is displayed. A custom status does not show it, so it defaults to "Custom Status" there.
activityType
Section titled “activityType”The type of activity being performed.
streamingURL
Section titled “streamingURL”The URL of the stream, only YouTube and Twitch URLs are supported.
The text of a custom status, or the party status shown under the name on other activity types.
Methods
Section titled “Methods”setActivityName
Section titled “setActivityName”Activity : setActivityName ( name ) -> Activity
Sets the name of the activity.
Parameters
| name: string |
Returns
| Activity |
setActivityType
Section titled “setActivityType”Activity : setActivityType ( activityType ) -> Activity
Sets the type of the activity.
Parameters
| activityType: ActivityType |
Returns
| Activity |
setStreamingURL
Section titled “setStreamingURL”Activity : setStreamingURL ( streamURL ) -> Activity
Sets the streaming URL of the activity. Only YouTube and Twitch URLs are allowed.
Parameters
| streamURL: string |
Returns
| Activity |
setState
Section titled “setState”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 |
Functions
Section titled “Functions”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 |