Skip to content

Instantly share code, notes, and snippets.

@richyk1
Forked from NoahCardoza/README.md
Last active March 8, 2022 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richyk1/86b987868af2ee603d72f21c11c23f4c to your computer and use it in GitHub Desktop.
Save richyk1/86b987868af2ee603d72f21c11c23f4c to your computer and use it in GitHub Desktop.
Discord: Spotify Pause Blocker

Spotify Pause Blocker

Disclaimer

I love both of you Discord and Spotify, but this new 30 seccond rule gets pretty annoying when my music gets turned off while just talking "to much." I mean talking kind of is the whole point of Discord...

Reason

Recently, Discord started automatically pausing Spotify when your mic has been active for 30 seconds while Spotify is playing (on any device) in order to comply with Spotify's ToS. While I this is a valid reason, it is annoying.

The Last Straw

After a while this got too annyoing, my music would just flat out stop while playing games on mic with friends, while using headphones.

Solutions

Easiest Solution

Use Better Discord and add discord-spotify-fix.plugin.js to your plugins folder.

Less Easiest Solution

Copy the contents of copyme.js into the developer tool's console of the Discord app. The only caveat being you'll have to do this everytime you open Discord.

ENABLING DEV TOOLS, taken from Reddit

Indeed this is correct. Because people keep getting socially engineered into opening the inspector and having their accounts compromised, we've disabled this functionality on Stable.

However, I do think that being able to poke at how the app works is cool. So you have two options, you can still open the web inspector in the browser. Or you can turn it back *on* using by setting "DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true in %appdata%/discord/settings.json.

I'll caveat this with an important disclaimer though:
- Don't paste things in the console that other people send you. Such things can compromise your account, and even your computer.
- Don't screenshare or send screenshots of the web inspector, especially the *requests* tab. Sensitive information such as your account credentials may be on screen and allow someone to compromise your account.
// save the orignial open function
XMLHttpRequest.prototype.realOpen = XMLHttpRequest.prototype.open;
// create a new function to filter out certain urls
var myOpen = function(method, url, async, user, password) {
// redirects the /pause to /play (which will do nothing since Spotify is already playing)
if (url == "https://api.spotify.com/v1/me/player/pause") {
url = "https://api.spotify.com/v1/me/player/play";
}
this.realOpen (method, url, async, user, password);
}
// overwrite the original open with our modded version
XMLHttpRequest.prototype.open = myOpen;
//META{"name":"SpotifyFixer"}*//
class SpotifyFixer {
getName() {
return "Spotify Pause Blocker";
}
getDescription() {
return "Keeps Discord from pausing your Spotify after 30 secconds of constant mic input.";
}
getVersion() {
return "0.0.1";
}
getAuthor() {
return "Noah Cardoza (MacHacker#7322)";
}
start() {
// save the orignial open function
XMLHttpRequest.prototype.realOpen = XMLHttpRequest.prototype.open;
// create a new function to filter out certain urls
var myOpen = function(method, url, async, user, password) {
// redirects the /pause to /play (which will do nothing since Spotify is already playing)
if (url == "https://api.spotify.com/v1/me/player/pause") {
url = "https://api.spotify.com/v1/me/player/play";
}
this.realOpen (method, url, async, user, password);
}
// overwrite the original open with our modded version
XMLHttpRequest.prototype.open = myOpen;
}
stop() {
XMLHttpRequest.prototype.open = XMLHttpRequest.prototype.realOpen;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment