Discord prevent idle

Prevents Discord web app from going idle

  1. // ==UserScript==
  2. // @name Discord prevent idle
  3. // @description Prevents Discord web app from going idle
  4. // @license MIT
  5. // @namespace rustyx.org
  6. // @version 2025-05-15
  7. // @author rustyx
  8. // @match https://discord.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. setInterval(function() {
  13. var e = document.createEvent('FocusEvent');
  14. e.initEvent('focus', true, true);
  15. document.body.dispatchEvent(e);
  16. }, 30000);
  17. setTimeout(function() {
  18. var token = (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken();
  19. fetch('https://discord.com/api/v9/users/@me/settings-proto/1', {
  20. 'method': 'PATCH',
  21. 'headers': {
  22. 'Content-Type': 'application/json',
  23. 'Authorization': token
  24. },
  25. 'body': '{"settings":"WgoKBgoEaWRsZRoA"}' // set status idle
  26. });
  27. }, 9500);
  28. setTimeout(function() {
  29. var token = (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken();
  30. fetch('https://discord.com/api/v9/users/@me/settings-proto/1', {
  31. 'method': 'PATCH',
  32. 'headers': {
  33. 'Content-Type': 'application/json',
  34. 'Authorization': token
  35. },
  36. 'body': '{"settings":"WgwKCAoGb25saW5lGgA="}' // set status online
  37. });
  38. }, 10000);
  39. console.log('Discord prevent idle timer armed'); // note: enable info-level logging in tampermonkey settings to see this output