Discord Global UwU Converter

Detects what you are saying across all Discord channels, servers, and DMs, and automatically uwuifies it!

À data de 18/08/2026. Ver a versão mais recente.

Terá de instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

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

Terá de instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Terá de instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Terá de instalar uma extensão como Tampermonkey para instalar este script.

Terá de instalar uma extensão de gestão de scripts de utilizador para instalar este script.

(Já tenho um gestor de scripts de utilizador, deixe-me instalá-lo!)

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

(Já tenho um gestor de estilos de utilizador, deixe-me instalá-lo!)

// ==UserScript==
// @name         Discord Global UwU Converter
// @namespace    http://tampermonkey.net
// @version      0.5
// @description  Detects what you are saying across all Discord channels, servers, and DMs, and automatically uwuifies it!
// @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');
    }

    // Helper to find and update text nodes inside Discord's editor
    function processNode(node) {
        if (node.nodeType === Node.TEXT_NODE) {
            const original = node.textContent;
            const converted = uwuify(original);
            if (original !== converted) {
                node.textContent = converted;
            }
        } else {
            for (let child of node.childNodes) {
                processNode(child);
            }
        }
    }

    // Main detection logic
    function handleDetection(event) {
        const target = event.target;
        
        // Find if we are typing inside a chatbox, channel input, or pop-up text field
        if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.getAttribute('contenteditable') === 'true') {
            
            // Standard textboxes (Search bars, status updates, settings)
            if (target.value !== undefined) {
                const start = target.selectionStart;
                const end = target.selectionEnd;
                const original = target.value;
                const converted = uwuify(original);
                
                if (original !== converted) {
                    target.value = converted;
                    target.setSelectionRange(start, end);
                }
            } 
            // Discord's rich text editor elements (Channel chat box, DM text field)
            else {
                if (target.dataset.isUwUing) return;
                target.dataset.isUwUing = 'true';

                // Save cursor state
                const selection = window.getSelection();
                let savedRange = null;
                if (selection.rangeCount > 0) {
                    savedRange = selection.getRangeAt(0).cloneRange();
                }

                // Convert text elements
                processNode(target);

                // Restore cursor state
                if (savedRange && selection) {
                    try {
                        selection.removeAllRanges();
                        selection.addRange(savedRange);
                    } catch (e) {
                        // Fallback if structure changes slightly
                    }
                }

                delete target.dataset.isUwUing;
            }
        }
    }

    // Capture input events globally across the page structure
    document.addEventListener('input', handleDetection, true);
})();