Discord 2000 Character Limit Remover

Remove o limite de 2000 caracteres do Discord no navegador

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Discord 2000 Character Limit Remover
// @namespace    https://discord.com/*
// @version      1.5
// @description  Remove o limite de 2000 caracteres do Discord no navegador
// @author       EmersonxD
// @match        https://discord.com/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

/* jshint esversion: 11 */

(function() {
    'use strict';

    const overrideLimit = () => {
        const NativeTextInput = window.NativeTextInput.prototype;
        
        NativeTextInput._getMaxLength = function() {
            return null; // Remove a restrição de 2000 caracteres
        };

        NativeTextInput._onInput = function(e) {
            e.target.value = e.target.value; // Ignora validações em tempo real
            this.emit('change', e.target.value);
        };

        if (window.DiscordNative && window.DiscordNative.window) {
            const originalSend = window.DiscordNative.window.sendMessage;
            window.DiscordNative.window.sendMessage = (message) => {
                return originalSend(message); // Bypassa validação final
            };
        }
    };

    const observer = new MutationObserver(() => {
        if (document.querySelector('[data-slate-editor="true"]')) {
            overrideLimit();
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    if (document.querySelector('[data-slate-editor="true"]')) {
        overrideLimit();
    }
})();