Last active
April 23, 2019 18:33
-
-
Save fanfan54old/4432e0b8abc063b7cec8c15c4e48eee1 to your computer and use it in GitHub Desktop.
Delete every Discord private message sent to someone, in bulk (clicks on "Delete" automatically, 1 message per second)
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
| var messages_div = document.getElementsByClassName("messages-3amgkR scroller")[0]; | |
| window.action_button_arr = []; | |
| window.bdpm_i = 0; | |
| window.bdpm_interval = 0; | |
| window.scrollTopInterval = window.setInterval(function () { | |
| if (messages_div.scrollTop == 0) { | |
| clearInterval(window.scrollTopInterval); | |
| window.action_button_arr = document.getElementsByClassName("button-3Jq0g9"); | |
| window.bdpmInterval = window.setInterval(function () { | |
| if (window.bdpm_i >= window.action_button_arr.length) { | |
| clearInterval(window.bdpmInterval); | |
| } else { | |
| do { | |
| console.info("Message " + window.bdpm_i + "/" + window.action_button_arr.length); | |
| window.action_button_arr[window.bdpm_i].click(); | |
| var action_container = document.getElementsByClassName("container-3cGP6G")[0]; | |
| if (action_container.children.length != 3) { | |
| window.bdpm_i += 1; | |
| } else { | |
| break; | |
| } | |
| } while (window.bdpm_i < window.action_button_arr.length); | |
| console.info("Processing message " + window.bdpm_i + "/" + window.action_button_arr.length); | |
| if (window.bdpm_i < window.action_button_arr.length) { | |
| action_container.children[2].click(); | |
| document.getElementsByClassName("flex-1xMQg5 flex-1O1GKY horizontalReverse-2eTKWD horizontalReverse-3tRjY7 flex-1O1GKY directionRowReverse-m8IjIq justifyStart-2NDFzi alignStretch-DpGPf3 noWrap-3jynv6 footer-2yfCgX")[0].children[0].click(); | |
| } else { | |
| console.log("Detected end"); | |
| clearInterval(window.bdpmInterval); | |
| } | |
| console.warn("Looping interval"); | |
| } | |
| }, 2000); | |
| } else { | |
| messages_div.scrollTo(0, 0); | |
| } | |
| }, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment