-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[removeChannelEmojis] Add option for removing Unicode emojis
- Loading branch information
1 parent
cd2ce63
commit 8efd14e
Showing
6 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { components, settings, util } from "replugged"; | ||
const { SwitchItem, FormNotice } = components; | ||
|
||
interface Settings { | ||
unicode?: boolean; | ||
} | ||
|
||
export const pSettings = await settings.init<Settings>("dev.alyxia.removeChannelEmojis"); | ||
|
||
export function Settings(): React.ReactElement { | ||
return ( | ||
<> | ||
<FormNotice | ||
title="Reload after configuring!" | ||
body="The below settings require a reload to take effect." | ||
type={FormNotice.Types.DANGER} | ||
style={{ marginBottom: 20 }} | ||
/> | ||
<SwitchItem | ||
note="Also get rid of all Unicode emojis that people put in channel names." | ||
{...util.useSetting(pSettings, "unicode", false)}> | ||
Remove Unicode emojis | ||
</SwitchItem> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export { Settings } from "./Settings"; | ||
|
||
interface IChannel { | ||
name: string; | ||
} | ||
export function transformName(channel: IChannel): IChannel { | ||
if (channel != null) | ||
if (channel.name) { | ||
channel.name = channel.name | ||
.replace( | ||
/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g, | ||
"", | ||
) | ||
.replace(/\s+/g, " ") | ||
.trim(); | ||
} | ||
return channel; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.