Plugin

CleanChannelName

remove all emoji and decor shit from channel names

index.ts
Download

Source

src/plugins/cleanChannelName/index.ts
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { Devs } from "@utils/constants";
8import definePlugin from "@utils/types";
9import { Channel } from "discord-types/general";
10
11export default definePlugin({
12 name: "CleanChannelName",
13 authors: [Devs.FiveCord],
14 description: "remove all emoji and decor shit from channel names",
15 patches: [
16 {
17 find: "loadAllGuildAndPrivateChannelsFromDisk(){",
18 replacement: {
19 match: /(?<=getChannel\(\i\)\{if\(null!=\i\)return )\i\(\i\)/,
20 replace: "$self.cleanChannelName($&)",
21 }
22 }
23 ],
24
25 cleanChannelName(channel?: Channel) {
26 if (channel) {
27 channel.name = channel.name.normalize("NFKC").replace(/[^\u0020-\u007E]?\p{Extended_Pictographic}[^\u0020-\u007E]?/ug, "").replace(/-?[^\p{Letter}\u0020-\u007E]-?/ug, [2, 4].includes(channel.type) ? " " : "-").replace(/(^-|-$)/g, "");
28 }
29 return channel;
30 }
31});
32