- ➕ Added full support for Bot API 5.1 - 5.3
- 🛠 Fixed some dependencies.
- ➕ Added additional classes
- Added method
- 👀 More, see the official Bot API changelog for a complete list of changes.
- ➕ Added support for TDLight.
- ➕ Added
Client.newto support the TDLight user API.
- (breaking change) All arguments to
Client.neware now keyword arguments.
- (breaking change) Removed
asyncargument from event handlers. All events are now async by default. Async events can be disabled with the
UpdateHandlernow accepts an array of
UpdateAction, or a single one.
- 🛠 Fixed an issue where
pollalways deletes a set webhook. Now it will only delete the webhook if
🚀 Ok so this release removes the filters added several releases back. I didn't like how filters forced people to think and they weren't very Crystally in function. The main issue with them was trying to allow a developer to receive information about the update being filtered. I tried to solve this using
Update#context, but it was majorly limited and pretty messy.
🖐 So handlers are back and better than ever! I had initially gotten rid of handlers because I couldn't figure out a way to handle them that wasn't messy. In the initial revision each handler was its own class, but the annotation logic for the handler was contained in the base
EventHandlerclass. This made it hard to figure out an easy way for people to add their own handlers without also being able to modify the method within
EventHandlers::Annotatorthat handled the annotation logic.
⚡️ Well no more!
EventHandleris now a very simple abstract class that requires one method,
call(update : Update). If a subclass includes a
self.annotatemethod that method will be called when the client is initialized. There are also several new handlers that didn't exist before, based on the filters they replaced, including
InlineQueryHandler, and the standard
UpdateHandler. I highly recommend checking out the API docs on each of them.
⚡️ This update also brings
RoutedMenufor easy creation of menus using inline keyboards.
- Replace broken
Intin unions with
- 👉 Make
Helpers.random_stringactually return a random string, not just a number
- 🔄 Change the first run logic in
- Replace broken
⚡️ This is a pretty massive update, and there's way too much to go into here. Basically though, if I were to break this update down into a couple achievements this is what we have:
I, and others, were having some issues earlier on using the client in a concurrent environment. This is because the client was using a single
HTTP::Clientwhich was being shared between threads/fibers. When one fiber would finish it would close the connection, causing a very confusing stack trace that said nothing about what the root of the problem was.
🐎 After much testing and debugging I decided to add a connection pool, which is basically like a library of
HTTP::Clientinstances. The pool has a finite number of instances it can spawn, and starts with a limited number. When a request is made the client checks out a client, uses it, and then checks it back in to the pool. It's thread safe and works perfectly, at a very small cost to performance.
Another requested feature was proxy support. Unfortunately Crystal's
HTTP::Clientdoesn't support proxies itself, but thanks to mamantoha/http_proxy I was able to implement proxy support pretty easily. The
Clientinitializer now accepts several parameters for configuring the proxy as well.
👀 I added a convenience class for creating paginated inline keyboards called
PagedInlineKeyboard. You can see it in action in the pagination bot example.
Last, but certainly not least, I have finally managed to implement some form of state management in the form of a
Stage. It's not perfect, but you can now have "conversations" with your bot in which you collect information and do something with it.
👀 You can see an example of a
Stagein action in the stage bot example, which I've tried to document very well.
- ➕ Added ameba checks
- Replaced Halite with
HTTP::Client, resulting in a major speed boost
handle_errorin favor of
Updated to bot API 4.8, including the support for the new darts animation
⚡️ 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,
Persistencewas 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
Persistenceis a class and
Clientwill always have one. The default persistence is
NilPersistencewhich does nothing. This can be easily swapped out for one of the other persistence types by passing the desired persistence object to the
👍 I've also added
DBPersistencewhich 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.
- ➕ Add CHANGELOG
- ➕ Add support for Filters.
- ➕ Add
Messageto return all users included in the same.
- 🌲 Replaced usage of the
strangelogger with the new Crystal
- ⚡️ Log all updates with
VERBOSEenvironment variable is set to
- (breaking change) Renamed
TFileto avoid conflicting with the builtin
- (breaking change) removed the
Handlerclass and all subclasses. Update handling is now done exclusively with the
🚀 So I made a small mistake in an earlier revision which was causing
Onevents to be fired by every event type, which was obviously a problem. This release fixes that.