diff --git a/src/plugins/customRPC/index.tsx b/src/plugins/customRPC/index.tsx index f4b9ab06..64aea76a 100644 --- a/src/plugins/customRPC/index.tsx +++ b/src/plugins/customRPC/index.tsx @@ -19,6 +19,7 @@ import { definePluginSettings, Settings } from "@api/Settings"; import { getUserSettingLazy } from "@api/UserSettings"; import { ErrorCard } from "@components/ErrorCard"; +import { Flex } from "@components/Flex"; import { Link } from "@components/Link"; import { Devs } from "@utils/constants"; import { isTruthy } from "@utils/guards"; @@ -27,15 +28,14 @@ import { classes } from "@utils/misc"; import { useAwaiter } from "@utils/react"; import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy, findComponentByCodeLazy } from "@webpack"; -import { ApplicationAssetUtils, Button, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, UserStore } from "@webpack/common"; +import { ApplicationAssetUtils, Button, FluxDispatcher, Forms, React, UserStore } from "@webpack/common"; const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color"); -const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile"); +const ActivityView = findComponentByCodeLazy('location:"UserProfileActivityCard",'); const ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!; async function getApplicationAsset(key: string): Promise { - if (/https?:\/\/(cdn|media)\.discordapp\.(com|net)\/attachments\//.test(key)) return "mp:" + key.replace(/https?:\/\/(cdn|media)\.discordapp\.(com|net)\//, ""); return (await ApplicationAssetUtils.fetchAssetIds(settings.store.appID!, [key]))[0]; } @@ -169,7 +169,7 @@ const settings = definePluginSettings({ value: TimestampMode.NOW }, { - label: "Same as your current time", + label: "Same as your current time (not reset after 24h)", value: TimestampMode.TIME }, { @@ -269,6 +269,7 @@ function isStreamLinkDisabled() { function isStreamLinkValid(value: string) { if (!isStreamLinkDisabled() && !/https?:\/\/(www\.)?(twitch\.tv|youtube\.com)\/\w+/.test(value)) return "Streaming link must be a valid URL."; + if (value && value.length > 512) return "Streaming link must be not longer than 512 characters."; return true; } @@ -277,8 +278,9 @@ function isTimestampDisabled() { } function isImageKeyValid(value: string) { - if (/https?:\/\/(?!i\.)?imgur\.com\//.test(value)) return "Imgur link must be a direct link to the image. (e.g. https://i.imgur.com/...)"; - if (/https?:\/\/(?!media\.)?tenor\.com\//.test(value)) return "Tenor link must be a direct link to the image. (e.g. https://media.tenor.com/...)"; + if (/https?:\/\/(cdn|media)\.discordapp\.(com|net)\//.test(value)) return "Don't use a Discord link. Use an Imgur image link instead."; + if (/https?:\/\/(?!i\.)?imgur\.com\//.test(value)) return "Imgur link must be a direct link to the image (e.g. https://i.imgur.com/...). Right click the image and click 'Copy image address'"; + if (/https?:\/\/(?!media\.)?tenor\.com\//.test(value)) return "Tenor link must be a direct link to the image (e.g. https://media.tenor.com/...). Right click the GIF and click 'Copy image address'"; return true; } @@ -390,7 +392,7 @@ async function setRpc(disable?: boolean) { export default definePlugin({ name: "CustomRPC", - description: "Allows you to set a custom rich presence.", + description: "Add a fully customisable Rich Presence (Game status) to your Discord profile", authors: [Devs.captain, Devs.AutumnVN, Devs.nin0dev], dependencies: ["UserSettingsAPI"], start: setRpc, @@ -410,7 +412,7 @@ export default definePlugin({ style={{ padding: "1em" }} > Notice - Game activity isn't enabled, people won't be able to see your custom rich presence! + Activity Sharing isn't enabled, people won't be able to see your custom rich presence!