diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/fakeNitro.tsx | 28 | ||||
-rw-r--r-- | src/plugins/gameActivityToggle/index.tsx | 2 | ||||
-rw-r--r-- | src/plugins/ignoreActivities.tsx | 5 | ||||
-rw-r--r-- | src/plugins/silentMessageToggle.tsx | 2 |
4 files changed, 29 insertions, 8 deletions
diff --git a/src/plugins/fakeNitro.tsx b/src/plugins/fakeNitro.tsx index d8805f4..c2b81d1 100644 --- a/src/plugins/fakeNitro.tsx +++ b/src/plugins/fakeNitro.tsx @@ -26,6 +26,7 @@ import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy, findByPropsLazy, findLazy, findStoreLazy } from "@webpack"; import { ChannelStore, FluxDispatcher, Parser, PermissionStore, UserStore } from "@webpack/common"; import type { Message } from "discord-types/general"; +import type { ReactNode } from "react"; const DRAFT_TYPE = 0; const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR"); @@ -289,8 +290,8 @@ export default definePlugin({ replace: (m, renderableSticker) => `${m}renderableSticker:${renderableSticker},` }, { - match: /emojiSection.{0,50}description:\i(?<=(\i)\.sticker,.+?)(?=,)/, - replace: (m, props) => `${m}+(${props}.renderableSticker?.fake?" This is a Fake Nitro sticker. Only you can see it rendered like a real one, for non Vencord users it will show as a link.":"")` + match: /(emojiSection.{0,50}description:)(\i)(?<=(\i)\.sticker,.+?)(?=,)/, + replace: (_, rest, reactNode, props) => `${rest}$self.addFakeNotice("STICKER",${reactNode},!!${props}.renderableSticker?.fake)` } ] }, @@ -298,8 +299,8 @@ export default definePlugin({ find: ".Messages.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION", predicate: () => settings.store.transformEmojis, replacement: { - match: /((\i)=\i\.node,\i=\i\.emojiSourceDiscoverableGuild)(.+?return) (.{0,450}Messages\.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION.+?}\))/, - replace: (_, rest1, node, rest2, messages) => `${rest1},fakeNitroNode=${node}${rest2}(${messages})+(fakeNitroNode.fake?" This is a Fake Nitro emoji. Only you can see it rendered like a real one, for non Vencord users it will show as a link.":"")` + match: /((\i)=\i\.node,\i=\i\.emojiSourceDiscoverableGuild)(.+?return )(.{0,450}Messages\.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION.+?}\))/, + replace: (_, rest1, node, rest2, reactNode) => `${rest1},fakeNitroNode=${node}${rest2}$self.addFakeNotice("EMOJI",${reactNode},fakeNitroNode.fake)` } } ], @@ -559,6 +560,25 @@ export default definePlugin({ return link.target && fakeNitroEmojiRegex.test(link.target); }, + addFakeNotice(type: "STICKER" | "EMOJI", node: Array<ReactNode>, fake: boolean) { + if (!fake) return node; + + node = Array.isArray(node) ? node : [node]; + + switch (type) { + case "STICKER": { + node.push(" This is a Fake Nitro sticker. Only you can see it rendered like a real one, for non Vencord users it will show as a link."); + + return node; + } + case "EMOJI": { + node.push(" This is a Fake Nitro emoji. Only you can see it rendered like a real one, for non Vencord users it will show as a link."); + + return node; + } + } + }, + hasPermissionToUseExternalEmojis(channelId: string) { const channel = ChannelStore.getChannel(channelId); diff --git a/src/plugins/gameActivityToggle/index.tsx b/src/plugins/gameActivityToggle/index.tsx index c656f3c..827bea5 100644 --- a/src/plugins/gameActivityToggle/index.tsx +++ b/src/plugins/gameActivityToggle/index.tsx @@ -48,7 +48,7 @@ function GameActivityToggleButton() { return ( <Button - tooltipText="Toggle Game Activity" + tooltipText={showCurrentGame ? "Disable Game Activity" : "Enable Game Activity"} icon={makeIcon(showCurrentGame)} role="switch" aria-checked={!showCurrentGame} diff --git a/src/plugins/ignoreActivities.tsx b/src/plugins/ignoreActivities.tsx index ec64a99..f141dce 100644 --- a/src/plugins/ignoreActivities.tsx +++ b/src/plugins/ignoreActivities.tsx @@ -88,7 +88,7 @@ function ToggleIconOn({ forceWhite }: { forceWhite?: boolean; }) { ); } -function ToggleActivityComponent({ activity, forceWhite }: { activity: IgnoredActivity; forceWhite?: boolean; }) { +function ToggleActivityComponent({ activity, forceWhite, forceLeftMargin }: { activity: IgnoredActivity; forceWhite?: boolean; forceLeftMargin?: boolean; }) { const forceUpdate = useForceUpdater(); return ( @@ -101,6 +101,7 @@ function ToggleActivityComponent({ activity, forceWhite }: { activity: IgnoredAc role="button" aria-label="Toggle activity" tabIndex={0} + style={forceLeftMargin ? { marginLeft: "2px" } : undefined} onClick={e => handleActivityToggle(e, activity, forceUpdate)} > { @@ -200,7 +201,7 @@ export default definePlugin({ renderToggleGameActivityButton(props: { id?: string; exePath: string; }) { return ( <ErrorBoundary noop> - <ToggleActivityComponent activity={{ id: props.id ?? props.exePath, type: ActivitiesTypes.Game }} /> + <ToggleActivityComponent activity={{ id: props.id ?? props.exePath, type: ActivitiesTypes.Game }} forceLeftMargin={true} /> </ErrorBoundary> ); }, diff --git a/src/plugins/silentMessageToggle.tsx b/src/plugins/silentMessageToggle.tsx index 3151e5c..9e808e9 100644 --- a/src/plugins/silentMessageToggle.tsx +++ b/src/plugins/silentMessageToggle.tsx @@ -44,7 +44,7 @@ function SilentMessageToggle(chatBoxProps: { if (chatBoxProps.type.analyticsName !== "normal") return null; return ( - <Tooltip text="Toggle Silent Message"> + <Tooltip text={enabled ? "Disable Silent Message" : "Enable Silent Message"}> {tooltipProps => ( <div style={{ display: "flex" }}> <Button |