1
0
Fork 0
mirror of https://gitlab.com/Oreolek/improv_forest.git synced 2024-05-19 01:18:33 +03:00

Mastodon posting

This commit is contained in:
Alexander Yakovlev 2017-06-17 13:18:49 +07:00
parent efe0844b50
commit eb847b7657
3 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/node_modules
/config.cson

2
config.cson.example Normal file
View file

@ -0,0 +1,2 @@
access_token: "your-token-here"
api_url: "https://botsin.space/api/v1/"

View file

@ -3,6 +3,13 @@ ImprovModel = require "./model"
fs = require 'fs'
CSON = require 'cson'
glob = require 'glob'
Masto = require 'mastodon'
config = CSON.parseCSONFile('config.cson')
Mastodon = new Masto({
access_token: config.access_token
api_url: config.api_url
})
files = glob.sync('data/*.cson')
spec = {}
@ -28,4 +35,7 @@ improv = new ImprovEngine(spec, {
})
model = new ImprovModel
console.log improv.gen('description', model).trim()
description = improv.gen('description', model).trim()
Mastodon.post('statuses', {
status: description
})