Skip to content

Instantly share code, notes, and snippets.

@lynn
Created July 23, 2026 11:18
Show Gist options
  • Select an option

  • Save lynn/a3c81df63e87104a985f333b20c76deb to your computer and use it in GitHub Desktop.

Select an option

Save lynn/a3c81df63e87104a985f333b20c76deb to your computer and use it in GitHub Desktop.
Managing Discord servers externally

Managing Discord servers externally

Downloading server data

Open Discord in your browser. Open the Developer Console (F12) and refresh.

In the Network tab, filter for @me/ and find any "GET" request:

image

Right-click it, "Edit and Resend", change everything after @me/ to guilds:

image

On the right, under the "Response" tab, you will see info about all the servers you're in. Right-click it and "Copy All":

image

Paste this into a text editor and save it as guilds.json somewhere.

Downloading folder data

Next, rearrange any two servers in the sidebar and wait 10 seconds. In the Network tab, a PATCH request should appear:

image

Click it, then click "Request" (!) on the right. Again, right-click and "Copy All":

image

Save this as folder.json next to guilds.json.

Turning folders into easily editable TOML

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.toml

This 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 id fields if you make new folders.
  • Leave the "guildPositions" section at the top alone, I think it does nothing.

Applying changes

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.py

It 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:

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment