diff --git a/api/services/spotify.json b/api/services/spotify.json index 33c337a..abbc15f 100644 --- a/api/services/spotify.json +++ b/api/services/spotify.json @@ -143,6 +143,14 @@ "en": "Url of a track", "fr": "Url d'une musique'" } + }, + { + "name": "playlistUri", + "type": "string", + "description": { + "en": "Id of the playlist", + "fr": "Id de la playlist dans laquelle ajouter la musique" + } } ], "returns": [] diff --git a/worker/src/runner.ts b/worker/src/runner.ts index af0943f..d439372 100644 --- a/worker/src/runner.ts +++ b/worker/src/runner.ts @@ -27,7 +27,7 @@ export class Runner { for (let [key, value] of Object.entries(params)) { let newValue = value; if (typeof value == "string") { - newValue = value.replace(/{(\w*)(?:@(\d))?}/, (_, name, index) => { + newValue = value.replace(/{(\w*)(?:@(\d))?}/g, (_, name, index) => { if (index) return this._history[parseInt(index)][name] return this._history[this._history.length - 1][name] diff --git a/worker/src/services/spotify.ts b/worker/src/services/spotify.ts index b7d64b4..ce1944e 100644 --- a/worker/src/services/spotify.ts +++ b/worker/src/services/spotify.ts @@ -56,16 +56,12 @@ export class Spotify extends BaseService { @reaction(ReactionType.PlayTrack, ['trackUri']) async playTrack(params: any): Promise { await this._refreshIfNeeded(); - // try { - await this._spotify.play({uris: [params.trackUri]}); - // } catch (e) { - // throw new Error("Spotify premium is required."); - // } + await this._spotify.play({uris: [params.trackUri]}); return {}; } @reaction(ReactionType.Pause, []) - async pause(params: any): Promise { + async pause(_: any): Promise { await this._refreshIfNeeded(); await this._spotify.pause(); return {};