Plugin
NoServerEmojis
Do not show server emojis in the autocomplete menu.
1
import { definePluginSettings } from "@api/Settings";2
import { Devs } from "@utils/constants";3
import definePlugin, { OptionType } from "@utils/types";4
import type { Channel, Emoji } from "@vencord/discord-types";5
6
const settings = definePluginSettings({7
shownEmojis: {8
description: "The types of emojis to show in the autocomplete menu.",9
type: OptionType.SELECT,10
default: "onlyUnicode",11
options: [12
{ label: "Only unicode emojis", value: "onlyUnicode" },13
{ label: "Unicode emojis and server emojis from current server", value: "currentServer" },14
{ label: "Unicode emojis and all server emojis (Discord default)", value: "all" }15
]16
}17
});18
19
export default definePlugin({20
name: "NoServerEmojis",21
authors: [Devs.UlyssesZhan],22
description: "Do not show server emojis in the autocomplete menu.",23
tags: ["Emotes", "Servers"],24
settings,25
26
patches: [27
{28
find: "}searchWithoutFetchingLatest(",29
replacement: {30
match: /\.nameMatchesChain\(\i\)\.reduce\(\((\i),(\i)\)=>\{(?<=channel:(\i).+?)/,31
replace: "$&if($self.shouldSkip($3,$2))return $1;"32
}33
}34
],35
36
shouldSkip(channel: Channel | undefined | null, emoji: Emoji) {37
if (emoji.type !== 1) {38
return false;39
}40
41
if (settings.store.shownEmojis === "onlyUnicode") {42
return true;43
}44
45
if (settings.store.shownEmojis === "currentServer") {46
return emoji.guildId !== (channel != null ? channel.getGuildId() : null);47
}48
49
return false;50
}51
});52