|
|
@ -17,13 +17,16 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import { definePluginSettings, Settings } from "@api/Settings";
|
|
|
|
import { definePluginSettings, Settings } from "@api/Settings";
|
|
|
|
|
|
|
|
import { ErrorCard } from "@components/ErrorCard";
|
|
|
|
import { Link } from "@components/Link";
|
|
|
|
import { Link } from "@components/Link";
|
|
|
|
import { Devs } from "@utils/constants";
|
|
|
|
import { Devs } from "@utils/constants";
|
|
|
|
import { isTruthy } from "@utils/guards";
|
|
|
|
import { isTruthy } from "@utils/guards";
|
|
|
|
|
|
|
|
import { Margins } from "@utils/margins";
|
|
|
|
|
|
|
|
import { classes } from "@utils/misc";
|
|
|
|
import { useAwaiter } from "@utils/react";
|
|
|
|
import { useAwaiter } from "@utils/react";
|
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
|
|
|
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
|
|
|
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
|
|
|
import { ApplicationAssetUtils, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, UserStore } from "@webpack/common";
|
|
|
|
import { ApplicationAssetUtils, Button, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, StatusSettingsStores, UserStore } from "@webpack/common";
|
|
|
|
|
|
|
|
|
|
|
|
const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color");
|
|
|
|
const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color");
|
|
|
|
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
|
|
|
|
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
|
|
|
@ -386,17 +389,36 @@ async function setRpc(disable?: boolean) {
|
|
|
|
export default definePlugin({
|
|
|
|
export default definePlugin({
|
|
|
|
name: "CustomRPC",
|
|
|
|
name: "CustomRPC",
|
|
|
|
description: "Allows you to set a custom rich presence.",
|
|
|
|
description: "Allows you to set a custom rich presence.",
|
|
|
|
authors: [Devs.captain, Devs.AutumnVN],
|
|
|
|
authors: [Devs.captain, Devs.AutumnVN, Devs.nin0dev],
|
|
|
|
start: setRpc,
|
|
|
|
start: setRpc,
|
|
|
|
stop: () => setRpc(true),
|
|
|
|
stop: () => setRpc(true),
|
|
|
|
settings,
|
|
|
|
settings,
|
|
|
|
|
|
|
|
|
|
|
|
settingsAboutComponent: () => {
|
|
|
|
settingsAboutComponent: () => {
|
|
|
|
const activity = useAwaiter(createActivity);
|
|
|
|
const activity = useAwaiter(createActivity);
|
|
|
|
|
|
|
|
const gameActivityEnabled = StatusSettingsStores.ShowCurrentGame.useSetting();
|
|
|
|
const { profileThemeStyle } = useProfileThemeStyle({});
|
|
|
|
const { profileThemeStyle } = useProfileThemeStyle({});
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
|
|
|
|
{!gameActivityEnabled && (
|
|
|
|
|
|
|
|
<ErrorCard
|
|
|
|
|
|
|
|
className={classes(Margins.top16, Margins.bottom16)}
|
|
|
|
|
|
|
|
style={{ padding: "1em" }}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Forms.FormTitle>Notice</Forms.FormTitle>
|
|
|
|
|
|
|
|
<Forms.FormText>Game activity isn't enabled, people won't be able to see your custom rich presence!</Forms.FormText>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
color={Button.Colors.TRANSPARENT}
|
|
|
|
|
|
|
|
className={Margins.top8}
|
|
|
|
|
|
|
|
onClick={() => StatusSettingsStores.ShowCurrentGame.updateSetting(true)}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
Enable
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</ErrorCard>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<Forms.FormText>
|
|
|
|
<Forms.FormText>
|
|
|
|
Go to <Link href="https://discord.com/developers/applications">Discord Developer Portal</Link> to create an application and
|
|
|
|
Go to <Link href="https://discord.com/developers/applications">Discord Developer Portal</Link> to create an application and
|
|
|
|
get the application ID.
|
|
|
|
get the application ID.
|
|
|
@ -407,7 +429,9 @@ export default definePlugin({
|
|
|
|
<Forms.FormText>
|
|
|
|
<Forms.FormText>
|
|
|
|
If you want to use image link, download your image and reupload the image to <Link href="https://imgur.com">Imgur</Link> and get the image link by right-clicking the image and select "Copy image address".
|
|
|
|
If you want to use image link, download your image and reupload the image to <Link href="https://imgur.com">Imgur</Link> and get the image link by right-clicking the image and select "Copy image address".
|
|
|
|
</Forms.FormText>
|
|
|
|
</Forms.FormText>
|
|
|
|
<Forms.FormDivider />
|
|
|
|
|
|
|
|
|
|
|
|
<Forms.FormDivider className={Margins.top8} />
|
|
|
|
|
|
|
|
|
|
|
|
<div style={{ width: "284px", ...profileThemeStyle }}>
|
|
|
|
<div style={{ width: "284px", ...profileThemeStyle }}>
|
|
|
|
{activity[0] && <ActivityComponent activity={activity[0]} className={ActivityClassName.activity} channelId={SelectedChannelStore.getChannelId()}
|
|
|
|
{activity[0] && <ActivityComponent activity={activity[0]} className={ActivityClassName.activity} channelId={SelectedChannelStore.getChannelId()}
|
|
|
|
guild={GuildStore.getGuild(SelectedGuildStore.getLastSelectedGuildId())}
|
|
|
|
guild={GuildStore.getGuild(SelectedGuildStore.getLastSelectedGuildId())}
|
|
|
|