Last active
December 6, 2025 13:48
-
-
Save kleutzinger/f10a8622c4f92581e6f1f0963bee04c9 to your computer and use it in GitHub Desktop.
Mute all your discord servers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This file helps you mute every discord channel in your account | |
| you have to run it in the developer console on the web client | |
| follow the instructions below. this is tested on firefox and chrome. | |
| 1. open the discord webapp at https://discord.com/channels/@me | |
| 2. manually expand all server folders | |
| (note any servers inside collapsed server folders will not be modified, this can be useful for leaving certain groups of servers unmodified) | |
| 3. open browser network inspector | |
| 4. right click on a sever icon | |
| 5. (un)mute a server | |
| 6. find the corresponding PATCH request it went to | |
| the url should look like https://discord.com/api/v9/users/@me/guilds/954389936121987103/settings | |
| 7. copy the contents of paste-into-console.js to clipboard | |
| 8. switch to js console, paste this file's contents | |
| 9. press enter | |
| 10. you should see a popup asking you for a fetch request | |
| 10. open the network tab (you can leave the popup open while doing this) | |
| 11. locate that patch request in the network tab and "Copy as Fetch" | |
| 12. paste that into the alert, press enter | |
| 13. watch it go | |
| now all your servers are muted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TIMEOUT_MS = 500; | |
| msg = 'right click a PATCH request to settings, "copy as fetch", paste in here'; | |
| my_fetch = window.prompt(msg); | |
| servers = [...document.querySelectorAll(`[data-list-item-id^="guildsnav___"]`)] | |
| .map((node) => ({ | |
| ch_id: node.getAttribute("data-list-item-id").split("_").slice(-1)[0], | |
| name: node.getAttribute("aria-label"), | |
| })) | |
| .filter((a) => parseInt(a.ch_id)); | |
| function ch_id2url(ch_id) { | |
| return `https://discord.com/api/v9/users/@me/guilds/${ch_id}/settings`; | |
| } | |
| function get_data_from_fetch(fullfetch) { | |
| lastidx = fullfetch.lastIndexOf("}"); | |
| firstidx = fullfetch.search("{"); | |
| body = fullfetch.slice(firstidx, lastidx + 1); | |
| j = JSON.parse(body); | |
| return j; | |
| } | |
| function get_url_from_fetch(fullfetch) { | |
| url = fullfetch.split('"')[1]; | |
| return url; | |
| } | |
| // basically this completely silences a channel | |
| // it's the equivalent to | |
| // 1. right clicking a server icon | |
| // 2. checking every box under the Mute Server option | |
| all_checked = { | |
| message_notifications: 2, | |
| suppress_everyone: true, | |
| suppress_roles: true, | |
| notify_highlights: 1, | |
| mute_scheduled_events: true, | |
| mobile_push: true, | |
| mute_config: { | |
| end_time: null, | |
| selected_time_window: -1, | |
| }, | |
| muted: true, | |
| }; | |
| // this is the inverse of above | |
| // effectively "unmutes" a channel | |
| all_unchecked = { | |
| message_notifications: 0, | |
| suppress_everyone: false, | |
| notify_highlights: 2, | |
| mute_scheduled_events: false, | |
| suppress_roles: false, | |
| mobile_push: false, | |
| muted: false, | |
| }; | |
| // this is the object we use to set the desired | |
| // state of our servers | |
| // moodify these objects to get the config you'd like | |
| my_settings = all_checked; | |
| run_new_fetch = async (url, fetchdata) => { | |
| fetchdata.body = JSON.stringify(my_settings); | |
| await fetch(url, fetchdata); | |
| await new Promise((r) => setTimeout(r, TIMEOUT_MS)); | |
| }; | |
| (async () => { | |
| for (let { ch_id, name } of servers) { | |
| let url2 = ch_id2url(ch_id); | |
| let data2 = get_data_from_fetch(my_fetch); | |
| await run_new_fetch(url2, data2); | |
| console.log("done", name, ch_id); | |
| } | |
| })(); |
Good approach! I edited the code to make it compatible with the newest API and mute/unmute all servers in one fetch.
(async () => {
const myFetch = window.prompt("Paste the fetch command as a string");
if (!myFetch?.trim()) return console.error("Invalid fetch input.");
const guildIds = [...document.querySelectorAll('[data-list-item-id^="guildsnav___"]')]
.map(el => el.getAttribute("data-list-item-id")?.split("_").pop())
.filter(id => id && !isNaN(+id));
if (!guildIds.length) return console.warn("No valid guild IDs found.");
const [, rawUrl, rawOptions] = myFetch.match(/^await fetch\((.*?),\s*(\{[\s\S]*\})\);?$/) || [];
if (!rawUrl || !rawOptions) return console.error("Invalid fetch format.");
let url, options, muteConfig;
try {
url = eval(rawUrl);
options = JSON.parse(rawOptions);
muteConfig = Object.values(JSON.parse(options.body).guilds || {})[0];
if (!muteConfig) throw new Error("Missing guild config");
} catch (e) {
return console.error("Parsing error:", e);
}
try {
await fetch(url, {
...options,
body: JSON.stringify({ guilds: Object.fromEntries(guildIds.map(id => [id, muteConfig])) }),
});
console.log(`Finished PATCH for all guilds: ${guildIds.join(", ")}`);
} catch (err) {
console.error("Fetch failed:", err);
}
})();i made one a lot easier you just need your token watch this video to know how to get it and dont share it with anyone
Youtube
and this the code copy it and paste it in a notepad and save it as a html and you are done
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mute / Unmute All Discord Servers</title>
<style>
body {
background-color: #2c2f33;
color: #fff;
font-family: Arial, sans-serif;
text-align: center;
padding-top: 100px;
}
input, button {
padding: 10px;
margin: 10px;
font-size: 16px;
border-radius: 5px;
border: none;
}
input {
width: 300px;
}
button {
background-color: #7289da;
color: #fff;
cursor: pointer;
}
button:hover {
background-color: #5b6eae;
}
#status {
margin-top: 20px;
font-size: 18px;
}
</style>
</head>
<body>
<h1>Discord Server Mute Control</h1>
<p>put your token here π</p>
<input type="text" id="token" placeholder="Your token here"><br>
<button onclick="updateMute(true)">π Mute All</button>
<button onclick="updateMute(false)">π Unmute All</button>
<p id="status"></p>
<script>
async function updateMute(mute) {
const token = document.getElementById("token").value;
const status = document.getElementById("status");
status.innerText = mute ? "β³ Muting all servers..." : "β³ Unmuting all servers...";
try {
const guildsRes = await fetch("https://discord.com/api/v9/users/@me/guilds", {
headers: { authorization: token }
});
if (!guildsRes.ok) throw new Error("Token not valid");
const guilds = await guildsRes.json();
const settings = {};
guilds.forEach(guild => {
settings[guild.id] = {
muted: mute,
mute_config: mute
? { selected_time_window: -1, end_time: null }
: null
};
});
const patchRes = await fetch("https://discord.com/api/v9/users/@me/guilds/settings", {
method: "PATCH",
headers: {
authorization: token,
"content-type": "application/json"
},
body: JSON.stringify({ guilds: settings })
});
if (!patchRes.ok) throw new Error("Error");
status.innerText = mute
? `β
Muted ${guilds.length} servers successfully!`
: `β
Unmuted ${guilds.length} servers successfully!`;
status.style.color = "lightgreen";
} catch (err) {
status.innerText = "β Error: " + err.message;
status.style.color = "red";
}
}
</script>
</body>
</html>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to click on every folder in your guilds list to expand them, else this will miss those servers and not mute them.
However, it's good if you'd like to whitelist some servers maybe?