Last active
May 5, 2024 21:26
-
-
Save Gesugao-san/d34230c862d01ca43ad53a326396da09 to your computer and use it in GitHub Desktop.
Discord - get messages' authors
This file contains 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
// https://stackoverflow.com/questions/6991494/ | |
javascript: (function() { | |
console.clear(); | |
let unique_only = Boolean(1); | |
let arr = new Array(); | |
let messages = document.querySelectorAll('[id ^= "chat-messages-"]'); | |
Array.prototype.forEach.call(messages, callback); | |
function callback(element, i) { | |
let avatar = element.querySelector('[class ^= "avatar-"]'); // [aria-hidden ^= "true"]; | |
// ('[src ^= "https://cdn.discordapp.com/avatars/*]'); | |
if (avatar !== null && !(unique_only && arr.includes(avatar.src))) { | |
arr.push(avatar.src); | |
console.log(i, avatar); | |
} | |
}; | |
return [...messages].length; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment