Greasy Fork is available in English.

Discord Status Animator (Manual edit/Non-UI)

Automatically changes your Discord status

Version au 17/06/2021. Voir la dernière version.


Installer ce script?
// ==UserScript==// @name         Discord Status Animator (Manual edit/Non-UI)// @namespace    https://github.com/Hakorr/discord-status-animator// @run-at       document-start// @version      1.6// @description  Automatically changes your Discord status// @author       HKR// @match        https://discord.com/*// @grant        none// ==/UserScript==//Welcome! Don't be scared by the code, I was too lazy to do an UI for this.//Visit the Github for more more instructions! github.com/Hakorr/discord-status-animatorvar name = "Status Animator";var version = "V1.6";var run = true;//A Cookie will be made with this name, feel free to edit it//DO NOT SHARE THIS COOKIE WITH ANYONE AS IT'S YOUR DISCORD TOKENvar cookie_name = "DoNotShareThisToken";var delete_cookie_after_a_week = true;//Your status will be changed to these after you close the Discord tabvar default_status_text = "";var default_status_emoji = "";var default_status_state = "online";async function statusanimation() {//This is your animation code///////////////////////////////////////////await blink("🥳","I'm using Discord Status Animator!",2000,1);if(await skip(10,"unique")) return;await settext("Get it here! Github.com/Hakorr/discord-status-animator");await wait(5000);//////////////////////////////////////Your animation code ends here/////}//////////////////////////////////////* ANIMATION BLOCKS /////////////////Timeouts are in milliseconds! You can type "random" on the emoji section to randomize it!- await wait(ms);- await blank();- await setstate("state");-> states = invisible, dnd, idle, online- await setemoji("emoji");- await settext("text");- await status(emoji,text,state);-> states = invisible, dnd, idle, online- await typewriter("emoji","text",timeout,reversed);- await glitch("emoji","text",times,timeout);- await glitchtype("emoji","text",timeout,glitch_rate,reversed);- await sentence("emoji","text",timeout);- await blink("emoji","text",timeout,times);- await count("emoji","prefix",count_to,"suffix",timeout,reversed);- if(await skip(1,"unique")) return;-> The unique string can be anything. If you use two skips, remember to make each one different.//Do not edit after this line (If you don't know what you're doing)/*///////////////////////////////////////////////////////////////*////////////////////////////////////////////////////////////////////function random_emoji() {var emojis = ['😄','😃','😀','😊','😉','😍','😘','😚','😗','😙','😜','😝','😛','😳','😁','😔','😌','😒','😞','😣','😢','😂','😭','😪','😥','😰','😅','😓','😩','😫','😨','😱','😠','😡','😤','😖','😆','😋','😷','😎','😴','😵','😲','😟','😦','😧','😈','👿','😮','😬','😐','😕','😯','😶','😇','😏','😑','👲','👳','👮','👷','💂','👶','👦','👧','👨','👩','👴','👵','👱','👼','👸','😺','😸','😻','😽','😼','🙀','😿','😹','😾','👹','👺','🙈','🙉','🙊','💀','👽','💩','🔥','✨','🌟','💫','💥','💢','💦','💧','💤','💨','👂','👀','👃','👅','👄','👍','👎','👌','👊','✊','✌','👋','✋','👐','👆','👇','👉','👈','🙌','🙏','☝','👏','💪','🚶','🏃','💃','👫','👪','👬','👭','💏','💑','👯','🙆','🙅','💁','🙋','💆','💇','💅','👰','🙎','🙍','🙇','🎩','👑','👒','👟','👞','👡','👠','👢','👕','👔','👚','👗','🎽','👖','👘','👙','💼','👜','👝','👛','👓','🎀','🌂','💄','💛','💙','💜','💚','❤','💔','💗','💓','💕','💖','💞','💘','💌','💋','💍','💎','👤','👥','💬','👣','💭','🐶','🐺','🐱','🐭','🐹','🐰','🐸','🐯','🐨','🐻','🐷','🐽','🐮','🐗','🐵','🐒','🐴','🐑','🐘','🐼','🐧','🐦','🐤','🐥','🐣','🐔','🐍','🐢','🐛','🐝','🐜','🐞','🐌','🐙','🐚','🐠','🐟','🐬','🐳','🐋','🐄','🐏','🐀','🐃','🐅','🐇','🐉','🐎','🐐','🐓','🐕','🐖','🐁','🐂','🐲','🐡','🐊','🐫','🐪','🐆','🐈','🐩','🐾','💐','🌸','🌷','🍀','🌹','🌻','🌺','🍁','🍃','🍂','🌿','🌾','🍄','🌵','🌴','🌲','🌳','🌰','🌱','🌼','🌐','🌞','🌝','🌚','🌑','🌒','🌓','🌔','🌕','🌖','🌗','🌘','🌜','🌛','🌙','🌍','🌎','🌏','🌋','🌌','🌠','⭐','☀','⛅','☁','⚡','☔','❄','⛄','🌀','🌁','🌈','🌊','🎍','💝','🎎','🎒','🎓','🎏','🎆','🎇','🎐','🎑','🎃','👻','🎅','🎄','🎁','🎋','🎉','🎊','🎈','🎌','🔮','🎥','📷','📹','📼','💿','📀','💽','💾','💻','📱','☎','📞','📟','📠','📡','📺','📻','🔊','🔉','🔈','🔇','🔔','🔕','📢','📣','⏳','⌛','⏰','⌚','🔓','🔒','🔏','🔐','🔑','🔎','💡','🔦','🔆','🔅','🔌','🔋','🔍','🛁','🛀','🚿','🚽','🔧','🔩','🔨','🚪','🚬','💣','🔫','🔪','💊','💉','💰','💴','💵','💷','💶','💳','💸','📲','📧','📥','📤','✉','📩','📨','📯','📫','📪','📬','📭','📮','📦','📝','📄','📃','📑','📊','📈','📉','📜','📋','📅','📆','📇','📁','📂','✂','📌','📎','✒','✏','📏','📐','📕','📗','📘','📙','📓','📔','📒','📚','📖','🔖','📛','🔬','🔭','📰','🎨','🎬','🎤','🎧','🎼','🎵','🎶','🎹','🎻','🎺','🎷','🎸','👾','🎮','🃏','🎴','🀄','🎲','🎯','🏈','🏀','⚽','⚾','🎾','🎱','🏉','🎳','⛳','🚵','🚴','🏁','🏇','🏆','🎿','🏂','🏊','🏄','🎣','☕','🍵','🍶','🍼','🍺','🍻','🍸','🍹','🍷','🍴','🍕','🍔','🍟','🍗','🍖','🍝','🍛','🍤','🍱','🍣','🍥','🍙','🍘','🍚','🍜','🍲','🍢','🍡','🍳','🍞','🍩','🍮','🍦','🍨','🍧','🎂','🍰','🍪','🍫','🍬','🍭','🍯','🍎','🍏','🍊','🍋','🍒','🍇','🍉','🍓','🍑','🍈','🍌','🍐','🍍','🍠','🍆','🍅','🌽','🏠','🏡','🏫','🏢','🏣','🏥','🏦','🏪','🏩','🏨','💒','⛪','🏬','🏤','🌇','🌆','🏯','🏰','⛺','🏭','🗼','🗾','🗻','🌄','🌅','🌃','🗽','🌉','🎠','🎡','⛲','🎢','🚢','⛵','🚤','🚣','⚓','🚀','✈','💺','🚁','🚂','🚊','🚉','🚞','🚆','🚄','🚅','🚈','🚇','🚝','🚋','🚃','🚎','🚌','🚍','🚙','🚘','🚗','🚕','🚖','🚛','🚚','🚨','🚓','🚔','🚒','🚑','🚐','🚲','🚡','🚟','🚠','🚜','💈','🚏','🎫','🚦','🚥','⚠','🚧','🔰','⛽','🏮','🎰','♨','🗿','🎪','🎭','📍','🚩','⬆','⬇','⬅','➡','🔠','🔡','🔤','↗','↖','↘','↙','↔','↕','🔄','◀','▶','🔼','🔽','↩','↪','ℹ','⏪','⏩','⏫','⏬','⤵','⤴','🆗','🔀','🔁','🔂','🆕','🆙','🆒','🆓','🆖','📶','🎦','🈁','🈯','🈳','🈵','🈴','🈲','🉐','🈹','🈺','🈶','🈚','🚻','🚹','🚺','🚼','🚾','🚰','🚮','🅿','♿','🚭','🈷','🈸','🈂','Ⓜ','🛂','🛄','🛅','🛃','🉑','㊙','㊗','🆑','🆘','🆔','🚫','🔞','📵','🚯','🚱','🚳','🚷','🚸','⛔','✳','❇','❎','✅','✴','💟','🆚','📳','📴','🅰','🅱','🆎','🅾','💠','➿','♻','♈','♉','♊','♋','♌','♍','♎','♏','♐','♑','♒','♓','⛎','🔯','🏧','💹','💲','💱','©','®','™','〽','〰','🔝','🔚','🔙','🔛','🔜','❌','⭕','❗','❓','❕','❔','🔃','🕛','🕧','🕐','🕜','🕑','🕝','🕒','🕞','🕓','🕟','🕔','🕠','🕕','🕖','🕗','🕘','🕙','🕚','🕡','🕢','🕣','🕤','🕥','🕦','✖','➕','➖','➗','♠','♥','♣','♦','💮','💯','✔','☑','🔘','🔗','➰','🔱','🔲','🔳','◼','◻','◾','◽','▪','▫','🔺','⬜','⬛','⚫','⚪','🔴','🔵','🔻','🔶','🔷','🔸','🔹'];return emojis[Math.floor(Math.random() * emojis.length)];}//Output XX/XX/XX @ XX:XX:XXfunction getDateTime() {var currentdate = new Date();if(currentdate.getMinutes() > 9) var fixed_minutes = currentdate.getMinutes();else var fixed_minutes = "0" + currentdate.getMinutes();if(currentdate.getSeconds() > 9) var fixed_seconds = currentdate.getSeconds();else var fixed_seconds = "0" + currentdate.getSeconds();var datetime =  currentdate.getDate() + "/" + (currentdate.getMonth()+1) + "/" + currentdate.getFullYear() + " @ "  + currentdate.getHours() + ":" + fixed_minutes + ":" + fixed_seconds;return datetime;}//Output: XX:XX:XXfunction getExactTime() {var currentdate = new Date();if(currentdate.getMinutes() > 9) var fixed_minutes = currentdate.getMinutes();else var fixed_minutes = "0" + currentdate.getMinutes();if(currentdate.getSeconds() > 9) var fixed_seconds = currentdate.getSeconds();else var fixed_seconds = "0" + currentdate.getSeconds();var datetime = currentdate.getHours() + ":" + fixed_minutes + ":" + fixed_seconds;return datetime;}//Output: X:XXfunction getTime() {var currentdate = new Date();if(currentdate.getMinutes() > 9) var fixed_minutes = currentdate.getMinutes();else var fixed_minutes = "0" + currentdate.getMinutes();var datetime = currentdate.getHours() + ":" + fixed_minutes;return datetime;}//Simple wait function for animationfunction wait(t) {return new Promise(function(resolve) {setTimeout(resolve, t)});}//Typewriter effectasync function typewriter(emoji,text,timeout,reversed) {//Repeat for each letterfor(var i = 1; i <= text.length; i++) {//Cut the textif(!reversed) var substring_text = text.substring(0,i);else var substring_text = text.substring(0,text.length - i);//Set the status to the cutted textif(emoji != "random") await status(emoji,substring_text);else await status(random_emoji(),substring_text);//Wait a selected amount of time until writing the next letterawait wait(timeout);}return;}//Glitch effectasync function glitch(emoji,text,times,timeout) {//Repeat for each letterfor(var i = 1; i < times; i++) {//Shuffle the textvar glitch_text = shuffle(text)//Set the status to the cutted textif(emoji != "random") await status(emoji,glitch_text);else await status(random_emoji(),glitch_text);//Wait a selected amount of time until writing the next letterawait wait(timeout);}return;}//Glitchtype effectasync function glitchtype(emoji,text,timeout,glitch_rate,reversed) {//Repeat for each letterfor(var i = 1; i <= text.length; i++) {//Cut the textif(!reversed) var substring_text = text.substring(0,i);else var substring_text = text.substring(0,text.length - i);//Glitch rest of the textif(!reversed) var glitch_text = shuffle(text.substring(i));else var glitch_text = shuffle(text.substring(text.length - i));//Set the status to the cutted text + glitched textif(emoji != "random") await status(emoji,substring_text + glitch_text);else await status(random_emoji(),substring_text + glitch_text);//Wait a selected amount of time until writing the next letterawait wait(timeout);for(var a = 0; a < glitch_rate; a++) {//Glitch rest of the textif(!reversed) var glitch_text = shuffle(text.substring(i));else var glitch_text = shuffle(text.substring(text.length - i));//Set the status to the cutted text + glitched textawait status(emoji,substring_text + glitch_text);//Wait a selected amount of time until writing the next glitched characterset at the end of the stringawait wait(timeout/2);}}return;}//Sentence effectasync function sentence(emoji,text,timeout) {//Split sentence into wordsvar words = text.split(" ");//Repeat for each wordfor(var i = 0; i < words.length; i++) {//Set status to array's wordif(emoji != "random") await status(emoji,words[i]);else await status(random_emoji(),words[i]);//Wait a selected amount of time until writing the next letterawait wait(timeout);}return;}//Blink effectasync function blink(emoji,text,timeout,times) {for(var i = 0; i < times; i++) {if(emoji != "random") await status(emoji,text);else await status(random_emoji(),text);await wait(timeout);await blank();await wait(timeout);}return;}//Clear the statusasync function blank() {//Could just send blank status as {"custom_status":null}, but that behaves weirdly.await status("","");return;}//Part of the skip function - stackoverflow.com/a/8630472var store = (function() {var map = {};return {set: function ( name, value ) {map[ name ] = value;},get: function ( name ) {return map[ name ];}};})();//Skip the end of the animationasync function skip(amount,uniquetext) {var uniqueID = amount + "_" + uniquetext;var set = store.set;var get = store.get;var currentamount = get(uniqueID);//Check if there's a variable alreadyif(currentamount >= 0) {//If to continueif(currentamount == amount) {//Reset the variableset(uniqueID,0);//Update the currentamount variablecurrentamount = get(uniqueID);//console.log("id: " + uniqueID + "\n\n value: " + get(uniqueID) + " | r###lt: false\n\n");return false;}//Skipelse {//Add one to the variableset(uniqueID,get(uniqueID) + 1);//Update the currentamount variablecurrentamount = get(uniqueID);//console.log("id: " + uniqueID + "\n\n value: " + get(uniqueID) + " | r###lt: true\n\n");return true;}//If there was no variable made already} else {//Make the variableset(uniqueID,0);//Add one to itset(uniqueID,get(uniqueID) + 1);//Update the currentamount variablecurrentamount = get(uniqueID);//console.log("(FIRST TIME) " + "id: " + uniqueID + "\n\n value: " + get(uniqueID) + " | r###lt: true\n\n");return true;}}//Count effectasync function count(emoji,prefix,count_to,suffix,timeout,reversed) {for(var i = 0; i < count_to; i++) {if(!reversed) {var recalculated_count = i + 1;var final_string = prefix + recalculated_count + suffix;}else {var recalculated_count = count_to - i;var final_string = prefix + recalculated_count + suffix;}if(emoji != "random") await status(emoji,final_string);else await status(random_emoji(),final_string);await wait(timeout);}return;}//codespeedy.com/shuffle-characters-of-a-string-in-javascript/function getRandomInt(n) {return Math.floor(Math.random() * n);}//codespeedy.com/shuffle-characters-of-a-string-in-javascript/function shuffle(s) {var arr = s.split('');           // Convert String to arrayvar n = arr.length;              // Length of the arrayfor(var i=0 ; i<n-1 ; ++i) {var j = getRandomInt(n);       // Get random of [0, n-1]var temp = arr[i];             // Swap arr[i] and arr[j]arr[i] = arr[j];arr[j] = temp;}s = arr.join('');                // Convert Array to stringreturn s;                        // Return shuffled string}//Function to read the saved cookiewindow.getCookie = function(name) {var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));if (match) return match[2];}//Set the Discord Token as a Cookie for future use of the script//If there is no Token cookieif(document.cookie.indexOf(cookie_name + "=") == -1) {//Ask user if they want to refresh the page to get the tokenif(confirm("\"" + cookie_name + "\" cookie not found. Refreshing Discord to get it.\n\n- " + name + " " + version)) {//Load the page again and create a new element which will have the token in its localStoragelocation.reload();var i = document.createElement('iframe');document.body.appendChild(i);//Get Token from localStoragevar token = i.contentWindow.localStorage.tokentoken = token.slice(1, -1);//Delete cookie after a week or notif(delete_cookie_after_a_week)document.cookie = cookie_name + "=" + token + "; secure=true; max-age=604800; path=/";elsedocument.cookie = cookie_name + "=" + token + "; secure=true; path=/";} else throw new Error("[Not an actually uncaught] User stopped the Status Animator. \n\nNo cookie was found and user decided not to continue.");}var status_text = "";var status_emoji = "";var status_state = "";//Function that changes the status variables (Saves up a bit space)async function status(emoji,text,state) {if(run) {status_text = text;status_emoji = emoji;status_state = state;await setstatus();return;}}//Get Discord Token from saved Cookievar token = getCookie(cookie_name);//HTTP Request's URL addressvar url = "https://discord.com/api/v9/users/@me/settings";//Function that handles the HTTP request for the status changeasync function setstatus() {var request = new XMLHttpRequest();request.open("PATCH", url);request.setRequestHeader("Accept", "*/*" );request.setRequestHeader("Content-Type", "application/json");request.setRequestHeader("Authorization", token);request.send(JSON.stringify({"custom_status":{"text":status_text,"emoji_name":status_emoji}}));//If the request failedrequest.onreadystatechange = () => {if (request.status != 200) {run = false;throw new Error("[Not an actually uncaught] Failed to update status. \n\nThe HTTP request failed. Most likely because the authorization token is incorrect.");}};if(status_state == "invisible" || status_state == "dnd" || status_state == "idle" || status_state == "online") {var request2 = new XMLHttpRequest();request2.open("PATCH", url);request2.setRequestHeader("Accept", "*/*" );request2.setRequestHeader("Content-Type", "application/json");request2.setRequestHeader("Authorization", token);request2.send(JSON.stringify({"status":status_state}));//If the request failedrequest2.onreadystatechange = () => {if (request2.status != 200) {run = false;throw new Error("[Not an actually uncaught] Failed to update status. \n\nThe HTTP request failed. Most likely because the authorization token is incorrect.");}};}return;}async function setstate(text) {if(run) {status_state = text;if(status_state == "invisible" || status_state == "dnd" || status_state == "idle" || status_state == "online") {var request = new XMLHttpRequest();request.open("PATCH", url);request.setRequestHeader("Accept", "*/*" );request.setRequestHeader("Content-Type", "application/json");request.setRequestHeader("Authorization", token);request.send(JSON.stringify({"status":status_state}));//If the request failedrequest.onreadystatechange = () => {if (request.status != 200) {run = false;throw new Error("[Not an actually uncaught] Failed to update state. \n\nThe HTTP request failed. Most likely because the authorization token is incorrect.");}};}return;}}async function setemoji(emoji) {if(run) {status_emoji = emoji;var request = new XMLHttpRequest();request.open("PATCH", url);request.setRequestHeader("Accept", "*/*" );request.setRequestHeader("Content-Type", "application/json");request.setRequestHeader("Authorization", token);request.send(JSON.stringify({"custom_status":{"emoji_name":status_emoji}}));//If the request failedrequest.onreadystatechange = () => {if (request.status != 200) {run = false;throw new Error("[Not an actually uncaught] Failed to update emoji. \n\nThe HTTP request failed. Most likely because the authorization token is incorrect.");}};return;}}async function settext(text) {if(run) {status_text = text;var request = new XMLHttpRequest();request.open("PATCH", url);request.setRequestHeader("Accept", "*/*" );request.setRequestHeader("Content-Type", "application/json");request.setRequestHeader("Authorization", token);request.send(JSON.stringify({"custom_status":{"text":status_text}}));//If the request failedrequest.onreadystatechange = () => {if (request.status != 200) {run = false;throw new Error("[Not an actually uncaught] Failed to update text. \n\nThe HTTP request failed. Most likely because the authorization token is incorrect.");}};return;}}//Loops the animationasync function animation_loop() {while(run) {await statusanimation();}}//Start the animation loopanimation_loop();//Edit/Clear status before exitingwindow.onbeforeunload = function () {run = false;status_text = default_status_text;status_emoji = default_status_emoji;if(status_state == "invisible" || status_state == "dnd" || status_state == "idle" || status_state == "online")status_state = default_status_state;setstatus();return "";};