Skip to content

Instantly share code, notes, and snippets.

@nicola02nb
Last active May 28, 2025 08:17
Show Gist options
  • Save nicola02nb/458b260b74f8d44bd2e594b4898ea25e to your computer and use it in GitHub Desktop.
Save nicola02nb/458b260b74f8d44bd2e594b4898ea25e to your computer and use it in GitHub Desktop.
BetterDiscord Quick Install

⚠️ A Better solution

BetterDiscordAutoUpdate BetterDiscordAutoUpdate

BetterDiscord Quick Installation Script

This PowerShell script automates the process of downloading and installing BetterDiscord.

It performs the following tasks:

  1. Downloads the latest BetterDiscord .asar file from the official GitHub repository.
  2. Saves the downloaded file to the appropriate directory BetterDiscord/data folder.
  3. Modifies the Discord index.js file to load the BetterDiscord module.
  4. Restarts the Discord application to apply the changes.

Window Installation:

Invoke-WebRequest -UseBasicParsing "https://gist.githubusercontent.com/nicola02nb/458b260b74f8d44bd2e594b4898ea25e/raw/BetterDiscordQuickInstall.ps1" | Invoke-Expression
# Kill Discord process
Stop-Process -Name "Discord" -Force -ErrorAction SilentlyContinue
# Define the URL of the file to download
$url = "https://github.com/BetterDiscord/BetterDiscord/releases/latest/download/betterdiscord.asar"
# Define the path where the file will be saved in the Roaming folder
$destinationDirectory = "$env:APPDATA\BetterDiscord\data"
$destinationPath = "$destinationDirectory\betterdiscord.asar"
# Ensure the directory exists
if (-not (Test-Path -Path $destinationDirectory)) {
New-Item -ItemType Directory -Path $destinationDirectory -Force
}
# Download the file
Invoke-WebRequest -Uri $url -OutFile $destinationPath
$escapedDestinationPath = $destinationPath -replace '\\', '\\'
# Define the custom string to overwrite the index file
$customString = @"
require('$escapedDestinationPath');
module.exports = require('./core.asar');
"@
# Find the Discord app-* folder in AppData\Local\Discord
$discordAppPath = Get-ChildItem "$env:LOCALAPPDATA\Discord" -Directory | Where-Object { $_.Name -like "app-*" } | Select-Object -Last 1
if ($discordAppPath) {
$indexPath = Join-Path -Path $discordAppPath.FullName -ChildPath "modules\discord_desktop_core-1\discord_desktop_core\index.js"
# Overwrite the index file with the custom string
Set-Content -Path $indexPath -Value $customString -Force
} else {
Write-Host "Discord app-* folder not found."
}
# Restart Discord
Start-Process "$env:LOCALAPPDATA\Discord\Update.exe" -ArgumentList "--processStart Discord.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment