Twitch auto get bonus

Auto get 50 reward.

As of 2020-12-18. See the latest version.

// ==UserScript==
// @version      3.1.3
// @author       聖冰如焰
// @description  自動點擊50獎勵
// @description:en   Auto get 50 reward.
// @license      BY-NC-SA 3.0 TW
// @name         Twitch 自動點擊獎勵
// @name:en      Twitch auto get bonus
// @match        https://www.twitch.tv/*
// @namespace    http://tampermonkey.net/
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==
'user strict'
GM_addStyle(`
.self{
    padding : 0 10px 0 10px;
    align-items: center!important;
    position: relative;
}
.self:hover{
    background-color: rgba(0,0,0,.05);
}
.self::before{
    content: '';
}
.self:hover::before{
    content: '自動領取獎勵數';
    user-select: none;
    background-color: #040109;
    border-radius: 4px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    right: 0;
    line-height: 1.2;
    padding: 3px 6px;
    padding-top: 3px;
    padding-right: 6px;
    padding-bottom: 3px;
    padding-left: 6px;
    pointer-events: none;
    position: absolute;
    text-align: left;
    user-select: none;
    white-space: nowrap;
    z-index: 2000;
    top: 50%;
    transform: translate(110%,-50%);
}`)
window.onload = function(){
    let Gift = GM_getValue(location.href,0);
    let Time_out = 50;
    (function Get_coins(){
        Time_out = 50;
        if ($('button.self').length === 0) {
            Gift = GM_getValue(location.href,0);
            $('[class="tw-flex tw-flex-row"]').after(`<button class='self'>${Gift}</button>`);
        }
        if($('.tw-button.tw-button--success').length !== 0){
            $('.tw-button.tw-button--success').click();
            GM_setValue(location.href,Gift + 50);
            Gift = GM_getValue(location.href);
            $('button.self').text((Gift).toLocaleString());
            Time_out = 6000;
            console.log(new Date,Gift);
        }
        setTimeout(Get_coins,Time_out)
    })()
}