Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Kurotaku-sama/090f27bf20be879ddd5d0de88af3ac7f to your computer and use it in GitHub Desktop.
Save Kurotaku-sama/090f27bf20be879ddd5d0de88af3ac7f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitch staggerrilla command buttons
// @namespace https://kurotaku.de
// @version 2.0.4
// @description Adds buttons to send commands in the Twitch chat
// @author Kurotaku
// @license CC BY-NC-SA 4.0
// @match https://www.twitch.tv/staggerrilla*
// @match https://www.twitch.tv/*/staggerrilla/chat*
// @icon https://static.twitchcdn.net/assets/favicon-32-e29e246c157142c94346.png
// @updateURL https://gist.github.com/Kurotaku-sama/090f27bf20be879ddd5d0de88af3ac7f/raw/Twitch%2520staggerrilla%2520command%2520buttons.user.js
// @downloadURL https://gist.github.com/Kurotaku-sama/090f27bf20be879ddd5d0de88af3ac7f/raw/Twitch%2520staggerrilla%2520command%2520buttons.user.js
// @require https://gist.github.com/Kurotaku-sama/1a7dcb227ce3d7a1b596afe725c0052a/raw/kuros_library.js
// @require https://gist.github.com/Kurotaku-sama/55cabbdc14a21de2989f1b7ef9fed563/raw/kuros_library_twitch_commandbuttons.js
// @require https://cdn.jsdelivr.net/npm/interactjs/dist/interact.min.js
// @require https://cdn.jsdelivr.net/npm/sweetalert2
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_notification
// @grant GM_registerMenuCommand
// ==/UserScript==
let twitch_channel = "staggerrilla";
let streamelements_store = "staggerrilla";
(async function() {
await main();
})();
function init_gm_config() {
GM_registerMenuCommand('Settings', () => GM_config.open());
GM_config.init(
{
'id': 'configuration',
'title': 'Staggerrilla Config',
'fields':
{
'script_enabled': { 'type': 'checkbox', 'default': true, 'label': 'Enable/Disable the script' },
'buttons_general': { 'type': 'checkbox', 'default': true, 'label': 'General buttons' },
'voucher_buttons': { 'type': 'checkbox', 'default': true, 'section': ['Voucher'], 'label': 'Enable Voucher redemption buttons' },
'irc': { 'type': 'checkbox', 'default': false, 'label': 'Use IRC (Recommended! Requires Oauth)', 'section': ['IRC'] },
'auth_username': { 'label': 'Username', 'type': 'textbox' },
'auth_oauth': { 'label': 'Oauth Token. Generate here: <a href="https://twitchtokengenerator.com" target="_blank">twitchtokengenerator.com</a>', 'type': 'textbox' },
'show_streamelements_points': { 'type': 'checkbox', 'default': true, 'section': ['Miscellaneous'], 'label': 'Show StreamElement Points' },
'collect_point_bonus': { 'type': 'checkbox', 'default': true, 'label': 'Collect Point Bonus Automatically' },
'notifications': { 'type': 'checkbox', 'default': false, 'label': 'Desktop notification if message contains your name' },
'hide_powerups': { 'type': 'checkbox', 'default': true, 'label': 'Hide Power-Ups in Store' },
'prevent_shadowban': { 'type': 'checkbox', 'default': true, 'label': 'Prevent Shadowban. Commands become random case.<br>Shadowban means your messages temporarily don\'t appear.<br>Without IRC, you can\'t see if you\'re shadowbanned' },
'custom_css_styles': { 'label': 'Custom CSS Styles:', 'type': 'textarea' }
},
'events': {
'save': () => {location.reload()},
},
'frame': document.body.appendChild(document.createElement('div')),
});
}
function generate_button_groups() {
let buttongroups = "";
if(GM_config.get("buttons_general"))
buttongroups += `${btngrp_label("General")}
<div class="k-buttongroup">
${btngrp_button("bleep", "Bleep")}
${btngrp_button("bloop", "Bloop")}
${btngrp_button("bleep !bloop", "Bleep & Bloop")}
${btngrp_button("champ", "Champ")}
${btngrp_button("heal", "Heal")}
${btngrp_button("join", "Join")}
</div>`;
return(buttongroups);
}
async function generate_voucher_buttons() {
insert_voucher_buttons(
generate_voucher_button("1k Bubbers", "+1k") +
generate_voucher_button("10k Bubbers", "+10k") +
generate_voucher_button("20k Bubbers", "+20k") +
generate_voucher_button("50k Bubbers", "+50k") +
generate_voucher_button("100k Bubbers", "+100k") +
generate_voucher_button("500k Bubbers", "+500k")
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment