Chat Message Sender Duhh

Patrick

目前為 2023-12-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Chat Message Sender Duhh
// @namespace    Rishi Big Brain
// @version      0.1
// @description  Patrick
// @author       Rishi Sunak
// @match        kick.com/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';

    // Hardcoded message
    var messageToSend = "[emote:37231:PatrickBoo]";

    // Function to simulate typing a message
    function typeMessage() {
        // Find the chat input element by ID (replace with the actual selector)
        var chatInput = document.getElementById('message-input');

        // Simulate typing each character with a delay
        if (chatInput) {
            var index = 0;

            function typeCharacter() {
                // Simulate typing a character
                chatInput.innerText += messageToSend[index];

                // Move to the next character
                index++;

                // If all characters are typed, simulate pressing the "Enter" key and exit
                if (index === messageToSend.length) {
                    simulateEnterKey();
                } else {
                    // Otherwise, call the function again after a delay
                    setTimeout(typeCharacter, 100); // Adjust the typing speed (milliseconds per character)
                }
            }

            // Start typing
            typeCharacter();
        }
    }

    // Function to simulate pressing the "Enter" key
    function simulateEnterKey() {
        var event = new KeyboardEvent('keydown', {
            key: 'Enter',
            code: 'Enter',
            which: 13,
            keyCode: 13,
            bubbles: true
        });

        // Find the target element (replace with the actual selector)
        var targetElement = document.getElementById('message-input');

        // Dispatch the keyboard event on the target element
        if (targetElement) {
            targetElement.dispatchEvent(event);

            // After pressing Enter, call the typeMessage function again after a delay for the next iteration
            setTimeout(typeMessage, 4200); // Adjust the delay between messages
        }
    }

    // Call the typeMessage function after a delay (adjust as needed)
    setTimeout(typeMessage, 2000);

})();