update dependencies and @vencord/types package

This commit is contained in:
Vendicated 2025-02-18 15:23:20 +01:00
parent 05566aed15
commit edf6480b8f
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
14 changed files with 606 additions and 1063 deletions

View file

@ -77,7 +77,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
class SpotifyStore extends Store {
public mPosition = 0;
private start = 0;
public _start = 0;
public track: Track | null = null;
public device: Device | null = null;
@ -100,26 +100,26 @@ export const SpotifyStore = proxyLazyWebpack(() => {
public get position(): number {
let pos = this.mPosition;
if (this.isPlaying) {
pos += Date.now() - this.start;
pos += Date.now() - this._start;
}
return pos;
}
public set position(p: number) {
this.mPosition = p;
this.start = Date.now();
this._start = Date.now();
}
prev() {
this.req("post", "/previous");
this._req("post", "/previous");
}
next() {
this.req("post", "/next");
this._req("post", "/next");
}
setVolume(percent: number) {
this.req("put", "/volume", {
this._req("put", "/volume", {
query: {
volume_percent: Math.round(percent)
}
@ -131,17 +131,17 @@ export const SpotifyStore = proxyLazyWebpack(() => {
}
setPlaying(playing: boolean) {
this.req("put", playing ? "/play" : "/pause");
this._req("put", playing ? "/play" : "/pause");
}
setRepeat(state: Repeat) {
this.req("put", "/repeat", {
this._req("put", "/repeat", {
query: { state }
});
}
setShuffle(state: boolean) {
this.req("put", "/shuffle", {
this._req("put", "/shuffle", {
query: { state }
}).then(() => {
this.shuffle = state;
@ -154,7 +154,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
this.isSettingPosition = true;
return this.req("put", "/seek", {
return this._req("put", "/seek", {
query: {
position_ms: Math.round(ms)
}
@ -164,7 +164,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
});
}
private req(method: "post" | "get" | "put", route: string, data: any = {}) {
_req(method: "post" | "get" | "put", route: string, data: any = {}) {
if (this.device?.is_active)
(data.query ??= {}).device_id = this.device.id;