Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Auto-clicker for /r/TheButton


This little script will automatically click The Button ( when the timer goes below a certain time (set by the user as intClickUnderTime).

This will only run until you refresh the page or navigate away.

⚠️ ⚠️ ⚠️


It is VERY DANGEROUS to paste code into your browser, as it would allow a nefarious actor to do almost anything you can do in a browser window.

Don't trust me to provide safe code for you to paste. Review it line-by-line.

Read more about these kinds of attacks, and learn to protect yourself:

#####To use:

  1. Change the variables below to suit your needs. If you want a certain color of flair, keep in mind that reddit rounds the value of the button UP (so 51.001 is rounded up to 52s, giving you purple)
  2. Go to The Button subreddit at
  3. Open up the console (usually by pressing F12 in most browsers)
  4. Copy the code from this Gist to your clipboard (it's okay to leave the comments)
  5. Paste into the console and press enter


If you run this code and change your mind about pressing the button, simply REFRESH the page (F5)

// User variables, which tell the script how often to check The Button
var intClickUnderThisTime = 21000; // Time in milliseconds (seconds x 1000)
var intUpdateFrequency = 100; // Time to check The Button in milliseconds (seconds x 1000)
var boolLogNewLowValue = true; // Log the value of The Button to the console when it reaches a new low (in rounded seconds, using CEILING to round up)
var intLowValue = 60000; // Override this with another value if you know it's been lower
// WARNING: logging this value to the console can be a source of memory leak if this script runs for a long time.
// More on memory leaks in the console from the Chrome dev team:
var boolLogTicking = false; // Log the value of The Button to the console (in rounded seconds, using CEILING to round up)
// Flair colors, to see what color the press will get you
var arrFlairColors = [
// setTimeout runs a function after a specified amount of time (the function here is called checkButtonTime)
setTimeout(function checkButtonTime(){
// Look at the number of milliseconds left, which is stored in the variable r.thebutton._msLeft
// and compare that to our threshold value stored in intClickUnderThisTime
if(boolLogNewLowValue === true) {
if(r.thebutton._msLeft < intLowValue) {
intLowValue = r.thebutton._msLeft;
var d = new Date();
var strDateTime = (d.getMonth()+1) +"/"+ d.getDate() + " @ " + d.getHours() +":"+ d.getMinutes() +":"+ d.getSeconds();
console.log("NEW LOW VALUE ("+strDateTime+"): " + (r.thebutton._msLeft/1000) + "s");
if(r.thebutton._msLeft < intClickUnderThisTime){
// The remaining time is under our threshold! Time to click!
// Unlock The Button by removing a CSS class called "locked"
// Click The Button
// See which color flair you earned for that click, by looping over the variable arrFlairColors
var strFlairColorForYou = "grey";
if (Math.ceil(r.thebutton._msLeft/1000) <= v.time) {
strFlairColorForYou = v.color;
strFlairColorHex = v.colorHex;
return false; // stop this loop from continuing
// Write a message in the console that the button was clicked
console.log("Under " + intClickUnderThisTime/1000 + " seconds! The Button was clicked at " + r.thebutton._msLeft/1000 + " seconds, and you earned " + strFlairColorForYou + " flair.");
// Change the box around The Button to match your new flair color
$(".thebutton-wrap").prepend("<div style='text-align:center;background-color:"+strFlairColorHex+";color:white;padding:15px;font-size:28px;'>You clicked the button at "+ r.thebutton._msLeft/1000 +" seconds!</div>");
// The Button value isn't low enough yet
var strFlairColorAvailable = "grey";
if (Math.ceil(r.thebutton._msLeft/1000) <= v.time) {
strFlairColorAvailable = v.color;
strFlairColorAvailableHex = v.colorHex;
return false; // stop this loop from continuing
// If you want "ticking" to be shown in the console, this part does that
if(boolLogTicking === true) {
console.log(Math.ceil(r.thebutton._msLeft/1000) + " ("+strFlairColorAvailable+")"); // Rounded UP, which is how flair is assigned in /r/thebutton
setTimeout(checkButtonTime, intUpdateFrequency);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment