├── .gitignore ├── package.json ├── config.json ├── README.md └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | scrapped -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "discord-rpc", 3 | "version": "1.0.0", 4 | "description": "Discord RPC", 5 | "main": "index.js", 6 | "dependencies": { 7 | "discord-rpc": "git+https://github.com/discordjs/RPC.git" 8 | }, 9 | "devDependencies": {}, 10 | "scripts": { 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "bin": "index.js", 14 | "pkg": { 15 | "assets": [ 16 | "node_modules/**/*", 17 | "src/**/*", 18 | "config.json" 19 | ], 20 | "targets": [ 21 | "node10-win-x64" 22 | ] 23 | }, 24 | "author": "xZyn", 25 | "license": "ISC" 26 | } 27 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ClientID": "CopiedID", 3 | "Description": "ShortDescription", 4 | "State": "ShortState", 5 | "Buttons?": "Disable", 6 | "TimeElapsed?": "Disable", 7 | 8 | "LargeImage": { 9 | "Tooltip": "A Tooltip!", 10 | "Asset": "AssetName" 11 | }, 12 | "SmallImage": { 13 | "Tooltip": "Another Tooltip!", 14 | "Asset": "AssetName" 15 | }, 16 | 17 | "Button1": { 18 | "Text": "Empty Text!", 19 | "Redirect": "https://a.real-link.xyz" 20 | }, 21 | "Button2": { 22 | "Text": "Empty Text!", 23 | "Redirect": "https://a.real-link.xyz" 24 | } 25 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

6 | 7 | ### Features 8 | - Get a suuuper snazzy rich presence for your profile 9 | - Choose your very own app name 10 | - Write a snazzy description 11 | - Throw in a state 12 | - *Basically a sub-description* 13 | - Upload custom images 14 | - Tooltip customization as well 15 | - Add buttons to your profile 16 | - Limited to `2` buttons + webpage redirects 17 | - Able to disable/enable 18 | - Set an elapsed time 19 | - Able to disable/enable 20 | 21 | ## Other Links 22 | ### [Installation](https://github.com/xQynx/Rich-Presence/wiki/Installation) 23 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | // Imports 2 | const rpc = require('discord-rpc'); 3 | const config = require('./config.json'); 4 | const client = new rpc.Client({ 5 | transport: 'ipc' 6 | }) 7 | 8 | // Console Presets 9 | const spacer = ` `; 10 | 11 | // Enabled / Disabled 12 | 13 | Buttons = Boolean(config['Buttons?']); 14 | if (config['Buttons?'] == 'Disable') { 15 | var x = 0 16 | } else if (config['Buttons?'] == 'Enable') { 17 | var x = 1; 18 | } 19 | 20 | ElaspedTime = Boolean(config['TimeElapsed?']); 21 | if (config['TimeElapsed?'] == "Disable") { 22 | var t = 0; 23 | } else if (config["TimeElapsed?"] == "Enable") { 24 | var t = 1; 25 | } 26 | 27 | // External Stuff 28 | time = new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); 29 | 30 | // Startup Output 31 | console.log("Starting up .."); 32 | console.log(spacer + "Gathering Login & Authentication .."); 33 | 34 | // On-ready Function 35 | client.on('ready', () => { 36 | console.log( 37 | spacer + spacer + "Authorized via", 38 | client.user.username + "#" + client.user.discriminator 39 | ); 40 | console.log(spacer + "Presence .."); 41 | 42 | if (x === 0) { 43 | if (t === 0) { 44 | client.clearActivity; 45 | client.request("SET_ACTIVITY", { 46 | pid: process.pid, 47 | activity: { 48 | // Client Config 49 | details: config.Description, 50 | state: config.State, 51 | assets: { 52 | large_image: config.LargeImage.Asset, 53 | large_text: config.LargeImage.Tooltip, 54 | small_image: config.SmallImage.Asset, 55 | small_text: config.SmallImage.Tooltip, 56 | }, 57 | }, 58 | }); 59 | } else if (t === 1) { 60 | client.clearActivity; 61 | client.request("SET_ACTIVITY", { 62 | pid: process.pid, 63 | activity: { 64 | // Client Config 65 | details: config.Description, 66 | state: config.State, 67 | timestamps: { 68 | start: Date.now() + 5 * 60, 69 | }, 70 | assets: { 71 | large_image: config.LargeImage.Asset, 72 | large_text: config.LargeImage.Tooltip, 73 | small_image: config.SmallImage.Asset, 74 | small_text: config.SmallImage.Tooltip, 75 | }, 76 | }, 77 | }); 78 | } 79 | } else if (x === 1) { 80 | if (t === 0) { 81 | client.clearActivity; 82 | client.request("SET_ACTIVITY", { 83 | pid: process.pid, 84 | activity: { 85 | // Client Config 86 | details: config.Description, 87 | state: config.State, 88 | assets: { 89 | large_image: config.LargeImage.Asset, 90 | large_text: config.LargeImage.Tooltip, 91 | small_image: config.SmallImage.Asset, 92 | small_text: config.SmallImage.Tooltip, 93 | }, 94 | // Button Config 95 | buttons: [ 96 | { 97 | label: config.Button1.Text, 98 | url: config.Button1.Redirect, 99 | }, 100 | { 101 | label: config.Button2.Text, 102 | url: config.Button2.Redirect, 103 | }, 104 | ], 105 | }, 106 | }); 107 | } 108 | if (t === 1) { 109 | client.clearActivity; 110 | client.request("SET_ACTIVITY", { 111 | pid: process.pid, 112 | activity: { 113 | // Client Config 114 | details: config.Description, 115 | state: config.State, 116 | timestamps: { 117 | start: Date.now() + 5 * 60, 118 | }, 119 | assets: { 120 | large_image: config.LargeImage.Asset, 121 | large_text: config.LargeImage.Tooltip, 122 | small_image: config.SmallImage.Asset, 123 | small_text: config.SmallImage.Tooltip, 124 | }, 125 | // Button Config 126 | buttons: [ 127 | { 128 | label: config.Button1.Text, 129 | url: config.Button1.Redirect, 130 | }, 131 | { 132 | label: config.Button2.Text, 133 | url: config.Button2.Redirect, 134 | }, 135 | ], 136 | }, 137 | }); 138 | } 139 | } else { 140 | console.log( 141 | spacer + 142 | spacer + 143 | "* Invalid toggle value in config. This error appeared due to [Enable/Disable] not appearing properly under [Buttons?] / [TimeElapsed?]." 144 | ); 145 | } 146 | console.log(spacer + spacer + "* Loaded [/ Dependencies]"); // Presence 147 | console.log(spacer + spacer + "* Loaded [/ Required Assets]"); // Assets 148 | if (t !== 0) { 149 | console.log(spacer + spacer + "* Loaded [/ Time Elapsed]"); // Time Elapsed 150 | } 151 | if (x !== 0) { 152 | console.log(spacer + spacer + "* Loaded [/ Buttons]"); // Buttons 153 | console.log(spacer + spacer + spacer + "^ Verified Redirects"); // Buttons 154 | } 155 | console.log("* Presence Ready!"); 156 | console.log(spacer + "* Running since " + `[${time}]`); // Runtime 157 | }); 158 | 159 | // Starts the presence 160 | client.login({ 161 | clientId: config.ClientID 162 | }).catch(console.error); // Error Squsher - catches errors and outputs them --------------------------------------------------------------------------------