mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-10 23:23:04 -04:00
fix(statsfm): some issues with RPC & some new extra things #133
changes and update by Crxa
This commit is contained in:
parent
a97337d9c7
commit
635c775323
1 changed files with 22 additions and 12 deletions
|
@ -120,7 +120,7 @@ const placeholderId = "2a96cbd8b46e442fc41c2b86b821562f";
|
||||||
|
|
||||||
const logger = new Logger("StatsfmPresence");
|
const logger = new Logger("StatsfmPresence");
|
||||||
|
|
||||||
const presenceStore = findByPropsLazy("getLocalPresence");
|
const PresenceStore = findByPropsLazy("getLocalPresence");
|
||||||
|
|
||||||
async function getApplicationAsset(key: string): Promise<string> {
|
async function getApplicationAsset(key: string): Promise<string> {
|
||||||
return (await ApplicationAssetUtils.fetchAssetIds(applicationId, [key]))[0];
|
return (await ApplicationAssetUtils.fetchAssetIds(applicationId, [key]))[0];
|
||||||
|
@ -136,26 +136,31 @@ function setActivity(activity: Activity | null) {
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
username: {
|
username: {
|
||||||
description: "stats.fm username",
|
description: "Stats.fm username",
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
},
|
},
|
||||||
shareUsername: {
|
shareUsername: {
|
||||||
description: "show link to stats.fm profile",
|
description: "Show link to stats.fm profile",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
shareSong: {
|
shareSong: {
|
||||||
description: "show link to song on stats.fm",
|
description: "Show link to song on stats.fm",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
hideWithSpotify: {
|
hideWithSpotify: {
|
||||||
description: "hide stats.fm presence if spotify is running",
|
description: "Hide stats.fm presence if spotify is running",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
hideWithExternalRPC: {
|
||||||
|
description: "Hides stats.fm presence if an external RPC is running",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
statusName: {
|
statusName: {
|
||||||
description: "custom status text",
|
description: "Custom status text",
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
default: "Stats.fm",
|
default: "Stats.fm",
|
||||||
},
|
},
|
||||||
|
@ -191,7 +196,7 @@ const settings = definePluginSettings({
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
useListeningStatus: {
|
useListeningStatus: {
|
||||||
description: 'show "Listening to" status instead of "Playing"',
|
description: 'Show "Listening to" status instead of "Playing"',
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
@ -211,7 +216,7 @@ const settings = definePluginSettings({
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
showStatsFmLogo: {
|
showStatsFmLogo: {
|
||||||
description: "show the Stats.fm next to the albums cover",
|
description: "Show the Stats.fm next to the albums cover",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: true,
|
default: true,
|
||||||
}
|
}
|
||||||
|
@ -287,12 +292,17 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
async getActivity(): Promise<Activity | null> {
|
async getActivity(): Promise<Activity | null> {
|
||||||
if (settings.store.hideWithSpotify) {
|
if (settings.store.hideWithExternalRPC) {
|
||||||
for (const activity of presenceStore.getActivities()) {
|
if (PresenceStore.getActivities().some(a => a.application_id !== applicationId)) {
|
||||||
if (activity.type === ActivityType.LISTENING && activity.application_id !== applicationId) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.store.hideWithSpotify) {
|
||||||
|
if (PresenceStore.getActivities().some(a => a.type === ActivityType.LISTENING && a.application_id !== applicationId)) {
|
||||||
|
// there is already music status because of Spotify or richerCider (probably more)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const trackData = await this.fetchTrackData();
|
const trackData = await this.fetchTrackData();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue