add amas to newsletter script

This commit is contained in:
k00b 2024-09-21 14:44:17 -05:00
parent 101574b605
commit 83458fdc9e
1 changed files with 12 additions and 0 deletions

View File

@ -152,6 +152,11 @@ async function main () {
variables: { sort: 'top', when: 'week', sub: 'meta' }
})
const ama = await client.query({
query: ITEMS,
variables: { sort: 'top', when: 'week', sub: 'ama' }
})
const jobs = await client.query({
query: ITEMS,
variables: { sub: 'jobs' }
@ -179,6 +184,13 @@ ${top.data.items.items.map((item, i) =>
`${i + 1}. [${item.title}](https://stacker.news/items/${item.id})
- ${abbrNum(item.sats)} sats${item.boost ? ` \\ ${abbrNum(item.boost)} boost` : ''} \\ ${item.ncomments} comments \\ [@${item.user.name}](https://stacker.news/${item.user.name})\n`).join('')}
##### Top AMAs
${ama.data.items.items.slice(0, 3).map((item, i) =>
`${i + 1}. [${item.title}](https://stacker.news/items/${item.id})
- ${abbrNum(item.sats)} sats${item.boost ? ` \\ ${abbrNum(item.boost)} boost` : ''} \\ ${item.ncomments} comments \\ [@${item.user.name}](https://stacker.news/${item.user.name})\n`).join('')}
[**all AMAs**](https://stacker.news/~meta/top/posts/forever)
##### Don't miss
${top.data.items.items.map((item, i) =>
`- [${item.title}](https://stacker.news/items/${item.id})\n`).join('')}