🧩
Plugin

MentionFix

von HeadX

Hate the `@unknown-user` when mentioning someone you've never met? Yeah this fixes that. :>

🏷️ v2.0.2 📦 2.7 KB 🗓️ 2.7.2026 📄 80 Zeilen
⬇️ Download 📄 Raw ansehen 🌐 Source
Installation: Datei herunterladen und in deinen BetterDiscord-Ordner legen — %appdata%\\BetterDiscord\\plugins (Windows) bzw. über Discord: Einstellungen → Plugins → Plugin-Ordner öffnen.
MentionFix.plugin.js · 80 Zeilen · 2.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
/*
  FILE META START
  name: MentionFix.plugin.js
  version: 0.0.10
  description: Multi-surface admin, cloud, bot host, login, and secure chat server.
  lastModified: 2026-05-04T20:22:59.637Z
  checksum: 4ddbd12973d8b273465be69816442f76660e36ece015a2e221c045fba99ec2d8
  FILE META END
*/

/**
 * @name MentionFix
 * @author HeadX
 * @authorId 808385710700494919
 * @description Hate the `@unknown-user` when mentioning someone you've never met? Yeah this fixes that. :>
 * @version 2.0.2
 * @invite J6wTJJ5fp
 * @website https://headcraft.cloud/better-discord
 * @source https://headcraft.cloud/better-discord/MentionFix.plugin.js
 * @updateUrl https://headcraft.cloud/better-discord/MentionFix.plugin.js
 */


"use strict";

// src/MentionFix/index.tsx
var { Webpack, Patcher, ReactUtils } = new BdApi("MentionFix");
var [Module, Key] = Webpack.getWithKey(Webpack.Filters.byStrings("viewingChannelId", "parsedUserId"));
var UserStore = Webpack.getStore("UserStore");
var FetchModule = Webpack.getMangled('type:"USER_PROFILE_FETCH_START"', { fetchUser: Webpack.Filters.byStrings("USER_UPDATE", "Promise.resolve") });
var Message = Webpack.getMangled("quotedChatMessage", {
  message: (x) => String(x).startsWith("message")
});
function reRender(selector) {
  const target = document.querySelector(selector)?.parentElement;
  if (!target) return;
  const instance = ReactUtils.getOwnerInstance(target);
  const unpatch = Patcher.instead(instance, "render", () => unpatch());
  instance.forceUpdate(() => instance.forceUpdate());
}
var MentionFix = class {
  constructor() {
    this.fetchedUsers = /* @__PURE__ */ new Set();
  }
  start() {
    Patcher.after(Module, Key, (that, [args], res) => {
      const userId = args.parsedUserId;
      const doesUserExist = UserStore.getUser(userId);
      if (doesUserExist === void 0) {
        for (var child of res.props.children) {
          if (child && child.props) {
            const originalOnMouseEnter = child.props.onMouseEnter;
            Object.defineProperty(child.props, "onMouseEnter", {
              value: async (e) => {
                if (!this.fetchedUsers.has(userId)) {
                  await this.fetchedUsers.add(userId);
                  await FetchModule.fetchUser(userId).catch((error) => {
                    this.fetchedUsers.delete(userId);
                  });
                }
                setTimeout(() => reRender(`.${Message.message}`), 10);
                if (originalOnMouseEnter) {
                  originalOnMouseEnter(e);
                }
              },
              writable: true,
              configurable: true
            });
          }
        }
      }
    });
  }
  stop() {
    Patcher.unpatchAll();
    this.fetchedUsers.clear();
  }
};
module.exports = MentionFix;
← Alle Plugins & Themes index.json headcraft.cloud