Skip to content

Instantly share code, notes, and snippets.

@camila314
Created June 23, 2024 01:35
Show Gist options
  • Save camila314/5977a2de7ec6b774854864ee7edee29d to your computer and use it in GitHub Desktop.
Save camila314/5977a2de7ec6b774854864ee7edee29d to your computer and use it in GitHub Desktop.
NoChannelEmoji Plugin for Vencord
import definePlugin from "@utils/types";
import { Devs } from "@utils/constants";
export default definePlugin({
name: "NoChannelEmoji",
authors: [Devs.camila314],
description: "Removes all emojis from channel names",
patches: [
{
find: "webGuildTextChannel",
replacement: {
match: /(let{channel:\i,guild:\i,disableSorting.+?=(\i))/,
replace: "$2.channel = $self.modify($2.channel); $&"
}
},
{
find: ".GUILD_CATEGORY?null:",
replacement: {
match: /(let \i,{channel:\i,.+?=(\i))/,
replace: "$2.channel = $self.modify($2.channel); $&"
}
}
],
modify(channel) {
channel.name = channel.name.replace(/<:.+?:\d+>/g, "");
channel.name = channel.name.replace(/[^\p{L}\p{N}\p{P}\p{Z}{\^\$}]/gu, "");
if (channel.name.startsWith("-")) channel.name = channel.name.slice(1);
if (channel.name.endsWith("-")) channel.name = channel.name.slice(0, -1);
if (channel.name.startsWith(" ")) channel.name = channel.name.slice(1);
if (channel.name.endsWith(" ")) channel.name = channel.name.slice(0, -1);
return channel;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment