Skip to content

v0.5

Compare
Choose a tag to compare
@snejugal snejugal released this 18 Mar 04:24
· 644 commits to master since this release

We're happy to announce the release of tbot v0.5!

In this version, tbot has gained support for Bot API v4.6 (#26). This means that
you can now make use of Polls 2.0, as well as get more information about your
bot and the language of code blocks. Unfortunately, this led to a few breaking
changes:

  • The GetMe method now returns a new struct, types::user::Me, which is
    composed of the fields only returned by GetMe and the user field,
    containing the information which is present in all instances of the User
    type;
  • We fixed a bug regarding reply buttons: though type fields of ReplyButton
    are mutually exclusive, tbot didn't prevent one from setting both types at
    the same time. This was fixed in !158, but it did introduce a breaking change.
    Now, all request types are contained in one enum, which you pass to the
    request setter of a reply::Button instance.
  • To support language tags, we had to change the message::entity::Kind::Pre
    variant from a unit one to a tuple. But this one is easy to figure out 😉

Thanks to @uwinx, you can now easily add a handler for several commands using
EventLoop::commands (and edited_commands in case you're interested in this
one) (!161):

let mut bot = tbot::from_env!(..).event_loop();
bot.commands(["start", "help"], |context| { .. });

This version also introduces the Command context, which wraps the underlying
text update, but it also provides you with the command which triggered the
handler. But note that all command handlers now receive the new context, so you
may have to change a few typed out command context types if you ever did so. But
Command dereferences to the underlying context and implements the appropriate
traits, so migrating to the new context won't be hard.

And the last change in this version is this small improvement (!167): if your
bot receives an edited message with an attachment one can't usually edit, you'll
see the update in tbot's message.

We hope you'll like this update! And by the way, we now have
a website, check it out :)