Twitch Auto Chat Sender

Envia mensajes automáticos con calibración manual en Twitch

Size

4.4 KB

Version

1.1.1

Created

Dec 2, 2025

Updated

14 days ago

1// ==UserScript==
2// @name		Twitch Auto Chat Sender
3// @description		Envia mensajes automáticos con calibración manual en Twitch
4// @version		1.1.1
5// @match		https://*.twitch.tv/*
6// @icon		https://assets.twitch.tv/assets/favicon-32-e29e246c157142c94346.png
7// @author		You
8// ==/UserScript==
9(function() {
10    'use strict';
11
12    let selectedInput = null;
13    let selectedButton = null;
14    let interval = null;
15
16    // Crear panel
17    const panel = document.createElement("div");
18    panel.style.position = "fixed";
19    panel.style.top = "20px";
20    panel.style.left = "20px";
21    panel.style.padding = "10px";
22    panel.style.background = "#222";
23    panel.style.color = "white";
24    panel.style.zIndex = "999999";
25    panel.style.border = "1px solid #555";
26    panel.style.borderRadius = "8px";
27    panel.style.width = "220px";
28    panel.style.cursor = "move";
29
30    panel.innerHTML = `
31        <div style="font-weight:bold; margin-bottom:8px;">Auto Sender</div>
32        <button id="selInput">Seleccionar Input</button><br><br>
33        <button id="selButton">Seleccionar Boton</button><br><br>
34        Mensaje:<br>
35        <input id="msgText" style="width:100%; margin-bottom:5px;"><br>
36        Delay (ms):<br>
37        <input id="msgDelay" type="number" value="2000" style="width:100%; margin-bottom:10px;"><br>
38        <button id="activate">Activar</button>
39        <button id="deactivate">Desactivar</button>
40        <div id="status" style="margin-top:8px; font-size:12px; color:#ccc;">Listo</div>
41    `;
42
43    document.body.appendChild(panel);
44
45    // Hacer panel movible
46    let offsetX, offsetY, isDown = false;
47    panel.addEventListener("mousedown", e => {
48        isDown = true;
49        offsetX = e.clientX - panel.offsetLeft;
50        offsetY = e.clientY - panel.offsetTop;
51    });
52
53    document.addEventListener("mouseup", () => isDown = false);
54
55    document.addEventListener("mousemove", e => {
56        if (isDown) {
57            panel.style.left = `${e.clientX - offsetX}px`;
58            panel.style.top = `${e.clientY - offsetY}px`;
59        }
60    });
61
62    const status = document.getElementById("status");
63
64    // Seleccionar Input
65    document.getElementById("selInput").onclick = () => {
66        status.innerText = "Haz clic en la caja del chat...";
67        document.addEventListener("click", grabInput, { once: true });
68    };
69
70    function grabInput(e) {
71        selectedInput = e.target;
72        console.log("Input seleccionado:", selectedInput);
73        status.innerText = "Input guardado ✔";
74        e.preventDefault();
75        e.stopPropagation();
76    }
77
78    // Seleccionar Botón
79    document.getElementById("selButton").onclick = () => {
80        status.innerText = "Haz clic en el botón de enviar...";
81        document.addEventListener("click", grabButton, { once: true });
82    };
83
84    function grabButton(e) {
85        selectedButton = e.target;
86        console.log("Botón seleccionado:", selectedButton);
87        status.innerText = "Botón guardado ✔";
88        e.preventDefault();
89        e.stopPropagation();
90    }
91
92    // Activar envío
93    document.getElementById("activate").onclick = () => {
94        if (!selectedInput || !selectedButton) {
95            status.innerText = "Falta calibrar input o botón";
96            console.log("ERROR: No input/botón seleccionado.");
97            return;
98        }
99
100        let msg = document.getElementById("msgText").value;
101        let delay = parseInt(document.getElementById("msgDelay").value);
102
103        if (!msg) {
104            status.innerText = "Mensaje vacío";
105            return;
106        }
107
108        status.innerText = "Enviando...";
109        console.log("Auto-message started ✔");
110
111        interval = setInterval(() => {
112            try {
113                selectedInput.value = msg;
114
115                // Trigger real input events
116                selectedInput.dispatchEvent(new Event("input", { bubbles: true }));
117                selectedInput.dispatchEvent(new Event("change", { bubbles: true }));
118
119                // Click real enviar
120                selectedButton.click();
121
122                console.log("Mensaje enviado");
123            } catch (err) {
124                console.log("Error al enviar mensaje:", err);
125            }
126        }, delay);
127    };
128
129    // Desactivar envío
130    document.getElementById("deactivate").onclick = () => {
131        clearInterval(interval);
132        status.innerText = "Detenido";
133        console.log("Auto-message stopped ✖");
134    };
135
136})();
Twitch Auto Chat Sender | Robomonkey