Skip to content

Commit 74ad0f5

Browse files
committed
Fix posting error
1 parent a211714 commit 74ad0f5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

main.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,18 @@ const bot = new LemmyBot.LemmyBot({
225225

226226
for (const [instance, communities] of Object.entries(instances)) {
227227
for (const [community, value] of Object.entries(communities)) {
228-
if (value.feeds.includes(feed.name)) {
229-
console.log(`${chalk.green('CREATING:')} post for link ${item.link} in ${community }`);
228+
if (Object.values(value).includes(name)) {
229+
console.log(`${chalk.grey('CREATING:')} post for link ${item.link} in ${community }`);
230230
const communityId = await getCommunityId({ name: community, instance: instance });
231231

232+
let title = item.title;
233+
title = parseTags(title);
234+
232235
let body = ((feed.content && feed.content === 'summary') ? item.summary : item.content);
233236
body = parseTags(body);
234237

235238
await createPost({
236-
name: item.title,
239+
name: title,
237240
body: body,
238241
url: item.link || undefined,
239242
community_id: communityId,
@@ -242,7 +245,6 @@ const bot = new LemmyBot.LemmyBot({
242245
}
243246
}
244247
}
245-
console.log(`${chalk.gray('POSTED:')} ${item.link} and pinned for ${pin_days} days`);
246248
});
247249
}
248250

@@ -310,6 +312,14 @@ const bot = new LemmyBot.LemmyBot({
310312
let tags = {
311313
'<em>': '**',
312314
'</em>': '**',
315+
'<p>': '',
316+
'</p>': '',
317+
'<strong>': '**',
318+
'</strong>': '**',
319+
'<br>': '\n',
320+
'<br/>': '\n',
321+
'<br />': '\n',
322+
'&nbsp;': ' ',
313323
}
314324

315325
function parseTags(input) {

0 commit comments

Comments
 (0)