diff --git a/src/plugins/rpcEditor/ReplaceSettings.tsx b/src/plugins/rpcEditor/ReplaceSettings.tsx index 26024195b..1bba4a097 100644 --- a/src/plugins/rpcEditor/ReplaceSettings.tsx +++ b/src/plugins/rpcEditor/ReplaceSettings.tsx @@ -8,9 +8,9 @@ import { CheckedTextInput } from "@components/CheckedTextInput"; import { Margins } from "@utils/margins"; import { identity } from "@utils/misc"; import { findByPropsLazy } from "@webpack"; -import { Card, Forms, React, Select, SnowflakeUtils, Switch } from "@webpack/common"; +import { Card, Forms, PresenceStore, React, Select, SnowflakeUtils, Switch, UserStore } from "@webpack/common"; -import { ActivityType, AppIdSetting, makeEmptyAppId } from "."; +import { Activity, ActivityType, AppIdSetting, makeEmptyAppId } from "."; interface SettingsProps { appIds: AppIdSetting[]; @@ -48,20 +48,23 @@ function isValidSnowflake(v: string) { } export function ReplaceTutorial() { + const activities: Activity[] = PresenceStore.getActivities(UserStore.getCurrentUser().id); + console.log(activities); return ( <> - How to get an Application ID + IDs of currently running activities + { + activities.length === 0 ? No running activities : activities.map(activity => { return activity.flags !== 48 ? {activity.name}: {activity.application_id} : null; /* hide spotify */ }) + } + Available variables - The method of getting an app's id will differ depending on what app it is. If the source code is available you can most likely find it inside the app's repository. + In all fields, you can put in variables that'll automatically be replaced by their content: +
+                    :name:, :details:, :state:
+                    
+ :large_image::large_text:, :small_image:, :small_text: +
- - Another method is to start the app in question, then open Discord's console and look for a log from RPCServer saying something like - "cmd: 'SET_ACTIVITY'" with your app's name somewhere inside - - - - Note: ActivityTypes other than Playing will only show timestamps on Mobile. It's a Discord issue. - ); } @@ -98,7 +101,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { className={Margins.bottom16} hideBorder={true} > - {setting.appName} + Enable editing of {setting.appName} Application ID - !v || isValidSnowflake(v) || "Invalid appId, must be a snowflake" + !v || isValidSnowflake(v) || "Invalid application ID" } /> {setting.activityType === ActivityType.STREAMING && @@ -118,7 +121,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { onChange={async v => { onChange(v, i, "streamUrl"); }} - validate={st => !/https?:\/\/(www\.)?(twitch\.tv|youtube\.com)\/\w+/.test(st) && "Only Twitch and Youtube urls will work." || true} + validate={st => !/https?:\/\/(www\.)?(twitch\.tv|youtube\.com)\/\w+/.test(st) && "Only Twitch and Youtube URLs will work." || true} /> } New activity type diff --git a/src/plugins/rpcEditor/index.tsx b/src/plugins/rpcEditor/index.tsx index 4a5458284..7bf363782 100644 --- a/src/plugins/rpcEditor/index.tsx +++ b/src/plugins/rpcEditor/index.tsx @@ -39,6 +39,7 @@ export interface Activity { button_urls?: Array; }; type: number; + flags: number; } interface ActivityAssets {