Open Discord in your browser. Open the Developer Console (F12) and refresh.
In the Network tab, filter for @me/ and find any "GET" request:
Right-click it, "Edit and Resend", change everything after @me/ to guilds:
On the right, under the "Response" tab, you will see info about all the servers you're in. Right-click it and "Copy All":
Paste this into a text editor and save it as guilds.json somewhere.
Next, rearrange any two servers in the sidebar and wait 10 seconds. In the Network tab, a PATCH request should appear:
Click it, then click "Request" (!) on the right. Again, right-click and "Copy All":
Save this as folder.json next to guilds.json.
Save this Python script as extract.py next to your .json files:
from discord_protos import PreloadedUserSettings
from base64 import b64decode
from google.protobuf.json_format import MessageToDict
import tomli_w, json, re
with open("folders.json") as f: raw_folders = json.load(f)
with open("guilds.json") as f: guilds = json.load(f)
id_to_name = {g["id"]: g["name"] for g in guilds}
folders = MessageToDict(PreloadedUserSettings.FromString(b64decode(raw_folders["settings"])))
dump = tomli_w.dumps(folders["guildFolders"])
print(re.sub(r'"(\d{5,})",', lambda m: m[0].ljust(23) + "# " + id_to_name.get(m[1], ""), dump))Now open a command line in this folder and run
uv run --with discord-protos,tomli-w python3 extract.py > folders.tomlThis file is laid out like so:
guildPositions = [
"...",
"...",
"...",
]
[[folders]]
guildIds = [
"756829356155731988", # ⛳ Code Golf
"1285973048092000388", # Byte Heist
]
id = "3652584801"
name = "codegolf"
[[folders]]
guildIds = [
"1208593165213245510", # ma mun
"1337041613096222730", # toki pona en toki Netelan
"861015480197447710", # toki wile
]
id = "3652584801"
name = "tp"- I think you can make up numbers for the
idfields if you make new folders. - Leave the "guildPositions" section at the top alone, I think it does nothing.
Save this Python script as reimport.py next to your .json files:
from discord_protos import PreloadedUserSettings
from base64 import b64decode, b64encode
from google.protobuf.json_format import MessageToDict, ParseDict
import tomllib, json
with open("folders.toml", "rb") as f: folders_dict = tomllib.load(f)
folders = ParseDict({'guildFolders': folders_dict}, PreloadedUserSettings())
b64 = b64encode(folders.SerializeToString()).decode('ascii')
print(json.dumps({"settings": b64}))Now run this in the command line:
uv run --with discord-protos python3 reimport.pyIt will spit out something like {"settings": "cqIJCgoKCA..."} — copy all this (you may need Ctrl+Shift+C to copy from the command line).
Now go back to the "PATCH" request in your browser. Right click, choose "Edit and Resend", then select the stuff at the bottom and paste to replace it: