21 lines
635 B
JavaScript
21 lines
635 B
JavaScript
const { collect, collectScreenshotsFor } = require('./collector')
|
|
|
|
async function chat(buddyConfig) {
|
|
const possibleGames = (await collect(buddyConfig)).games
|
|
|
|
const game = possibleGames[Math.floor(Math.random() * possibleGames.length)]
|
|
|
|
const screenshots = await collectScreenshotsFor(game, buddyConfig)
|
|
|
|
const release = game.platforms.find(pl => pl["platform_id"] === buddyConfig.platform)["first_release_date"]
|
|
return {
|
|
"toot": `${game.title} (${release})\n\n${game["moby_url"]}`,
|
|
"attach": screenshots,
|
|
"attachDescription": `Screenshots of Game Boy game ${game.title}`
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
chat
|
|
}
|