Add TextEmoji plugin

The plugin prevents Discord from replacing emoji with images, leaving it
up to the browser to render them.
This commit is contained in:
Grzesiek11 2023-12-17 13:20:49 +01:00
parent 5dee2e8549
commit a0e7398725
No known key found for this signature in database
GPG key ID: 4A5445FB68CDB5C4
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,42 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "TextEmoji",
description: "Prevents Discord from replacing emoji with images, leaving it up to the browser to render them",
authors: [Devs.Grzesiek11],
patches: [
{
find: "getSrc(){",
replacement: {
match: /(if\(null!=.{1,2}\))return .{1,2}\.default\.getURL\(.{1,2}\)/,
replace: "$1return null",
},
},
{
find: ",findInlineEmojisFromSurrogates:",
replacement: {
match: /if\(!0!==.{1,2}&&!.{1,2}\.test\(.{1,2}\)\)/,
replace: "",
},
},
],
});

View file

@ -399,6 +399,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "maisy",
id: 257109471589957632n,
},
Grzesiek11: {
name: "Grzesiek11",
id: 368475654662127616n,
},
} satisfies Record<string, Dev>);
// iife so #__PURE__ works correctly