oh, discord does that automatically, for example:
var counter = 0;
var messageToSend = "awake for ";
var messageToSend2 = " seconds";
var urlToSendTo = "https://discordapp.com/api/v6/users/@me/settings";
var authorization = "(put auth token here)";
function doSubmit() {
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
var jsonPOST = {custom_status: {text: messageToSend + counter.toString() + messageToSend2}};
var datatosend = JSON.stringify(jsonPOST);
xmlhttp.open("PATCH", urlToSendTo, true);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.setRequestHeader("authorization", authorization);
xmlhttp.send(datatosend);
counter++;
setTimeout(doSubmit, 1000);
}
doSubmit();