diff --git a/README.md b/README.md index 4e4f779..874eed2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This project was created only for good purposes and personal use. - Unzip archive #### Please set your informations in the config.json file! -#### Remember that the line has to be at least 2 characters long! +#### Remember that the lines has to be at least 2 characters long! ```json { "clientId":"", #application id of a bot(already set in releases/source code) @@ -24,7 +24,17 @@ This project was created only for good purposes and personal use. "additionalinfo":"Bottom text", #second line in rich presence - "largeimagetext":":)" #text when hovering above icon + "largeimagetext":":)", #text when hovering above icon + + + "numberOfButtons":2, #number of buttons shown(0-2) + #button one name and url + "button1Text":"Button One", + "button1Link":"https://github.com/Prits001", + #button two name and url + "button2Text":"Button Two", + "button2Link":"https://github.com/Prits001" + } ``` ## How to run diff --git a/config.json b/config.json index 7592c58..ba0c4bd 100644 --- a/config.json +++ b/config.json @@ -5,5 +5,15 @@ "additionalinfo":"Bottom text", - "largeimagetext":":)" + "largeimagetext":":)", + + + "numberOfButtons":2, + + "button1Text":"Button One", + "button1Link":"https://github.com/Prits001", + + "button2Text":"Button Two", + "button2Link":"https://github.com/Prits001" + } \ No newline at end of file diff --git a/main.js b/main.js index 3d223ae..993b966 100644 --- a/main.js +++ b/main.js @@ -17,6 +17,16 @@ function checkConfig(){ console.log('\x1b[36m%s\x1b[0m',"[#]", "Drawing name: ", "\x1b[32m"+config.drawingname+"\x1b[0m") console.log('\x1b[36m%s\x1b[0m',"[#]", "Additional info: ", "\x1b[32m"+config.additionalinfo+"\x1b[0m") console.log('\x1b[36m%s\x1b[0m',"[#]", "Text when hovering above large image icon: ","\x1b[32m"+config.largeimagetext+"\x1b[0m") + console.log('\x1b[36m%s\x1b[0m',"[#]", "Ammount of buttons: ","\x1b[32m"+config.numberOfButtons+"\x1b[0m") + if(config.numberOfButtons > 0){ + console.log('\x1b[36m%s\x1b[0m',"[#]", "Name of the 1st button: ","\x1b[32m"+config.button1Text+"\x1b[0m") + console.log('\x1b[36m%s\x1b[0m',"[#]", "Url of the 1st button: ","\x1b[32m"+config.button1Link+"\x1b[0m") + if(config.numberOfButtons === 2){ + console.log('\x1b[36m%s\x1b[0m',"[#]", "Name of the 2nd button: ","\x1b[32m"+config.button2Text+"\x1b[0m") + console.log('\x1b[36m%s\x1b[0m',"[#]", "Url of the 2nd button: ","\x1b[32m"+config.button2Link+"\x1b[0m") + } + } + if(config.numberOfButtons < 0 || config.numberOfButtons > 2){console.log(`\x1b[31mYou can't have ${config.numberOfButtons} buttons! Please abort and fix the issue!\x1b[0m`)} console.log("Starting in 10 seconds..") console.log("\x1b[46mPress Ctrl+C to abort\x1b[0m") Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10000); @@ -35,6 +45,7 @@ function start(){ async function setActivity() { if (!Api) return; + if(config.numberOfButtons === 0){ Api.setActivity({ details: config.drawingname, state: config.additionalinfo, @@ -44,7 +55,47 @@ async function setActivity() { smallImageKey: 'pfp', smallImageText: "Made by Prits#2138", instance: false, - }); + });} + if(config.numberOfButtons === 1){ + Api.setActivity({ + details: config.drawingname, + state: config.additionalinfo, + startTimestamp: Date.now(), + largeImageKey: 'icon', + largeImageText: config.largeimagetext, + smallImageKey: 'pfp', + smallImageText: "Made by Prits#2138", + instance: false, + buttons: [ + { + label: config.button1Text, + url: config.button1Link + } + ] + }) + } + if(config.numberOfButtons === 2){ + Api.setActivity({ + details: config.drawingname, + state: config.additionalinfo, + startTimestamp: Date.now(), + largeImageKey: 'icon', + largeImageText: config.largeimagetext, + smallImageKey: 'pfp', + smallImageText: "Made by Prits#2138", + instance: false, + buttons: [ + { + label: config.button1Text, + url: config.button1Link + }, + { + label: config.button2Text, + url: config.button2Link + } + ] + }) + } }; start() Api.on('ready', async () => {