mirror of
https://github.com/zoriya/Aeris.git
synced 2026-06-07 20:32:41 +00:00
Handling multiple sumbstitutions on worker patterns
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -56,16 +56,12 @@ export class Spotify extends BaseService {
|
||||
@reaction(ReactionType.PlayTrack, ['trackUri'])
|
||||
async playTrack(params: any): Promise<PipelineEnv> {
|
||||
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<PipelineEnv> {
|
||||
async pause(_: any): Promise<PipelineEnv> {
|
||||
await this._refreshIfNeeded();
|
||||
await this._spotify.pause();
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user