botodon/src/tools/action/add.ts

18 lines
521 B
TypeScript
Raw Normal View History

2019-06-14 15:10:20 +00:00
import { rest, rootStatus } from '../../prepare'
import Logger from '../../utils/Logger'
async function run() {
2019-06-14 15:30:54 +00:00
const [,,content, visibility] = process.argv
2019-06-14 15:10:20 +00:00
if (!content) {
Logger.error('require content')
return
}
Logger.info(`adding action: "${content}"`)
const status = await rest.postStatus({
in_reply_to_id: rootStatus,
status: content,
2019-06-14 15:30:54 +00:00
visibility: visibility as any || 'direct'
2019-06-14 15:10:20 +00:00
})
Logger.info('action added', { id: status.id, tags: status.tags.map(t => t.name).reverse() })
}
run()