Skip to content

Instantly share code, notes, and snippets.

@Kurotaku-sama
Last active March 28, 2025 14:02
Show Gist options
  • Save Kurotaku-sama/2386f720b0b7740410fbcb15f86ac147 to your computer and use it in GitHub Desktop.
Save Kurotaku-sama/2386f720b0b7740410fbcb15f86ac147 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitch LootNova command buttons
// @namespace https://kurotaku.de
// @version 1.1.1
// @description Adds buttons to send commands in the Twitch chat
// @author Kurotaku
// @license CC BY-NC-SA 4.0
// @match https://www.twitch.tv/lootnova*
// @match https://www.twitch.tv/*/lootnova/chat*
// @icon https://static.twitchcdn.net/assets/favicon-32-e29e246c157142c94346.png
// @updateURL https://gist.github.com/Kurotaku-sama/2386f720b0b7740410fbcb15f86ac147/raw/Twitch%2520LootNova%2520command%2520buttons.user.js
// @downloadURL https://gist.github.com/Kurotaku-sama/2386f720b0b7740410fbcb15f86ac147/raw/Twitch%2520LootNova%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 = 'lootnova';
let streamelements_store = "lootnova";
(async function() {
await main();
})();
async function init_gm_config() {
GM_registerMenuCommand('Settings', () => GM_config.open());
GM_config.init(
{
'id': 'configuration',
'title': 'LootNova 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("arrow", "Arrow")}
${btngrp_button("battle", "Battle")}
${btngrp_button("gamecoins", "Gamecoins")}
</div>`;
return(buttongroups);
}
async function generate_voucher_buttons() {
insert_voucher_buttons(
generate_voucher_button("Get 100 GameCoins", "+100 GC") +
generate_voucher_button("Get 1000 GameCoins", "+1k GC") +
generate_voucher_button("Get 10000 GameCoins", "+10k GC")
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment