Skip to content

Instantly share code, notes, and snippets.

@Cyxo
Last active February 3, 2023 11:08
Show Gist options
  • Save Cyxo/45f7a39ca939be75a42e0ff81f604b4d to your computer and use it in GitHub Desktop.
Save Cyxo/45f7a39ca939be75a42e0ff81f604b4d to your computer and use it in GitHub Desktop.
Twitch Autochest
// ==UserScript==
// @name Twitch Autoclaim
// @namespace http://tampermonkey.net/
// @version 1.0
// @description try to take over the world!
// @author You
// @include https://www.twitch.tv/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// DISCLAIMER: Drops autoclaim needs the Drops tab to have focus (can be in a separate window), otherwise it can't refresh!
if (document.URL.match(/drops\/inventory/)) {
// Claim drops
setTimeout(() => {
document.querySelectorAll('[data-test-selector="DropsCampaignInProgressRewardPresentation-claim-button"]').forEach(btn => {
btn.click()
})
setTimeout(() => window.location.reload(), 55*1000)
}, 5000); // drops can take some time to load
} else {
// Claim chests
setInterval(()=>{
// Try/catch for if we're not on a stream page / there are no chests
try {
document.querySelector("div.chat-input__buttons-container > div > div > div > div > div:nth-child(2) button").click()
} catch (e) {}
}, 1000)
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment