Chat Message Sender Duhh

Patrick

当前为 2023-12-25 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);

})();