Last active
October 12, 2025 03:06
-
-
Save hazre/c49e6d77f3ee8ef27c54a564173b483a to your computer and use it in GitHub Desktop.
Nushell script wrapper of Vencord installer, made to fix broken Vencord installations after Discord updates (Windows only)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Nushell Vencord Installer & Discord Launcher (Windows only) | |
| # Fixes Vencord installations that break after Discord updates | |
| # Made by https://github.com/hazre | |
| const VENCORD_REPO = "Vencord/Installer" | |
| const VENCORD_BRANCH = "canary" | |
| def check_windows [] { | |
| if $nu.os-info.name != "windows" { | |
| print $"(ansi red)Error: This script only works on Windows(ansi reset)" | |
| return false | |
| } | |
| true | |
| } | |
| def get_installer_dir [] { | |
| $"($env.TEMP)\\VencordInstallerCli" | |
| } | |
| def get_version_file [] { | |
| $"(get_installer_dir)\\version.txt" | |
| } | |
| def get_discord_paths [branch: string] { | |
| let discord_folder = if $branch == "stable" { | |
| "Discord" | |
| } else if $branch == "ptb" { | |
| "DiscordPTB" | |
| } else { | |
| "DiscordCanary" | |
| } | |
| { | |
| folder: $discord_folder | |
| path: $"($env.LOCALAPPDATA)\\($discord_folder)\\Update.exe" | |
| exe: $"($discord_folder).exe" | |
| } | |
| } | |
| # Download, install Vencord, and launch Discord (Windows only) | |
| # | |
| # Examples: | |
| # > vencord | |
| # > vencord --branch stable | |
| # > vencord --no-launch | |
| export def --env vencord [ | |
| --branch: string = $VENCORD_BRANCH # Discord branch (stable, ptb, canary) | |
| --no-launch # Don't launch Discord after installation | |
| ]: nothing -> nothing { | |
| if not (check_windows) { return } | |
| let installer_dir = (get_installer_dir) | |
| let installer_path = $"($installer_dir)\\VencordInstallerCli.exe" | |
| let version_file = (get_version_file) | |
| let discord = (get_discord_paths $branch) | |
| if not ($installer_dir | path exists) { | |
| mkdir $installer_dir | |
| } | |
| print $"(ansi green)Fetching latest Vencord installer from ($VENCORD_REPO)...(ansi reset)" | |
| let tags_url = $"https://github.com/($VENCORD_REPO)/tags.atom" | |
| let atom_feed = (http get $tags_url | from xml) | |
| let entries = ($atom_feed.content | where tag == "entry") | |
| let first_entry = ($entries | first | get content) | |
| let id_content = ($first_entry | where tag == "id" | get content.0.content | first) | |
| let version_tag = ($id_content | split row '/' | last) | |
| if ($version_tag | is-empty) { | |
| print $"(ansi red)Error: Could not find latest release tag(ansi reset)" | |
| return | |
| } | |
| print $"(ansi cyan)Latest version: ($version_tag)(ansi reset)" | |
| let already_have_version = if ($version_file | path exists) { | |
| let stored_version = (open $version_file | str trim) | |
| $stored_version == $version_tag | |
| } else { | |
| false | |
| } | |
| if $already_have_version { | |
| print $"(ansi green)✓ Already have latest version ($version_tag)(ansi reset)" | |
| } else { | |
| let checksums_url = $"https://github.com/($VENCORD_REPO)/releases/download/($version_tag)/checksums.sha256" | |
| print $"(ansi cyan)Fetching checksums...(ansi reset)" | |
| let checksums_text = (http get $checksums_url | decode utf-8) | |
| let expected_sha256 = ($checksums_text | lines | where $it =~ "VencordInstallerCli.exe" | first | split row " " | first) | |
| if ($expected_sha256 | is-empty) { | |
| print $"(ansi red)Error: Could not find checksum for VencordInstallerCli.exe(ansi reset)" | |
| return | |
| } | |
| print $"(ansi cyan)Expected SHA256: ($expected_sha256)(ansi reset)" | |
| let download_url = $"https://github.com/($VENCORD_REPO)/releases/download/($version_tag)/VencordInstallerCli.exe" | |
| print $"(ansi cyan)Downloading to ($installer_path)...(ansi reset)" | |
| http get $download_url | save -f $installer_path | |
| print $"(ansi cyan)Verifying SHA256 hash...(ansi reset)" | |
| let actual_sha256 = (open $installer_path | hash sha256) | |
| if $actual_sha256 != $expected_sha256 { | |
| print $"(ansi red)Error: SHA256 mismatch!(ansi reset)" | |
| print $"(ansi red)Expected: ($expected_sha256)(ansi reset)" | |
| print $"(ansi red)Got: ($actual_sha256)(ansi reset)" | |
| return | |
| } | |
| print $"(ansi green)✓ SHA256 verified: ($actual_sha256)(ansi reset)" | |
| $version_tag | save -f $version_file | |
| } | |
| print $"(ansi green)Running Vencord installer with branch: ($branch)(ansi reset)" | |
| ^$installer_path -branch $branch -install | |
| print $"(ansi green)Installation complete!(ansi reset)" | |
| if not $no_launch { | |
| print $"(ansi cyan)Launching Discord...(ansi reset)" | |
| ^$discord.path --processStart $discord.exe | |
| } | |
| } | |
| # Launch Discord without installing (Windows only) | |
| # | |
| # Examples: | |
| # > discord | |
| # > discord --branch ptb | |
| export def --env discord [ | |
| --branch: string = $VENCORD_BRANCH # Discord branch to launch | |
| ]: nothing -> nothing { | |
| if not (check_windows) { return } | |
| let discord = (get_discord_paths $branch) | |
| print $"(ansi cyan)Launching Discord...(ansi reset)" | |
| ^$discord.path --processStart $discord.exe | |
| } | |
| def main []: nothing -> nothing { | |
| if not (check_windows) { return } | |
| vencord | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment