This script adds a button in Discord's text box that allows you to automatically add reactions to new messages in text channels for however long is specified. Note: If a channel does not allow reactions, some odd things might happen.
当前为
// ==UserScript==
// @name Discord Reaction Spammer
// @namespace http://tampermonkey.net/
// @version 0.1
// @author You
// @match *://discord.com/*
// @grant none
// @description This script adds a button in Discord's text box that allows you to automatically add reactions to new messages in text channels for however long is specified. Note: If a channel does not allow reactions, some odd things might happen.
// ==/UserScript==
setInterval(() => {
function theBestSpammer(sec) {
console.log(sec)
let sec2 = parseInt(sec) * 2
if (!sec) sec2 = 120
for (var i = 0; i<sec2; i++) {
let firstMessage = document.querySelectorAll(".markup-2BOw-j.messageContent-2qWWxC")[document.querySelectorAll(".markup-2BOw-j.messageContent-2qWWxC").length - 1].innerText
setTimeout(() => {
try {
if (firstMessage != document.querySelectorAll(".markup-2BOw-j.messageContent-2qWWxC")[document.querySelectorAll(".markup-2BOw-j.messageContent-2qWWxC").length - 1].innerText) {
document.querySelectorAll(".button-1ZiXG9")[document.querySelectorAll(".button-1ZiXG9").length - 2].click()
if (document.querySelector(".emojiItem-14v6tW") != undefined) {
console.log(document.querySelectorAll(".emojiItem-14v6tW").length + " - Emojis")
//document.querySelectorAll(".unicodeShortcut-15J8Ck")[0].click()
document.querySelectorAll(".emojiItem-14v6tW")[1].click()
} else {
console.log("Emoji does not exist?")
}
}} catch(err) {
console.error(err + "\nerror")
}
}, 500 * i)
}
}
if (!document.querySelector(".hiddenclass")) {
var buttonCollection = document.querySelector(".buttons-3JBrkn")
var textArea = document.querySelector(".channelTextArea-rNsIhG.channelTextArea-2VhZ6z")
var spamMenu = document.createElement("div")
var spamInput = document.createElement("input")
var spamButton = document.createElement("button")
var spamEnter = document.createElement("button")
spamButton.className = "hiddenclass buttonWrapper-1ZmCpA button-38aScr colorBrand-3pXr91 grow-q77ONN noFocus-2C7BQj"
spamButton.style = "letter-spacing: 0.4px; font-weight: bold; width: 50px; color: #CECECE; transition: all 0.2s ease-in;"
spamButton.innerText = "Spam"
spamButton.onmouseover = function() {this.style.color = "#FFFFFF"}
spamButton.onmouseout = function() {if (this.classList.contains("active") != true) {this.style.color = "#CECECE"}}
spamButton.onclick = function() {
if (spamMenu.style.height === "0px") {
spamMenu.style.display = "block"
setTimeout(() => {
spamMenu.style.height = "150px"
spamMenu.style.boxShadow = "0 0 0 1px rgba(4,4,5,0.15), 0 8px 16px rgba(0,0,0,0.24)"
}, 100);
spamButton.classList.add("active")
} else {
spamMenu.style.height = "0px"
spamMenu.style.boxShadow = "none"
setTimeout(() => {
spamMenu.style.display = "none"
}, 200);
spamButton.classList.remove("active")
}
}
window.onclick = e => {
if (e.target.classList.contains("hiddenclass") == false && spamMenu.style.height != "0px") {
spamMenu.style.height = "0px"
spamMenu.style.boxShadow = "none"
setTimeout(() => {
spamMenu.style.display = "none"
}, 200);
spamButton.classList.remove("active")
spamButton.style.color = "#CECECE"
}
}
spamMenu.classList.add("hiddenclass")
spamInput.classList.add("hiddenclass")
spamMenu.style = "border-radius: 8px; background-color: #2f3136; height: 0px; width: 250px; overflow: hidden; z-index: 1; position: absolute; right: 0; bottom: calc(100% + 8px); box-shadow: none; transition: all 0.2s;"
spamInput.style = "padding: 2px; width: 150px; height: 30px; background: #40444B; color: #dcddde; border: none; border-radius: 8px; position: absolute; overflow: hidden; margin-left: 48px; margin-top: 35px;"
spamInput.placeholder = "Seconds, e.g., 60"
spamInput.style.placeholder = "color: #666971"
spamInput.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
spamEnter.click()
}
})
spamEnter.classList.add("hiddenclass")
spamEnter.style = "background: #7289DA; color: white; border-radius: 8px; border: none; height: 32px; width: 60px; margin-top: 85px; margin-left: 95px;"
spamEnter.innerText = "Spam!"
spamEnter.onclick = () => {theBestSpammer(parseInt(document.querySelector("input[class=\"hiddenclass\"]").value))}
buttonCollection.appendChild(spamButton)
textArea.appendChild(spamMenu)
spamMenu.appendChild(spamInput)
spamMenu.appendChild(spamEnter)
}
}, 50)