-
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.
[Deprecated]
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
Discord.ActivityManager
Extends Reference
.
Contains methods and events related to activities.
register_command(command: String) -> Discord.Result
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.
Discord.Result
- The result of the operation.
register_steam(steam_id: int) -> Discord.Result
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.
Discord.Result
- The result of the operation.
update_activity(activity: Discord.Activity, [callback_target: Object, callback_method: String]) -> void
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]) -> void
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.ActivityJoinRequestReply, [callback_target: Object, callback_method: String]) -> void
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.ActivityJoinRequestReply
- 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]) -> void
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.
Has a corresponding signal send_invite__callback
that can be used instead of the optional target & method args.
-
user_id: int
- The user ID of the person to invite. -
type: Discord.ActivityActionType
- This marks the invite as an invitation to join orspectate. -
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]) -> void
Accepts a game invitation from a given user ID.
Has a corresponding signal accept_invite_callback
that can be used instead of the optional target & method args.
-
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.
[Deprecated]
-
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 orspectate. -
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.
send_invite_callback(result: Discord.Result)
Alternative to the object & method args of send_invite
.
-
result: Discord.Result
- The result of the command.
accept_invite_callback(result: Discord.Result)
Alternative to the object & method args of accept_invite
.
-
result: Discord.Result
- The result of the command.