Skip to content

Commit c24accf

Browse files
committed
Get post ID before generating source link
1 parent 7ecd145 commit c24accf

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

mastodon.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,30 @@ async function videoReply(filename,mediaType,replyTo,text,tweet,checksum,hasAudi
5656
}
5757

5858
try {
59-
let progData = encodeURIComponent(JSON.stringify({
60-
"v":1,
61-
"program":program,
62-
"author":text,
63-
"date": Date.now(),
64-
"id": null,
65-
"src": tweet.url
66-
}));
67-
68-
progData = progData.replace(/\(/g, '%28').replace(/\)/g, '%29');
59+
6960
let resp = await toot.post('media', { file: fs.createReadStream(filename), description:"BBC Micro Bot graphics output - "+tweet.spoiler_text });
7061
log.info(resp)
7162
let id = resp.data.id; // Source: https://bbcmic.ro/#"+progData
72-
let params = { status:"I ran "+text+"'s program and got this.\nView source: http://link.bbcmic.ro/"+short_url, media_ids: [id],in_reply_to_id:replyTo};
63+
let params = { status:"I ran "+text+"'s program and got this.\nSource: http://link.bbcmic.ro/"+short_url+" #bbcbasic", media_ids: [id],in_reply_to_id:replyTo};
7364
params.visibility = "direct";//"public";
7465

7566
let response = await toot.post('statuses', params);
76-
77-
//log.info(response)
67+
log.info("Media post DONE ",JSON.stringify(response));
7868

7969
await toot.post('statuses/:id/favourite', { id: [tweet.id]});
8070
log.info("Favourited "+tweet.id);
8171

82-
log.info("Media post DONE ");
72+
73+
let progData = encodeURIComponent(JSON.stringify({
74+
"v":1,
75+
"program":program,
76+
"author":text,
77+
"date": Date.now(),
78+
"id": null,
79+
"src": tweet.url
80+
}));
81+
82+
progData = progData.replace(/\(/g, '%28').replace(/\)/g, '%29');
8383

8484
return {full:"https://bbcmic.ro/#"+progData,key:short_url}
8585
}

0 commit comments

Comments
 (0)