17 lines
645 B
JavaScript
17 lines
645 B
JavaScript
require('dotenv').config()
|
|
const database = require('./database.json')
|
|
const Mastodon = require('mastodon-api')
|
|
|
|
const M = new Mastodon({
|
|
access_token: process.env.ACCESS_TOKEN,
|
|
timeout_ms: 60 * 1000,
|
|
api_url: `${process.env.API_URL}/api/v1/`,
|
|
})
|
|
|
|
M.get('accounts/verify_credentials').then(
|
|
me => M.get(`accounts/${me.data.id}/followers`).then(fol => {
|
|
for (const follow of fol.data) {
|
|
M.post('statuses', { status: `@${follow.acct} ${database[Math.floor(Math.random() * database.length)]}\nRandom happiness from compliment: https://git.wadza.fr/sheychen/compliment`, visibility: 'public' })
|
|
}
|
|
})
|
|
) |