Telegram Bot SDK v0.9.0 Release Notes

Release Date: 2016-06-27 // almost 8 years ago
  • Major changes:

    • Project ported to Swift 3.0 Snapshot 2016-06-20 (a). Xcode8 is required.

    • ๐Ÿ’Ž Types and Requests (methods) are now generated automatically from Telegram docs by a Ruby script located in API/ directory.

    • ๐Ÿ‘ All types and requests are now supported.

    • Optional parameters added to request signatures. This code:

    bot.sendMessage(chatId, "text", ["reply_markup": markup])
    

    Can now be written as:

    bot.sendMessage(chatId, "text", reply_markup: markup)
    

    You can still pass an array with additional arguments at the end of parameters list if needed.

    Other changes:

    • ๐Ÿ‘ Router now supports multiple comma separated paths:
    router["List Items", "list"] = onListItems
    
    • 0๏ธโƒฃ Router is now case insensitive by default.

    • ๐Ÿ‘ Multiword commands are now supported:

    router["list add"] = onListAdd
    router["list remove"] = onListRemove
    
    • ๐Ÿ‘ Router chaining is now supported. Use handler method to use Router as a handler:

    router1.unmatched = router2.handler

    • To force the use of slash, instead of slash: .required option use:
    router["command", .slashRequired] = handler
    

    Multiple flags can be specified:

    router["command", [.caseSensitive, .slashRequired]] = handler
    
    • context.args.command is now context.command.

    • ๐Ÿ†• New variable: context.slash. True, if command was prefixed with a slash.

    • router.unknownCommand handler renamed to router.unmatched

    • ๐Ÿ‘Œ Support callback_query in Router.

    • JsonObject protocol renamed to JsonConvertible.

    • Context.message is now optional. Also, it fallbacks to edited_message and callback_query.message when nil.

    • Unknown command handler will no longer treat the first word as a command and will pass the entire string to a handler unchanged. Context.command will be empty.

    • partialMatchHandler return value is now ignored. It can no longer cancel commands.

    • All types changed from classes to structs.

    • HTTP error codes except 401 (authentication error) are no longer fatal errors. TelegramBot will try to reconnect when encountering them.