Greasy Fork is available in English.

Discussioni » Richieste di creazione

Automatic +1 added reaction to discord bot

§
Pubblicato: 10/05/2021

Hello if someone could help me finish this script a very helpfull member of the community tried making for me, in the essence its just a script that reacts to a certain poll link posted by a discord bot, like just adds +1 reaction to the first given reaction automaticaly.

// ==UserScript==
// @name Auto add +1 reaction
// @namespace DiscordAutoAddReaction
// @version 0.1
// @description Auto add +1 reaction on discord
// @author hacker09
// @match https://discord.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @grant none
// ==/UserScript==

(function() {
'use strict';
new MutationObserver(async function() {
//if ($('div[data-list-item-id*="chat-messages-"] > div > h2 > span > span').last()[0].childNodes[0].data === 'ARRR TipBot') //If the last comment user name is = ARRR TipBot
if ($('div[data-list-item-id*="chat-messages-"]').last()[0].innerText.match('react airdrop!') !== null) //If the last comment text content has the text react airdrop! in it
{ //Starts the if condition
$('div[class*="reactions"]').last()[0].click() //Try clicking on the element doesn't work //Add the +1 reaction
} //Finishes the if condition
}).observe(document.querySelector('div[class*="scrollerInner"]'), { //element_where_the_messages_are_posted
attributes: true,
attributeOldValue: true,
characterData: true,
characterDataOldValue: true,
childList: true,
subtree: true
});
})();

Here is where he stopped trying, if someone can finish it would be greatly appreciated

Pubblica risposta

Accedi per pubblicare una risposta.