-
Notifications
You must be signed in to change notification settings - Fork 5
Activities
- Contents
- Activity Timestamps
- Activity Assets
- Party Size
- Activity Party
- Activity Secrets
- Activity
- ActivityManager
Discord.ActivityTimestamps
Extends Resource
.
Stores timestamp info for an activity.
start: int
The starting unix timestamp of the activity. Set to have an "elapsed" timer.
Default: 0
end: int
The ending unix timestamp of the activity. Set to have a "remaining" timer.
Default: 0
Discord.ActivityAssets
Extends Resource
.
Stores asset info for an activity.
large_image: String
The keyname of the large asset of an activity, limited to 127 characters.
Default: ""
large_text: String
The hover text for the large image of an activity, limited to 127 characters.
Default: ""
small_image: String
The keyname of the small asset of an activity, limited to 127 characters.
Default: ""
small_text: String
The hover text for the small image of an activity, limited to 127 characters.
Default: ""
Discord.PartySize
Extends Resource
.
Stores info about the size of a party.
current_size: int
The current size of the party, a 32-bit integer.
Default: 0
max_size: int
The maximum size of the party, a 32-bit integer.
Default: 0
Discord.ActivityParty
Extends Resource
.
Stores information about the activity party.
id: String
The unique part ID, limited to 127 characters.
Default: ""
size: Discord.PartySize
The size data for a party.
Default: new Discord.PartySize
(Will appear as [empty]
in the editor due to current limitations.)
Discord.ActivitySecrets
Extends Resource
.
Contains secret passwords for joining and spectating a game.
match: String
A unique hash for the given match context, limited to 127 characters. [Unused]
Default: ""
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: String
A unique hash for spectating, limited to 127 characters. Required for the Spectate button to be visible.
Default: ""
Discord.Activity
Extends Resource
.
Contains data for an activity to display on your Discord profile.
application_id: int
Your application identifier. This is a read-only field.
Default: 0
name: String
The name of the application, limited to 127 characters. This is a read-only field.
Default: ""
state: String
The player's current party status, limited to 127 characters.
Default: ""
details: String
What the player is currently doing, limited to 127 characters.
Default: ""
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: 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: Discord.ActivityParty
Information about the player's party.
Default: new Discord.ActivityParty
(Will appear as [empty]
in the editor due to current limitations.)
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: bool
Whether this activity is an instanced context, like a match. [Unused]
Default: false
DisorderActivityManager
Extends Reference
.
Contains methods and events related to activities.
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
.
-
command: String
- The command to register.
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>
.
-
steam_id: int
- Your game's Steam app id.
update_activity(activity: Discord.Activity, [callback_target: Object, callback_method: String])
Updates the user's displayed activity, and returns the success via a callback.
Has a corresponding signal update_activity_callback
that can be used instead of the optional target & method args.
-
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([callback_target: Object, callback_method: String])
Clears the user's current activity RPC.
Has a corresponding signal clear_activity_callback
that can be used instead of the optional target & method args.
-
callback_target: Object
- The callback target.callback_method: String
- The callback method's name.clear_activity_callback(result: Discord.Result)
send_request_reply(user_id: int, reply: Discord.ActivityJoinRequest, [callback_target: Object, callback_method: String])
Sends a reply to an Ask to Join request.
Has a corresponding signal send_request_reply_callback
that can be used instead of the optional target & method args.
-
user_id: int
- The user ID of the person who asked to join. -
reply: Discord.ActivityJoinRequest
- The response to send:No
,Yes
, orIgnore
.
-
callback_target: Object
- The callback target.callback_method: String
- The callback method's name.send_request_reply_callback(result: Discord.Result)
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.
-
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(user_id: int, callback_target: Object, callback_method: String)
Accepts a game invitation from a given user ID.
-
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)
activity_join(join_secret: String)
Fires when a user accepts a game chat invite or receives confirmation from Asking to Join.
-
join_secret: String
- The secret to join the user's game.
activity_spectate(spectate_secret: String)
Fires when a user accepts a spectate chat invite or clicks the Spectate button on a user's profile.
-
spectate_secret: String
- The secret to join the user's game as a spectator.
activity_join_request(user: Discord.User)
Fires when a user asks to join the current user's game.
-
user: Discord.User
- The user asking to join.
activity_invite(type: Discord.ActivityActionType, user: Discord.User, activity: Discord.Activity)
Fires when the user receives a join or spectate invite.
-
type: Discord.ActivityActionType
- Whether this invite is to join or spectate. -
user: Discord.User
- The user asking to join. -
activity: Discord.Activity
- The inviting user's current activity.
update_activity_callback(result: Discord.Result)
Alternative to the object & method args of update_activity
.
-
result: Discord.Result
- The result of the command.
clear_activity_callback(result: Discord.Result)
Alternative to the object & method args of clear_activity
.
-
result: Discord.Result
- The result of the command.
send_request_reply_callback(result: Discord.Result)
Alternative to the object & method args of send_request_reply
.
-
result: Discord.Result
- The result of the command.