Skip to content

A lightweight, Go app that publishes your current local time in your Discord Rich Presence status in real-time.

License

Notifications You must be signed in to change notification settings

siddarthkay/discord-show-local-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Time Rich Presence

A lightweight, Go app that publishes your current local time in your Discord Rich Presence status in real-time. I built this because I liked this feature that slack has which shows your local time to anyone who clicks on your profile. Discord lacked this due to their stance on privacy lol.

Discord Rich Presence Example Go MIT License

Screenshot

Slack Discord

What it does

This app creates a Discord Rich Presence that shows:

  • **It's **: Your local time in HH:MM format (e.g., "It's 3:25 PM EST")
  • 📅 Date: Current date (e.g., "🗓️ Mon, Jun 23")
  • Live Updates: Automatically refreshes every 30 seconds

Your Discord profile will display this as a "Playing" status that your friends can see!

Features

  • No external dependencies beyond standard library
  • Communicates directly with Discord using the official RPC protocol
  • Prompts for Discord Client ID if not provided
  • Works on Windows, macOS, and Linux
  • Single binary with no complicated build setup

Instructions for Non Technical Users

Just give me the binaries OR executable OR exe

Instructions for Technical Users

  • Discord Desktop App (Rich Presence doesn't work with browser Discord)
  • A Discord Application ID (free to create)

Quick Start

1. Create a Discord Application

  1. Go to Discord Developer Portal
  2. Click "New Application"
  3. Give it a name (e.g., "My Time Display")
  4. Copy the Application ID from the General Information page

Tip: The Application ID is an 18-19 digit number like 1234567890123456789

2. Enable Discord Rich Presence

In Discord Desktop App:

  1. Go to SettingsActivity Privacy
  2. Enable "Display current activity as a status message"

3. Run the Application

# Option 1: Set environment variable
export DISCORD_CLIENT_ID="your_application_id_here"
./discord-time-presence

# Option 2: Interactive prompt (app will ask for Client ID)
./discord-time-presence

Example Output

Discord Time Rich Presence
=============================
Connecting to Discord using Client ID: 1234567890123456789
Connected to Discord!
Starting time updates (Ctrl+C to stop)...

Updated presence: 3:25 PM EST on Mon, Jun 23
Updated presence: 3:25 PM EST on Mon, Jun 23
Updated presence: 3:26 PM EST on Mon, Jun 23

Your Discord profile will then show:

  • Playing: [Your App Name]
  • Details: "It's 3:25 PM EST"
  • State: "🗓️ Mon, Jun 23"

Building from Source

Prerequisites

# Check Go version
go version  # Should be 1.25+
# Clone the repository
git clone https://github.com/siddarthkay/discord-show-local-time.git
cd discord-show-local-time

Build Commands

# Current platform
make build

# Build and code sign for macOS (requires Apple Developer certificate)
make build-signed

For Nix Users

If you're using Nix or NixOS, you can run this application without installing Go or other dependencies:

Quick Run

# Run directly with nix (requires flakes)
nix run github:siddarthkay/discord-show-local-time

# Or clone and run locally
git clone https://github.com/siddarthkay/discord-show-local-time.git
cd discord-show-local-time
nix run

Build with Nix

# Build the application
nix build

# The binary will be available at ./result/bin/discord-time-presence
./result/bin/discord-time-presence

Development Environment

# Enter development shell with Go and make available
nix develop

# Then use standard make commands
make build
make run

Note: Nix commands require experimental flakes feature. Enable with:

nix --extra-experimental-features "nix-command flakes" <command>

Code Signing (macOS Developers)

To eliminate macOS security warnings, the project supports automatic code signing:

Setup Code Signing Identity

  1. Obtain Apple Developer Certificate: You need an Apple Developer account and certificate
  2. Check Available Identities:
    make codesign-info
  3. Set Custom Identity (optional):
    # Override default identity in Makefile or set environment variable
    export CODESIGN_IDENTITY="Your Developer Name (TEAM_ID)"

Code Signing Commands

# Build and sign single binary
make build-signed

# Build and sign all macOS releases
make release-all-signed

# Check current configuration
make codesign-info

CI/CD Code Signing

The GitHub Actions workflow automatically code signs macOS binaries when:

  • Building from a git tag (release)
  • Required secrets are configured in your GitHub repository

Required GitHub Secrets:

  1. APPLE_CERTIFICATE_P12: Base64 encoded .p12 certificate file
  2. APPLE_CERTIFICATE_PASSWORD: Password for the .p12 certificate

Setting Up GitHub Secrets:

  1. Export your certificate as .p12:

    • Open Keychain Access
    • Find your "Developer ID Application" or "Apple Development" certificate
    • Right-click → Export → Save as .p12 file
  2. Convert to Base64:

    base64 -i your-certificate.p12 | pbcopy
  3. Add to GitHub Secrets:

    • Go to repository Settings → Secrets and variables → Actions
    • Add APPLE_CERTIFICATE_P12 with the base64 content
    • Add APPLE_CERTIFICATE_PASSWORD with your certificate password

Certificate Types:

  • Developer ID Application: Best for public distribution (recommended)
  • Apple Development: Works but shows as "development" in signatures

Note: If secrets are not configured, the workflow will build unsigned binaries with a warning.

Configuration

Setting Environment Variables

*Required unless provided via interactive prompt

Linux/macOS:

export DISCORD_CLIENT_ID="1234567890123456789"
./discord-time-presence

Windows (Command Prompt):

set DISCORD_CLIENT_ID=1234567890123456789
discord-time-presence.exe

Windows (PowerShell):

$env:DISCORD_CLIENT_ID="1234567890123456789"
.\discord-time-presence.exe

Running as a Service

Linux (systemd)

Create /etc/systemd/system/discord-time-presence.service:

[Unit]
Description=Discord Time Rich Presence
After=network.target

[Service]
Type=simple
User=your-username
WorkingDirectory=/path/to/discord-time-rich-presence
ExecStart=/path/to/discord-time-rich-presence/discord-time-presence
Restart=always
RestartSec=3
Environment=DISCORD_CLIENT_ID=your_client_id_here

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable discord-time-presence
sudo systemctl start discord-time-presence
sudo systemctl status discord-time-presence

macOS (launchd)

Create ~/Library/LaunchAgents/com.yourname.discord-time-presence.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.yourname.discord-time-presence</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/discord-time-presence</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>EnvironmentVariables</key>
    <dict>
        <key>DISCORD_CLIENT_ID</key>
        <string>your_client_id_here</string>
    </dict>
</dict>
</plist>

Load the service:

launchctl load ~/Library/LaunchAgents/com.yourname.discord-time-presence.plist

Windows (Task Scheduler)

  1. Open Task Scheduler
  2. Click Create Basic Task
  3. Name: "Discord Time Presence"
  4. Trigger: When I log on
  5. Action: Start a program
  6. Program: Path to your discord-time-presence.exe
  7. Add arguments: (none needed if using environment variables)
  8. Finish

Troubleshooting

Connection Issues

"Failed to connect to Discord"

  • Ensure Discord Desktop app is running (not browser)
  • Check that Rich Presence is enabled in Discord Settings → Activity Privacy
  • Try restarting Discord completely
  • Verify your Client ID is correct (18-19 digits)

"DISCORD_CLIENT_ID environment variable required"

  • Set the environment variable or let the app prompt you
  • Make sure there are no extra spaces in your Client ID

Rich Presence Not Showing

Rich Presence not visible:

  • Enable "Display current activity as a status message" in Discord
  • Make sure you're using Discord Desktop (not web)
  • Check that another Rich Presence app isn't conflicting
  • Try running Discord as administrator (Windows)

Build Issues

"go: command not found"

Platform-Specific Issues

macOS: "cannot be opened because the developer cannot be verified"

Note: Official releases from GitHub are code-signed and should not show this warning.

If you encounter this issue with a manually built binary:

# Allow the app to run
sudo spctl --add discord-time-presence
# Or run with:
sudo xattr -d com.apple.quarantine discord-time-presence

For developers building from source on macOS:

# Build with code signing (requires Apple Developer certificate)
make build-signed

# Build all platforms with macOS code signing
make release-all-signed

# Check available code signing identities
make codesign-info

Linux: Permission denied

chmod +x discord-time-presence

License

This project is licensed under the MIT License - see the LICENSE file for details.

Show Your Support

If this project helped you, please give it a star! ⭐

Support

Technical References

This project implements the Discord IPC Rich Presence protocol directly without external dependencies. For developers interested in the protocol details:

Acknowledgments

  • Discord for providing the Rich Presence API
  • The Go community for excellent tooling and libraries

Note: This application is not affiliated with or endorsed by Discord. Rich Presence is a feature provided by Discord for developers.

About

A lightweight, Go app that publishes your current local time in your Discord Rich Presence status in real-time.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •