Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Vendicated/Vencord into disc…
Browse files Browse the repository at this point in the history
…ord-types
  • Loading branch information
ryan-0324 committed Aug 10, 2024
2 parents 1ae49f4 + 1a712e7 commit 85837de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/plugins/spotifyControls/SpotifyStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface Track {
}

interface PlayerState {
type: "SPOTIFY_PLAYER_STATE";
accountId: string;
track: Track | null;
volumePercent?: number;
Expand All @@ -56,6 +57,7 @@ interface PlayerState {

// added by patch
actual_repeat?: Repeat;
shuffle?: boolean;
}

interface Device {
Expand Down Expand Up @@ -183,6 +185,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
store.isPlaying = a.isPlaying ?? false;
store.volume = a.volumePercent ?? 0;
store.repeat = a.actual_repeat || "off";
store.shuffle = a.shuffle ?? false;
store.position = a.position ?? 0;
store.isSettingPosition = false;
store.emitChange();
Expand Down
23 changes: 11 additions & 12 deletions src/plugins/spotifyControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,20 @@ export default definePlugin({
replace: "false",
}]
},
// Discord doesn't give you the repeat kind, only a boolean
{
find: 'repeat:"off"!==',
replacement: {
match: /repeat:"off"!==(.{1,3}),/,
replace: "actual_repeat:$1,$&"
}
replacement: [
{
// Discord doesn't give you shuffle state and the repeat kind, only a boolean
match: /repeat:"off"!==(\i),/,
replace: "shuffle:arguments[2]?.shuffle_state??false,actual_repeat:$1,$&"
},
{
match: /(?<=artists.filter\(\i=>).{0,10}\i\.id\)&&/,
replace: ""
}
]
},
{
find: "artists.filter",
replacement: {
match: /(?<=artists.filter\(\i=>).{0,10}\i\.id\)&&/,
replace: ""
}
}
],

start() { toggleHoverControls(Settings.plugins.SpotifyControls!.hoverControls); },
Expand Down

0 comments on commit 85837de

Please sign in to comment.