Alexquickdraw

[Discord] Auto rejoin voice channel on dc

Nov 27th, 2020
861
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Prettier class object calls
  2. function classObj(name) {
  3.     return document.getElementsByClassName(name);
  4. }
  5.  
  6. //Returns True if you're in a call, else False
  7. function inCall() {
  8.     if (classObj('rtcConnectionStatus-2-jIsi rtcConnectionQualityFine-2J6i8z').length === 0) {
  9.         return false;
  10.     } else {
  11.         return true;
  12.     }
  13. }
  14.  
  15. //Rejoins voice channel by name
  16. function rejoin(channel) {
  17.     for (x = 0; x < classObj("mainContent-u_9PKf").length; x++) {
  18.         if (classObj("mainContent-u_9PKf")[x].text === channel) {
  19.             classObj("mainContent-u_9PKf")[x].click();
  20.         }
  21.     }
  22. }
  23.  
  24. //Checks if you're in call and rejoins the specified channel when you're not.
  25. setInterval(function() {
  26.     if (!inCall()) {
  27.         rejoin('General[1]');
  28.     }
  29. }, 3000)
RAW Paste Data