Discord 2000 Character Limit Remover

Remove o limite de 2000 caracteres do Discord no navegador

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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();
    }
})();