Last active
January 8, 2025 02:33
-
-
Save kleutzinger/f10a8622c4f92581e6f1f0963bee04c9 to your computer and use it in GitHub Desktop.
Mute all your discord servers
This file contains 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 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); | |
} | |
})(); |
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?