Skip to content

Instantly share code, notes, and snippets.

@beporter
Last active March 10, 2026 17:57
Show Gist options
  • Select an option

  • Save beporter/68593ce434a21d769ad0392a895cc61b to your computer and use it in GitHub Desktop.

Select an option

Save beporter/68593ce434a21d769ad0392a895cc61b to your computer and use it in GitHub Desktop.
Greasemonkey script to automatically claim bonus channel points from chat whenever that icon pops up.

Auto-click Twitch chat notices for bonus channel points.

Greasemonkey script to automatically claim bonus channel points from Twitch chat. Clicks the bonus button for you after a short random delay. The button will adopt a new background color (pink by default, but configurable) to let you know this script is working.

This script is heavily inspired by Pabli's version (the mutation observer instead of a setInterval()) and techygrrrl's version (background color, better aria selector) of the same idea, with my addition of a random delay before clicking, in case Twitch ever decides to monitor for this kind of automation.

Installation

Setup

(None. The script auto-runs on twitch.tv URLs page loads, and no-ops if the chat room window isn't present.)

Usage

  • Watch for the channel points bonus button to change colors.
  • Do literally anything else, secure in the knowledge that you're getting your bonus points automatically.

TODO

N/A

// ==UserScript==
// @name Twitch Channel Point Bonus Auto-click
// @namespace https://gist.github.com/beporter/68593ce434a21d769ad0392a895cc61b
// @version 1.0.3
// @description When Twitch chat shows a "collect bonus channel points" icon, click it after a random interval.
// @author https://github.com/beporter
// @match https://*.twitch.tv/*
// @grant none
// @run-at document-end
// @downloadURL https://gist.githubusercontent.com/beporter/68593ce434a21d769ad0392a895cc61b/raw/twitch_auto_channel_points.user.js
// ==/UserScript==
// Credit to:
// Ref: https://gist.github.com/techygrrrl/e3020359138447624047526c9b2f53c8
// Ref: https://greasyfork.org/en/scripts/392555-auto-click-bonus-points-on-twitch-tv/code
(function() {
'use strict';
const PARENT_SELECTOR = document.body;
// const PARENT_SELECTOR = document.querySelector('.chat-input'); // Minimize wasted checks by scoping mutations to the chat input section, but might not be loaded when this script runs.
const ARIA_SELECTOR = '[aria-label="Claim Bonus"]';
// const BUTTON_SELECTOR = '.claimable-bonus__icon'; // Doesn't appear to still be in the source.
const VISUAL_INDICATOR_COLOR = '#E400DB';
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random#getting_a_random_integer_between_two_values
function getRandomInt(min, max) {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
// The maximum is exclusive and the minimum is inclusive.
return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled);
}
var onMutate = function(mutationsList) {
mutationsList.forEach(mutation => {
const element = document.querySelector(ARIA_SELECTOR);
if(element) {
// Signal to the user that the script has engaged.
element.style.background = VISUAL_INDICATOR_COLOR;
// Each time this fires, wait a random few seconds in case Twitch is watching for uniform automation.
setTimeout(
() => element.click(),
getRandomInt(1000, 10000)
);
}
})
};
var observer = new MutationObserver(onMutate);
observer.observe(PARENT_SELECTOR, {childList: true, subtree: true});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment