This script will cycle all servers you're in and mark them all as read! Just run
npm install request
node markasread.js <your discord token>
var token = "idk" | |
console.log("> Hello.") | |
var base = "https://discordapp.com/api/v6" | |
const request = require("request") | |
if (process.argv[2] != undefined) { | |
token = process.argv[2] | |
console.log(" -> Using provided token") | |
}else {console.log(" -> Using default token")} | |
console.log("> Getting guilds...") | |
request({ | |
"url": base + "/users/@me/guilds", | |
"headers": { | |
"authorization": token | |
} | |
}, (error, resp, body) => { | |
if (error) { | |
console.error(error) | |
}else { | |
if (resp.statusCode == 200) { | |
markAllRead(JSON.parse(body)) | |
}else { | |
console.log(" -> Authentication (probably) failed.") | |
} | |
} | |
}) | |
function markAllRead(guilds) { | |
console.log(" -> Got " + guilds.length + " guilds.\n> ACK'ing all guilds\n -> This will take " + guilds.length + " seconds.") | |
// gotta go slow. (1/second) | |
var loops = 0 | |
var interations = guilds.length | |
var canContinue = true; | |
var failed = 0 | |
var markasread = setInterval(() => { | |
var guild = guilds[loops] | |
if (canContinue) { | |
console.log(" -> ACK: " + guild["name"] + "(" + guild["id"] + ")") | |
canContinue = false; | |
request.post(base + "/guilds/" + guild["id"] + "/ack", { | |
"headers": {"authorization": token} | |
}, (error, resp, body) => { | |
if (error) { | |
console.error(error) | |
}else { | |
canContinue = true; | |
if (resp.statusCode == 204) { | |
console.log(" -> OK!") | |
failed = 0 | |
}else { | |
console.log(" -> FAIL! (" + resp.statusCode + ")") | |
console.log(body) | |
} | |
} | |
}) | |
}else {console.log(" -> Waiting for network...") | |
failed++} | |
if (failed == 10) { | |
console.error("> Exit\n -> Suspected network fault.") | |
process.exit(1) | |
} | |
if (canContinue) {loops++} | |
if (loops == interations) { | |
console.log("-> TIME! \n --> All done!") | |
clearInterval(markasread) | |
} | |
}, 1000) | |
} |
What would I need to add to this script to get it to only mark muted channels as read?
Yeesh I haven't looked at this script for a little while, not really kept up with the Discord API either. If it still works, I'm sure you'll be able to find the specific channel information for the guilds form /channel/:id - but scanning every channel you have access to would take a while given the rate limits.
I've mostly gone with just pressing the mark all as read button in the inbox tray in Discord now, but I suppose that probably does the same thing.
Would love to see this re-made and mark all servers as read since discord currently doesn't let you mark all of them as read and has to be manually done.
Would love to see this re-made and mark all servers as read since discord currently doesn't let you mark all of them as read and has to be manually done.
@T-byte-sketch - you can mark as read in Discord, it's in the inbox tray -> unread -> Mark Inbox as Read
I suppose I could re-make it, but when it's there in the normal client I don't think it's worth it honestly.
is it possible to specifically mark a message as read? the message should include a reply mention or a @ mention
What would I need to add to this script to get it to only mark muted channels as read?