// ==UserScript==
// @name Twitch hitsquadgodfather command buttons
// @namespace https://kurotaku.de
// @version 2.1.6
// @description Adds buttons to send commands in the Twitch chat
// @author Kurotaku
// @license CC BY-NC-SA 4.0
// @match https://www.twitch.tv/*hitsquad*
// @icon https://static.twitchcdn.net/assets/favicon-32-e29e246c157142c94346.png
// @updateURL https://raw.githubusercontent.com/Kurotaku-sama/Userscripts/main/userscripts/Twitch_Command_Buttons/script_hitsquad.user.js
// @downloadURL https://raw.githubusercontent.com/Kurotaku-sama/Userscripts/main/userscripts/Twitch_Command_Buttons/script_hitsquad.user.js
// @require https://raw.githubusercontent.com/Kurotaku-sama/Userscripts/main/libraries/kuros_library.js
// @require https://raw.githubusercontent.com/Kurotaku-sama/Userscripts/main/libraries/twitch_command_buttons.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 = "hitsquadgodfather";
let streamelements_store = "hitsquadgodfather";
(async function() {
const match = window.location.pathname.toLowerCase().match(/^\/(hitsquad[^\/]*)/);
if (match)
twitch_channel = match[1];
await main();
// Additional functionality for TheGodFather's version of the script
if (GM_config.get("script_enabled")) {
if (GM_config.get("bulk_purchase_panel") || GM_config.get("clickable_links_in_description"))
twitch_store_observer();
if (GM_config.get("restart_timer"))
restart_timer(172800);
}
})();
async function init_gm_config() {
const config_id = "configuration_ttv_hsgf_cmd_btn";
await migrate_config_id(config_id);
GM_registerMenuCommand("Settings", () => GM_config.open());
GM_config.init({
id: config_id,
title: 'Twitch HitSquadGodFather Command Buttons',
fields: {
script_enabled: {
type: 'checkbox',
default: true,
label: 'Enable/Disable the script',
},
buttons_general: {
type: 'checkbox',
default: true,
label: 'General buttons',
},
buttons_trivia: {
type: 'checkbox',
default: true,
label: 'Trivia buttons',
},
buttons_loot: {
section: ['Loot'],
type: 'checkbox',
default: false,
label: 'Loot buttons',
},
buttons_loot_random: {
type: 'checkbox',
default: true,
label: 'Random Loot Button in General Buttons',
},
buttons_loot_target: {
type: 'checkbox',
default: true,
label: 'Loot buttons with Target Buttons',
},
buttons_chest: {
section: ['Chest'],
type: 'checkbox',
default: false,
label: 'Chest buttons',
},
buttons_chest_random: {
type: 'checkbox',
default: true,
label: 'Random Chest Button in General Buttons',
},
buttons_chest_target: {
type: 'checkbox',
default: true,
label: 'Chest buttons with Target Buttons',
},
showdown_buttons: {
section: ['Showdown'],
type: 'checkbox',
default: true,
label: 'Showdown buttons',
},
showdown_wizard: {
type: 'checkbox',
default: true,
label: 'Showdown Wizard button',
},
showdown_knight: {
type: 'checkbox',
default: true,
label: 'Showdown Knight button',
},
showdown_cleric: {
type: 'checkbox',
default: true,
label: 'Showdown Cleric button',
},
showdown_experience: {
type: 'checkbox',
default: true,
label: 'Showdown Experience button',
},
voucher_buttons: {
section: ['Voucher'],
type: 'checkbox',
default: true,
label: 'Enable Voucher redemption buttons',
},
irc: {
section: ['IRC'],
type: 'checkbox',
default: false,
label: 'Use IRC (Recommended! Requires Oauth)',
},
auth_username: {
label: 'Username',
type: 'textbox',
},
auth_oauth: {
label: 'Oauth Token. Generate here: twitchtokengenerator.com',
type: 'textbox',
},
hide_powerups: {
section: ['Twitch Store'],
type: 'checkbox',
default: true,
label: 'Hide Power-Ups in Store',
},
bulk_purchase_panel: {
type: 'checkbox',
default: true,
label: 'Bulk purchase panel',
},
clickable_links_in_description: {
type: 'checkbox',
default: true,
label: 'Clickable links in descriptions',
},
show_streamelements_points: {
section: ['Miscellaneous'],
type: 'checkbox',
default: true,
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',
},
restart_timer: {
type: 'checkbox',
default: true,
label: 'Show approx stream restart timer',
},
prevent_shadowban: {
type: 'checkbox',
default: true,
label: 'Prevent Shadowban. Commands become random case.
Shadowban means your messages temporarily don\'t appear.
Without IRC, you can\'t see if you\'re shadowbanned',
},
custom_css_styles: {
label: 'Custom CSS Styles:',
type: 'textarea',
},
},
events: {
save: () => { location.reload() },
},
frame: create_configuration_container(),
});
await wait_for_gm_config();
}
function generate_button_groups() {
let buttongroups = "";
if(GM_config.get("buttons_general"))
buttongroups += `${btngrp_label("General")}