Skip to content

nkdkhtl/AutoRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Custom Activity - Auto RPC

A fully automated Discord Rich Presence system that displays custom lyrics and animations, automatically starting when Discord launches and stopping when Discord closes.

🎵 Features

  • Auto-Start/Stop: Automatically runs when Discord opens and stops when Discord closes
  • Lyrics Display: Shows song lyrics in a flowing 2-line format
  • Silent Operation: Runs completely in the background with no popup windows
  • Smart Timing: 10-second delay for Discord to fully load before starting RPC
  • Error Recovery: Automatically restarts if the RPC crashes
  • Multi-Discord Support: Works with Discord Stable, Canary, PTB, and Development versions

📁 Project Structure

custom-activity/
├── example.py                  # Example RPC script with lyrics
├── rpc.py                      # Main RPC script with lyrics
├── discord_monitor.py          # Discord process monitor
├── start_discord_monitor.bat   # Windows launcher (silent)
└── README.md                   # This file

🚀 Quick Setup

1. Prerequisites

2. Install Dependencies

The required packages (psutil and pypresence) will be auto-installed when you first run the monitor.

Or install manually:

pip install psutil pypresence

3. Auto-Start Setup

For automatic startup with Windows:

  1. Press Win + R, type shell:startup, press Enter
  2. Copy start_discord_monitor.bat to the Startup folder
  3. Restart your computer

For manual testing:

  • Double-click start_discord_monitor.bat

🎯 How It Works

Current Display Format

Details: "Lần Cuối - Ngọt" (Fixed song title)
State: "Nhìn quanh lần cuối" (Current lyric line)
Large Text: "Rừng thay lá ngậm ngùi" (Next lyric line - visible on hover)
Timer: Shows how long RPC has been running

Lyrics Flow

  • 2-line pairs for better readability
  • 4-second intervals between lyric changes
  • Long sentences split (6+ words) for optimal display
  • Continuous loop through all lyrics

Process Flow

  1. Monitor starts when Windows boots
  2. Waits for Discord to launch
  3. 10-second delay for Discord to fully load
  4. Starts RPC with lyrics animation
  5. Auto-stops when Discord closes
  6. Auto-restarts if Discord reopens

⚙️ Customization

Change Lyrics

Edit the lyrics_pairs array in rpc.py:

lyrics_pairs = [
    ["Your first line", "Your second line"],
    ["Another line", "Next line"],
    # Add more pairs...
]

Adjust Timing

time.sleep(4)  # Change to 3, 5, 6 etc. for different speeds

Change Song Info

details="Your Song - Artist",  # Change song title
buttons=[
    {"label": "🎵 Your Song", "url": "your-youtube-link"}
]

Modify Images

large_image="your-image-url",     # Main image
small_image="your-small-image",   # Corner overlay

🛠️ Advanced Configuration

Discord Process Detection

The monitor watches for these processes:

  • Discord.exe (Stable)
  • DiscordCanary.exe (Canary)
  • DiscordPTB.exe (Public Test Build)
  • DiscordDevelopment.exe (Development)

📋 Troubleshooting

RPC Not Appearing

  1. Check Discord Developer Console:

  2. Test RPC manually:

    cd "e:\codingStorage\Projects\custom-activity"
    python rpc.py

Monitor Not Working

  1. Test monitor manually:

    python discord_monitor.py
  2. Check file locations:

    • All files must be in the same folder
    • Batch file must have correct path to your folder

High Resource Usage

  • Monitor checks every 3 seconds (minimal CPU usage)
  • RPC updates every 4 seconds (Discord's limit is 15 seconds)

🔧 File Details

rpc.py

  • Main Discord RPC script
  • Contains lyrics and display logic
  • Handles graceful shutdown
  • 10-second startup delay

discord_monitor.py

  • Monitors Discord processes
  • Starts/stops RPC automatically
  • Error recovery and restart logic
  • Silent background operation

start_discord_monitor.bat

  • Windows launcher script
  • Completely silent execution
  • Auto-installs dependencies
  • Error checking

📝 Technical Notes

  • Python Version: 3.6+ required
  • Discord API: Uses pypresence library
  • Process Monitoring: Uses psutil library
  • Platform: Windows-optimized (batch files)
  • Startup Method: Windows Startup folder

📞 Support

About

A script that automatically runs RPC when Discord opens or closes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors