diff options
author | Mushrrom <mail@h1i.dev> | 2023-09-09 12:22:41 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-09 04:22:41 +0200 |
commit | 17abbd3e3ecbe56699aabd795d91cfcf4432a5c8 (patch) | |
tree | ab708cd0438b692985eec03c6425634447c0bc1b /src/plugins | |
parent | 25a1d934c608df117e9141a6cfc1f1e97931aa9c (diff) | |
download | Vencord-17abbd3e3ecbe56699aabd795d91cfcf4432a5c8.tar.gz Vencord-17abbd3e3ecbe56699aabd795d91cfcf4432a5c8.tar.bz2 Vencord-17abbd3e3ecbe56699aabd795d91cfcf4432a5c8.zip |
LastFM: Add setting for using name + artist as activity name (#1713)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lastfm.tsx | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/plugins/lastfm.tsx b/src/plugins/lastfm.tsx index a55f461..66be06a 100644 --- a/src/plugins/lastfm.tsx +++ b/src/plugins/lastfm.tsx @@ -72,6 +72,12 @@ const enum ActivityFlag { INSTANCE = 1 << 0, } +const enum NameFormat { + StatusName = "status-name", + ArtistFirst = "artist-first", + SongFirst = "song-first", +} + const applicationId = "1108588077900898414"; const placeholderId = "2a96cbd8b46e442fc41c2b86b821562f"; @@ -117,10 +123,29 @@ const settings = definePluginSettings({ default: true, }, statusName: { - description: "text shown in status", + description: "custom status text", type: OptionType.STRING, default: "some music", }, + nameFormat: { + description: "Show name of song and artist in status name", + type: OptionType.SELECT, + options: [ + { + label: "Use custom status name", + value: NameFormat.StatusName, + default: true + }, + { + label: "Use format 'artist - song'", + value: NameFormat.ArtistFirst + }, + { + label: "Use format 'song - artist'", + value: NameFormat.SongFirst + } + ], + }, useListeningStatus: { description: 'show "Listening to" status instead of "Playing"', type: OptionType.BOOLEAN, @@ -140,13 +165,13 @@ const settings = definePluginSettings({ value: "placeholder" } ], - } + }, }); export default definePlugin({ name: "LastFMRichPresence", description: "Little plugin for Last.fm rich presence", - authors: [Devs.dzshn, Devs.RuiNtD], + authors: [Devs.dzshn, Devs.RuiNtD, Devs.blahajZip], settingsAboutComponent: () => ( <> @@ -267,9 +292,20 @@ export default definePlugin({ url: `https://www.last.fm/user/${settings.store.username}`, }); + const statusName = (() => { + switch (settings.store.nameFormat) { + case NameFormat.ArtistFirst: + return trackData.artist + " - " + trackData.name; + case NameFormat.SongFirst: + return trackData.name + " - " + trackData.artist; + default: + return settings.store.statusName; + } + })(); + return { application_id: applicationId, - name: settings.store.statusName, + name: statusName, details: trackData.name, state: trackData.artist, |