Plugin
CleanChannelName
remove all emoji and decor shit from channel names
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import { Devs } from "@utils/constants";8
import definePlugin from "@utils/types";9
import { Channel } from "discord-types/general";10
11
export 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