Skip to content

Instantly share code, notes, and snippets.

@CodelineRed
Last active December 31, 2021 03:27
Show Gist options
  • Save CodelineRed/b7c35468adfaff9645073e1bc00c66b2 to your computer and use it in GitHub Desktop.
Save CodelineRed/b7c35468adfaff9645073e1bc00c66b2 to your computer and use it in GitHub Desktop.
This code collects automatically the channel points chest which pops up every 15 minutes.
// open a twitch channel with channel points
// open chat or popout chat
// open inspector (Opera: CTRL + SHIFT + C, Chrome: CTRL + SHIFT + I, Firefox: F12)
// open console in tab
// copy / paste code + ENTER
// only works if you view a live stream. (just open chat is not enough)
if (document.querySelector('.community-points-summary').style.backgroundColor === '') {
var chestPoints = 0;
document.querySelector('.community-points-summary button').click();
var multiplier = 1;
if (confirm('Did you Subscribe to this Channel?')) {
if (confirm('Are you Tier 1 Subscriber?')) {
multiplier = 1.2;
} else if (confirm('Are you Tier 2 Subscriber?')) {
multiplier = 1.4;
} else if (confirm('Are you Tier 3 Subscriber?')) {
multiplier = 2;
}
}
document.querySelector('#channel-points-reward-center-body .tw-align-items-center button').click();
var specialPoints = parseInt(document.querySelector('.reward-center-body div div.tw-align-items-center.tw-justify-content-between:nth-child(2)>p').textContent.replace('+', '')) * multiplier;
document.querySelector('.reward-center__content button[aria-label="Close"]').click();
console.log('Twitch Chest Auto Click has started');
document.querySelector('.community-points-summary').style.backgroundColor = 'rgb(119, 44, 232)';
document.querySelector('.community-points-summary').style.borderRadius = '5px';
window.twitchChestAutoClickInterval = setInterval(function() {
if (document.querySelector(".chat-input__buttons-container .tw-button.tw-button--success") !== null) {
document.querySelector(".chat-input__buttons-container .tw-button.tw-button--success").click();
chestPoints += specialPoints;
// hours and minutes with leading zero
var hours = ('0' + (new Date()).getHours()).slice(-2);
var minutes = ('0' + (new Date()).getMinutes()).slice(-2);
console.log('Points: ' + chestPoints);
console.log('Time: ' + hours + ':' + minutes);
} else {
//console.log('nothing \T-T/');
}
}, 10000);
} else {
console.log('Twitch Chest Auto Click has stopped');
document.querySelector('.community-points-summary').style.backgroundColor = '';
clearInterval(window.twitchChestAutoClickInterval);
}
// or add script as browser bookmark
javascript:!function(){if(document.querySelector(".community-points-summary").style.backgroundColor===""){var n=0;document.querySelector(".community-points-summary button").click();var t=1;if(confirm("Did you Subscribe to this Channel?")){if(confirm("Are you Tier 1 Subscriber?")){t=1.2}else if(confirm("Are you Tier 2 Subscriber?")){t=1.4}else if(confirm("Are you Tier 3 Subscriber?")){t=2}}document.querySelector("#channel-points-reward-center-body .tw-align-items-center button").click();var o=parseInt(document.querySelector(".reward-center-body div div.tw-align-items-center.tw-justify-content-between:nth-child(2)>p").textContent.replace("+",""))*t;document.querySelector('.reward-center__content button[aria-label="Close"]').click();console.log("Twitch Chest Auto Click has started");document.querySelector(".community-points-summary").style.backgroundColor="rgb(119, 44, 232)";document.querySelector(".community-points-summary").style.borderRadius="5px";window.t=setInterval(function(){if(document.querySelector(".chat-input__buttons-container .tw-button.tw-button--success")!==null){document.querySelector(".chat-input__buttons-container .tw-button.tw-button--success").click();n+=o;var t=("0"+(new Date).getHours()).slice(-2);var e=("0"+(new Date).getMinutes()).slice(-2);console.log("Points: "+n);console.log("Time: "+t+":"+e)}else{}},1e4)}else{console.log("Twitch Chest Auto Click has stopped");document.querySelector(".community-points-summary").style.backgroundColor="";clearInterval(window.t)}}();
// ---
@CodelineRed
Copy link
Author

Purple background color shows that script has started
chest-click-active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment