Improved keyboards and persistence
This update includes a lot of good stuff. First and foremost are the improvements to building inline and reply keyboards. The old method was based heavily off of TelegrafJS and it worked, but the new way is much more "Crystally". Here's an example of it in action:
keyboard = Tourmaline::ReplyKeyboardMarkup.build do
button "Info"
button "Visit Us"
end
also included in this update are changes to how persistence works. I wasn't a fan of how I was handling things before, but now I think things are much better. Prior to this update, Persistence
was a module which was included in each persistence type which would then be included in the final client. Nothing wrong with this approach, but it did make it so that information could not be easily passed to the Persistence
object.
Now Persistence
is a class and Client
will always have one. The default persistence is NilPersistence
which does nothing. This can be easily swapped out for one of the other persistence types by passing the desired persistence object to the Client
initializer.
I've also added DBPersistence
which allows you to persist Users and Chats using a database rather than just a Hash or a JSON file. It uses the db shard on the backend and can be used with any of the supported adapters.