Fixing worker parameters substitution

This commit is contained in:
Zoe Roux
2022-03-03 12:02:10 +01:00
parent 15c3107f49
commit f4c92517bc
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ export class Runner {
const ret: any = {};
for (let [key, value] of Object.entries(params)) {
let newValue = value;
if (value instanceof String) {
if (typeof value == "string") {
newValue = value.replace(/{(\w*)(?:@(\d))?}/, (_, name, index) => {
if (index)
return this._history[parseInt(index)][name]
+5
View File
@@ -98,6 +98,7 @@ export class Youtube extends BaseService {
@reaction(ReactionType.YtComment, ["videoId", "body"])
async reactComment(params: any): Promise<PipelineEnv> {
try {
let infos = await this._youtube.commentThreads.insert({
part: ["snippet"],
requestBody: {
@@ -114,6 +115,10 @@ export class Youtube extends BaseService {
return {
ID: infos.data.id,
}
} catch(e) {
console.log(`youtube react comment error: ${e}`);
throw new Error("Impossible to comment on this video. Comments may be disabled.");
}
}
@reaction(ReactionType.YtAddToPlaylist, ["videoId", "playlistId"])