Skip to content

Instantly share code, notes, and snippets.

@nishantrpai
Last active September 9, 2022 09:00
Show Gist options
  • Save nishantrpai/f642d0c0d6ec152b096ed5968714290f to your computer and use it in GitHub Desktop.
Save nishantrpai/f642d0c0d6ec152b096ed5968714290f to your computer and use it in GitHub Desktop.
Pick a random person from discord reactions for giveaway

Discord Giveaway

If you want to pick a random person from discord reactions to giveaway you can use this:

  1. Click on reaction button > Click on X others

  2. Open Console: Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).

  3. Paste code below based on your needs.

If you want to pick 1 person:

let reactors = Array.from(document.querySelectorAll('.reactors-1VXca7 .nickname-1PaREw')).map(node => node.innerText)
let winner = reactors[Math.floor(Math.random()*reactors.length)]
console.log(winner);

If you want to pick n people as winners:

Note: Change 3 to n

let reactors = Array.from(document.querySelectorAll('.reactors-1VXca7 .nickname-1PaREw')).map(node => node.innerText)
let winners = reactors.sort(() => 0.5 - Math.random()).slice(0,3) //change 3 to n
console.log(winners);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment