Greasy Fork

Greasy Fork is available in English.

Discord ENTER

Simulates pressing Enter in Discord's text input with a shiny button.

当前为 2025-11-04 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/554707/1689053/Discord%20ENTER.js

// ==UserScript==
// @name Discord ENTER
// @namespace https://your-cool-domain.com/discord-enter
// @version 2.4
// @description Simulates pressing Enter in Discord's text input with a shiny button.
// @match https://discord.com/*
// @grant none
// @locale en
// @license MIT
// ==/UserScript==

(() => {
  const btn = Object.assign(document.createElement('button'), {
    textContent: 'E',
    id: 'nuke-enter',
    onclick: () => {
      const box = document.querySelector('[data-slate-editor="true"]') ||
                  document.querySelector('div[role="textbox"]') ||
                  document.querySelector('textarea');
      if (!box) return console.log('no box');

      box.focus();
      ['keydown', 'keypress', 'keyup'].forEach(type => {
        box.dispatchEvent(new KeyboardEvent(type, {
          key: 'Enter',
          code: 'Enter',
          keyCode: 13,
          which: 13,
          bubbles: true,
          cancelable: true
        }));
      });
      console.log('NUKED');
    },
    style: `
      position:fixed; bottom:25px; right:20px; z-index:999999;
      padding:8px 10px; background:#5865F2; color:white;
      border:none; border-radius:4px; font-weight:bold; cursor:pointer;
      font-size:14px; line-height:14px;
    `
  });
  document.body.appendChild(btn);
  console.log('E NUKE armed');
})();