uwuifyer

Detects and converts ONLY what you type into uwu style across all Discord locations.

2026-08-18 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         uwuifyer
// @namespace    http://tampermonkey.net
// @version      0.8
// @description  Detects and converts ONLY what you type into uwu style across all Discord locations.
// @author       You
// @license      MIT
// @match        *://*://*
// @match        *://://discord.com*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Function to convert regular text to uwu style
    function uwuify(text) {
        return text
            .replace(/[lr]/g, 'w')
            .replace(/[LR]/g, 'W')
            .replace(/n([aeiou])/g, 'ny$1')
            .replace(/N([aeiou])/g, 'Ny$1')
            .replace(/N([AEIOU])/g, 'NY$1')
            .replace(/ove/g, 'uv');
    }

    // Force Discord's text engine to accept the changes
    function dispatchTextChange(target, newText) {
        // Find Discord's secret react/slate interface handler
        const slateKey = Object.keys(target).find(key => key.startsWith('__reactFiber$') || key.startsWith('__reactInternalInstance$'));
        if (!slateKey) return false;

        try {
            // Drill down into Discord's internal state machine
            let node = target[slateKey];
            while (node) {
                if (node.memoizedProps && node.memoizedProps.editor) {
                    const editor = node.memoizedProps.editor;
                    
                    // Wipe out old text, insert the uwuified text cleanly
                    editor.selectAll();
                    editor.insertText(newText);
                    return true;
                }
                node = node.return;
            }
        } catch (e) {
            console.error("Failed to sync text with Discord:", e);
        }
        return false;
    }

    function handleDetection(event) {
        const target = event.target;
        if (!target) return;

        // Handle standard Discord inputs/search boxes
        if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
            const original = target.value;
            const converted = uwuify(original);
            if (original !== converted) {
                const start = target.selectionStart;
                const end = target.selectionEnd;
                target.value = converted;
                target.setSelectionRange(start, end);
                target.dispatchEvent(new Event('input', { bubbles: true }));
            }
            return;
        }

        // Handle Discord's main chat boxes
        if (target.getAttribute('contenteditable') === 'true') {
            if (target.dataset.isUwUing) return;
            target.dataset.isUwUing = 'true';

            const original = target.innerText || "";
            const converted = uwuify(original);

            if (original !== converted && converted.trim() !== "") {
                // Pass text directly to Discord's background processes
                dispatchTextChange(target, converted);
            }

            delete target.dataset.isUwUing;
        }
    }

    // Bind execution to user input routines
    document.addEventListener('input', handleDetection, true);
})();