SetDiscordApplicationID: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
{{Important Note|To reset, please use [[resetDiscordRichPresenceData]]}}
{{Important Note|To reset the application ID, please use [[resetDiscordRichPresenceData]]}}
{{Important Note|In order for the function to work correctly, each must set in the discord -> settings -> activity privacy -> activity status to on.}}
{{Important Note|In order for the function to work correctly, the user must have their activity privacy/status enabled in Discord.}}
{{New feature/item|3.0161|1.6.0|22270|
The function can assign your own application to use in Rich Presence.
The function can assign your own application to use in Rich Presence.
You can create own '''[https://discord.com/developers/applications here]'''
You can create an application '''[https://discord.com/developers/applications here]'''
}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setDiscordApplicationID(string applicationKey)
bool setDiscordApplicationID(string applicationID)
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[DiscordRPC]]:setApplication}}
{{OOP||[[DiscordRPC]]:setApplication}}


===Required arguments===
===Required arguments===
*'''applicationKey''': a string represent key your's Application on Discord.
*'''applicationID''': a string representing your Discord application's ID.
 
===Returns===
===Returns===
Returns ''true'' if function succeeds, ''false'' if the client has disabled synchronisation.
Returns ''true'' if function succeeds, ''false'' if the client has disabled rich presence.


==Example==
==Example==
This example prints out if the application was successfully set up and set custom asset image.
This example outputs whether the application was successfully setup and sets a custom asset image.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local app_key = "YOUR_APPLICATION_KEY"
local app_id = "YOUR_APPLICATION_ID"
if setDiscordApplicationID(app_key) then  
if setDiscordApplicationID(app_id) then  
     setDiscordRichPresenceAsset("asset_name_from_application")
     setDiscordRichPresenceAsset("asset_name_from_application")
     outputChatBox("Yay, we using now own application!")
     outputChatBox("Yay, we're now using our own application!")
end  
end  
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 18:39, 24 October 2023

[[{{{image}}}|link=|]] Important Note: To reset the application ID, please use resetDiscordRichPresenceData
[[{{{image}}}|link=|]] Important Note: In order for the function to work correctly, the user must have their activity privacy/status enabled in Discord.
ADDED/UPDATED IN VERSION 1.6.0 r22270:

The function can assign your own application to use in Rich Presence. You can create an application here

Syntax

bool setDiscordApplicationID(string applicationID)

OOP Syntax Help! I don't understand this!

Method: DiscordRPC:setApplication(...)


Required arguments

  • applicationID: a string representing your Discord application's ID.

Returns

Returns true if function succeeds, false if the client has disabled rich presence.

Example

This example outputs whether the application was successfully setup and sets a custom asset image.

local app_id = "YOUR_APPLICATION_ID"
if setDiscordApplicationID(app_id) then 
    setDiscordRichPresenceAsset("asset_name_from_application")
    outputChatBox("Yay, we're now using our own application!")
end 

See Also

ADDED/UPDATED IN VERSION 1.6.0 r22342: