From 5770d39b4e5a902b70ad55ffefc675eb1193c18e Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 8 Sep 2023 12:31:08 +0200 Subject: [PATCH] rename Devices => DeviceManager --- .../player/{Devices.ts => DeviceManager.ts} | 6 +++--- src/lib/structures/player/index.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) rename src/lib/structures/player/{Devices.ts => DeviceManager.ts} (85%) diff --git a/src/lib/structures/player/Devices.ts b/src/lib/structures/player/DeviceManager.ts similarity index 85% rename from src/lib/structures/player/Devices.ts rename to src/lib/structures/player/DeviceManager.ts index 3087aae..87ba602 100644 --- a/src/lib/structures/player/Devices.ts +++ b/src/lib/structures/player/DeviceManager.ts @@ -3,7 +3,7 @@ import { Player } from '.'; import { ApiDevice } from '../../../interfaces/player'; import { PlayerDevice } from './Device'; -export class PlayerDevices { +export class PlayerDeviceManager { constructor( public client: Lunify, @@ -14,7 +14,7 @@ export class PlayerDevices { const res = await this.client.rest.get<{ devices: ApiDevice[] }>('/me/player/devices', { headers: { - Authorization: this.player.user.oauth.getAuthorization() + Authorization: await this.player.user.oauth.getAuthorization() } }); @@ -38,7 +38,7 @@ export class PlayerDevices { await this.client.rest.put('/me/player', { headers: { - Authorization: this.player.user.oauth.getAuthorization() + Authorization: await this.player.user.oauth.getAuthorization() }, body: { device_ids: finalDevices diff --git a/src/lib/structures/player/index.ts b/src/lib/structures/player/index.ts index 21fcee7..483de9d 100644 --- a/src/lib/structures/player/index.ts +++ b/src/lib/structures/player/index.ts @@ -1,18 +1,18 @@ import { Lunify } from '../..'; import { User } from '../user'; -import { PlayerDevices } from './Devices'; +import { PlayerDeviceManager } from './DeviceManager'; export * from './Device'; -export * from './Devices'; +export * from './DeviceManager'; export class Player { - public devices: PlayerDevices; + public devices: PlayerDeviceManager; constructor( public client: Lunify, public user: User, ) { - this.devices = new PlayerDevices(this.client, this); + this.devices = new PlayerDeviceManager(this.client, this); } /** @@ -22,15 +22,15 @@ export class Player { * player.start('6IRdLKIyS4p7XNiP8r6rsx'); * ``` */ - async play(track: string | string[]) { + async play(trackId: string | string[]) { const finalTracks: string[] = []; - if (typeof track !== 'string') { - for (const t of track) finalTracks.push('spotify:track:' + t); + if (typeof trackId !== 'string') { + for (const t of trackId) finalTracks.push('spotify:track:' + t); } else { - finalTracks.push('spotify:track:' + track); + finalTracks.push('spotify:track:' + trackId); } await this.client.rest.put('/me/player/play', {