Skip to content

Repository files navigation

gostatus

Discord presence badges as SVGs to show discord status, music-, editor- or game-activity using shields.io.

Note

Originally inspired by statusbadges, rewritten in Go with improvements.

Running

Requirements

  • Go 1.21+
  • Server Members and Presence intents enabled at the Dev Portal
  • Bot must be in a shared server with the users you want to track

Local

git clone https://github.com/vmphase/gostatus
cd gostatus
go mod tidy

Copy the example config and set your bot token:

cp config.toml.example config.toml
token = "your_bot_token_here"

Then run:

go run main.go

The server listens on :8080 by default. To change the port locally, you can pass the -port flag:

go run main.go -port 9090

Docker

Requirements

Setup

Copy and configure:

cp config.toml.example config.toml
token = "your_bot_token_here"

Build and start:

docker compose -f .devcontainer/compose.yaml up --build -d

Changing the port

The server listens on :8080 by default. To change it prepend the PORT environment variable to your command:

PORT=9090 docker compose -f .devcontainer/compose.yaml up --build -d

Endpoints

GET /badge/status/{discord_user_id}

Current Discord presence status.

Query Default Description
label currently Left side text
color status-based Right side background color
labelColor #555 Left side background color
style flat Badge style: flat, flat-square, for-the-badge
simple Set to true to collapse idle/dnd => online

GET /badge/music/{discord_user_id}

Track the user is currently listening to. Auto-detects supported music services (currently Spotify).

Query Default Description
label listening to Left side text
color service-based Right side background color
labelColor #555 Left side background color
style flat Badge style: flat, flat-square, for-the-badge
fallback nothing Text shown when not listening
hideLogo false Set to true to hide the service logo

GET /badge/code/{discord_user_id}

File and workspace the user is currently editing. Auto-detects supported editors (VSCode, Zed, Visual Studio).

Query Default Description
label editor-based Left side text
color editor-based Right side background color
labelColor #1e1e2e Left side background color
style flat Badge style: flat, flat-square, for-the-badge
fallback nothing Text shown when not coding
hideLogo false Set to true to hide the editor logo
prefer first active Preferred editor slug (vscode, zed, visualstudio) when multiple are active

GET /badge/playing/{discord_user_id}

Game the user is currently playing (editor activities are excluded).

Query Default Description
label playing Left side text
color #5865f2 Right side background color
labelColor #555 Left side background color
style flat Badge style: flat, flat-square, for-the-badge
fallback nothing Text shown when not playing

GET /badge/crunchyroll/{discord_user_id}

Episode and series the user is currently watching on Crunchyroll.

Query Default Description
label watching Left side text
color #f47521 Right side background color
labelColor #555 Left side background color
style flat Badge style: flat, flat-square, for-the-badge
fallback nothing Text shown when not watching
hideLogo false Set to true to hide the Crunchyroll logo

GET /presence/{discord_user_id}

Raw presence data as JSON. CORS-enabled. Returns the full cached Discord presence payload for the user.

Response object:

Field Type Description
Status string online, idle, dnd or offline
ClientStatus object Device-based status, e.g. { "desktop": "online" }
Activities array of objects Currently active activities (see below)

Activity object:

Field Type Description
Name string Activity name, e.g. Spotify, Visual Studio Code or a game title
Type number 0 = Playing, 1 = Streaming, 2 = Listening, 3 = Watching
Details string Activity details (e.g. song title, editor file)
State string Activity state (e.g. artist name, workspace)
SyncID string Activity sync ID (e.g. Spotify track ID)

Example response:

{
    "Status": "online",
    "ClientStatus": { "desktop": "online" },
    "Activities": [
        {
            "Name": "Spotify",
            "Type": 2,
            "Details": "Example Song",
            "State": "Example Artist",
            "SyncID": "4cOdK2wGLETKBDO"
        }
    ]
}

If the user has no cached presence (e.g. no shared server with the bot), a fallback response is returned:

{ "Activities": [], "ClientStatus": {}, "Status": "offline" }

About

Embeddable SVG badges to reflect Discord activity in real time.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages