Template code to use Rich Presence on Discord.
Discord recently added Rich Presence for game developers but it can also be used by regular users.
I don't claim to be good at JavaScript and this code is probably not optimized. Feel free to contribute any optimization.
Discord Rich Presence itself isn't that stable either so that may affect performance.
git
command line (Windows|Linux|MacOS) installednode
Version 8.4.0 or higher- Discord Application
NOTE: You can't use a VPS for hosting unless you implement it in something like a selfbot.
In a command prompt in your projects folder (wherever that may be) run the following:
git clone https://github.com/IndyV/Rich-Presence-Template.git
Once finished:
- Navigate to your projects folder
- Edit
config.json
and set it to your personal preferences. See Configuration.
{
"Client_Id": "See step 5 of Creating your RPC application",
"Rich_Presence":{
"details": "[0]",
"state": "[1]",
"username": "[2]",
"file_username": "[3]",
"bannername": "[4]",
"file_bannername": "[5]",
"maxpartysize": [6],
"countdown_start": [7],
"Refresh": [8],
"Refresh_time": [9]
},
"Dont_Touch":{
"updatecounter": 0
}
}
String
The text under your Application name.String
Game state which will be placed on the left of your party information.String
Text that will appear if mouse hovers over the small icon.String
Filename of small asset you uploaded to your application. See step 4 of Creating your RPC application.String
Text that will appear if mouse hovers over the large icon.String
Filename of large asset you uploaded to your application. See step 4 of Creating your RPC application.Int
Max party sizeX
e.g.(Y of X)
(Y will be randomly generated for now).Int
Start time of the countdown in Epochs.Bool
If you want the RPC to update or not.Int
The time in seconds you want it to refresh. Must be >= 15
- Create your application.
- Press New app.
- Give your application an App Name. This will also be the main title of your Rich Presence and cannot be changed in config.json.
- Press Create App. Scroll down and press Enable Rich Presence.
DON'T CREATE A BOT USER!
- Upload a large and/or small asset and name it to something easy to remember.
- Copy the Client Id and paste it in
config.json
inClient_Id
.
You can safely share the application ID with others.
To start the Rich Presence, in the command prompt, run the following command:
node app.js
If it doesn't set immediately please wait for it to refresh (if set) or just re-node
app.js
If you need help or have questions add Indy#6602
on Discord.
- 0.1.1
- Improved user friendliness.
- ADD:
readme.md
for instructions. - ADD:
config.json
for the people that don't want to touch the code.
- 0.1.0
- Custom RPC.
- CHANGE:
app.js
now has more comments which is good.. I guess.
- 0.0.1
- Functional performance. Very important.
- Fork it (https://github.com/IndyV/Rich-Presence-Template/fork)
- Create your feature branch (
git checkout -b feature/fooBar
). - Commit your changes (
git commit -am 'Add some fooBar'
). - Push to the branch (
git push origin feature/fooBar
). - Create a new Pull Request.
Add Indy#6602
on Discord!
Distributed under the MIT license. See LICENSE
for more information.
- Jackz#7627
- devsnek