new plugin NoServerEmoji ~ hides server emojis from autocomplete (#1787)
Co-authored-by: vee <vendicated@riseup.net>
This commit is contained in:
parent
d8b3869b81
commit
5232a85319
2 changed files with 54 additions and 0 deletions
50
src/plugins/noServerEmojis/index.ts
Normal file
50
src/plugins/noServerEmojis/index.ts
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2023 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
shownEmojis: {
|
||||||
|
description: "The types of emojis to show in the autocomplete menu.",
|
||||||
|
type: OptionType.SELECT,
|
||||||
|
default: "onlyUnicode",
|
||||||
|
options: [
|
||||||
|
{ label: "Only unicode emojis", value: "onlyUnicode" },
|
||||||
|
{ label: "Unicode emojis and server emojis from current server", value: "currentServer" },
|
||||||
|
{ label: "Unicode emojis and all server emojis (Discord default)", value: "all" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "NoServerEmojis",
|
||||||
|
authors: [Devs.UlyssesZhan],
|
||||||
|
description: "Do not show server emojis in the autocomplete menu.",
|
||||||
|
settings,
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "}searchWithoutFetchingLatest(",
|
||||||
|
replacement: {
|
||||||
|
match: /searchWithoutFetchingLatest.{20,300}get\((\i).{10,40}?reduce\(\((\i),(\i)\)=>\{/,
|
||||||
|
replace: "$& if ($self.shouldSkip($1, $3)) return $2;"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
shouldSkip(guildId: string, emoji: any) {
|
||||||
|
if (emoji.type !== "GUILD_EMOJI") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (settings.store.shownEmojis === "onlyUnicode") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (settings.store.shownEmojis === "currentServer") {
|
||||||
|
return emoji.guildId !== guildId;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
|
@ -378,6 +378,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
name: "ProffDea",
|
name: "ProffDea",
|
||||||
id: 609329952180928513n
|
id: 609329952180928513n
|
||||||
},
|
},
|
||||||
|
UlyssesZhan: {
|
||||||
|
name: "UlyssesZhan",
|
||||||
|
id: 586808226058862623n
|
||||||
|
},
|
||||||
ant0n: {
|
ant0n: {
|
||||||
name: "ant0n",
|
name: "ant0n",
|
||||||
id: 145224646868860928n
|
id: 145224646868860928n
|
||||||
|
|
Loading…
Reference in a new issue