Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Activities

Lenny edited this page Feb 10, 2021 · 45 revisions

Contents

Activity Timestamps

Discord.ActivityTimestamps

Extends Resource.

Description

Stores timestamp info for an activity.

Properties

Start

start: int

The starting unix timestamp of the activity. Set to have an "elapsed" timer.

Default: 0

End

end: int

The ending unix timestamp of the activity. Set to have a "remaining" timer.

Default: 0

Activity Assets

Discord.ActivityAssets

Extends Resource.

Description

Stores asset info for an activity.

Properties

Large Image

large_image: String

The keyname of the large asset of an activity, limited to 127 characters.

Default: ""

Large Text

large_text: String

The hover text for the large image of an activity, limited to 127 characters.

Default: ""

Small Image

small_image: String

The keyname of the small asset of an activity, limited to 127 characters.

Default: ""

Small Text

small_text: String

The hover text for the small image of an activity, limited to 127 characters.

Default: ""

Party Size

Discord.PartySize

Extends Resource.

Description

Stores info about the size of a party.

Properties

Current Size

current_size: int

The current size of the party, a 32-bit integer.

Default: 0

Max Size

max_size: int

The maximum size of the party, a 32-bit integer.

Default: 0

Activity Party

Discord.ActivityParty

Extends Resource.

Description

Stores information about the activity party.

Properties

ID

id: String

The unique part ID, limited to 127 characters.

Default: ""

Size

size: Discord.PartySize

The size data for a party.

Default: new Discord.PartySize (Will appear as [empty] in the editor due to current limitations.)

Activity Secrets

Discord.ActivitySecrets

Extends Resource.

Description

Contains secret passwords for joining and spectating a game.

Properties

Match

match: String

A unique hash for the given match context, limited to 127 characters. [Unused]

Default: ""

Join

join: String

A unique hash for chat invites and Ask to Join, limited to 127 characters. Required for the Join or Ask To Join button to be visible.

Default: ""

Spectate

spectate: String

A unique hash for spectating, limited to 127 characters. Required for the Spectate button to be visible.

Default: ""

Activity

Discord.Activity

Extends Resource.

Description

Contains data for an activity to display on your Discord profile.

Properties

Application ID

application_id: int

Your application identifier. This is a read-only field.

Default: 0

Name

name: String

The name of the application, limited to 127 characters. This is a read-only field.

Default: ""

State

state: String

The player's current party status, limited to 127 characters.

Default: ""

Details

details: String

What the player is currently doing, limited to 127 characters.

Default: ""

Timestamps

timestamps: Discord.ActivityTimestamps

Helps create elapsed/remaining timestamps on a player's activity.

Default: new Discord.ActivityTimestamps (Will appear as [empty] in the editor due to current limitations.)

Assets

assets: Discord.ActivityAssets

Assets to display on the player's activity.

Default: new Discord.ActivityAssets (Will appear as [empty] in the editor due to current limitations.)

Party

party: Discord.ActivityParty

Information about the player's party.

Default: new Discord.ActivityParty (Will appear as [empty] in the editor due to current limitations.)

Secrets

secrets: Discord.ActivitySecrets

Secret passwords for joining and spectating the player's game.

Default: new Discord.ActivitySecrets (Will appear as [empty] in the editor due to current limitations.)

Instance

instance: bool

Whether this activity is an instanced context, like a match. [Unused]

Default: false

ActivityManager

DisorderActivityManager

Extends Reference.

Description

Contains methods and events related to activities.

Methods

Register Command

register_command(command: String)

Registers a command by which Discord can launch your game. This might be a custom protocol, like my-awesome-game://, or a path to an executable. It also supports any launch parameters that may be needed, like game.exe --full-screen --no-hax.

On macOS, due to the way Discord registers executables, your game needs to be bundled for this command to work. That means it should be a .app.

Arguments

  • command: String - The command to register.

Register Steam

register_steam(steam_id: int)

Used if you are distributing this SDK on Steam. Registers your game's Steam app id for the protocol steam://run-game-id/<id>.

Arguments

  • steam_id: int - Your game's Steam app id.

Update Activity

update_activity(activity: Discord.Activity, callback_target: Object, callback_method: String)

Updates the user's displayed activity, and returns the success via a callback.

Arguments

  • activity: Discord.Activity - The new activity for the user.

  • callback_target: Object - The callback target.

    callback_method: String - The callback method's name.

    update_activity_callback(result: Discord.Result)

Clear Activity

clear_activity(callback_target: Object, callback_method: String)

Clears the user's current activity RPC.

Arguments

  • callback_target: Object - The callback target.

    callback_method: String - The callback method's name.

    clear_activity_callback(result: Discord.Result)

Send Request Reply

send_request_reply(user_id: int, reply: Discord.ActivityJoinRequest, callback_target: Object, callback_method: String)

Sends a reply to an Ask to Join request.

Arguments

  • user_id: int - The user ID of the person who asked to join.

  • reply: Discord.ActivityJoinRequest - The response to send: No, Yes, or Ignore.

  • callback_target: Object - The callback target.

    callback_method: String - The callback method's name.

    send_request_reply_callback(result: Discord.Result)

Send Invite

send_invite(user_id: int, type: Discord.ActivityActionType, content: String, callback_target: Object, callback_method: String)

Sends a game invite to a given user. If you do not have a valid activity with all the required fields, this call will error. See Activity Action Field Requirements for the fields required to have join and spectate invites function properly.

Arguments

  • user_id: int - The user ID of the person to invite.

  • type: Discord.ActivityActionType - This marks the invite as an invitation to join or spectate.

  • content: String - A message to send along with the invite.

  • callback_target: Object - The callback target.

    callback_method: String - The callback method's name.

    send_invite_callback(result: Discord.Result)

Accept Invite

accept_invite(user_id: int, callback_target: Object, callback_method: String)

Accepts a game invitation from a given user ID.

Arguments

  • user_id: int - The ID of the user who invited you.

  • callback_target: Object - The callback target.

    callback_method: String - The callback method's name.

    accept_invite_callback(result: Discord.Result)

Signals

Activity Join

activity_join(join_secret: String)

Fires when a user accepts a game chat invite or receives confirmation from Asking to Join.

Arguments

  • join_secret: String - The secret to join the user's game.

Activity Spectate

activity_spectate(spectate_secret: String)

Fires when a user accepts a spectate chat invite or clicks the Spectate button on a user's profile.

Arguments

  • spectate_secret: String - The secret to join the user's game as a spectator.

Activity Join Request

activity_join_request(user: Discord.User)

Fires when a user asks to join the current user's game.

Arguments

  • user: Discord.User - The user asking to join.
Clone this wiki locally