This content is protected against AI scraping.
I’ve released an initial beta of #MastoBot to #npm.
MastoBot is a #JavaScript client library for #Mastodon. It offers 3 levels of helpers to communicate with a Mastodon instance.
`MastoBotHttp` is the basic helper class; it offers wrappers to make authenticated http requests, with a consistent api and return shape. It wraps Get, Post, Put, Patch, and Delete.
`MastoBotAPI` is the next level. It extends the Http library with wrapper methods for api endpoints. These methods are designed with a consistent signature, `. helperFunction(requiredParam1, requiredParam2, { optionalParams})`, and return the same result shape as the Http methods.
`MastoBot` is to be the smartest wrapper. It extends `MastoBotAPI` with more complex helper functions, eg. `postMediaStatus( status, arrayOfFiles)`. These helpers will generally return an object shape specific to the function, but I plan to include relevant http responses as part of the result.
I also plan callback-based processors for feeds, so you have eg. `processNotifications({ onMention, onFollow }) ;` and the framework will pass each result to the appropriate handler – I think that’ll be the really exciting bit for bot builders.
I’m dogfooding MastoBot with a bit of silliness at @multiverse@botsin.space. It’s currently using the MastoBotAPI methods, but I’ll integrate smart features as I implement them.
Documentation is still sorely lacking; to make the best use of MastoBot you’ll still need to make good friends with the api docs at https://docs.joinmastodon.org/client/intro/
To start using it, you can install it from npm with `npm i mastobot@beta`, and you can follow or join in on development at https://gitlab.com/eroosenmaallen/mastobot