Telegram Bot SDK v0.10.0 Release Notes

Release Date: 2016-07-03 // almost 8 years ago
    • โž• Added Examples/shopster-bot: a sample bot which maintains a shopping list using sqlite3 database. GRDB library is used for working with database. This bot allows creating shared shopping lists in group chats.

    • ๐Ÿ“œ Callback query data used in InlineButtons can now be parsed similarly to plaintext commands using arguments scanner. Simply call context.args.scanWord() to fetch a word from callback data and so on.

    • Router path .callback_query now accepts nil: callback_query(data: nil). Pass nil to match any data, then parse it in handler using arguments scanner.

    • ๐Ÿ‘ Router now supports context-sensitive user properties. Pass them to process method:

    var properties = [String: AnyObject]()
    properties["myField"] = myValue
    try router.process(update: update, properties: properties)
    

    And use them in handlers:

    func myHandler(context: Context) -> Bool {
        let myValue = context.properties["myField"] as? MyValueType
        // ...
    }
    

    Or make a Context category for easier access to your properties, for example:

    extension Context {
        var session: Session { return properties["session"] as! Session }
    }
    
    • โž• Added scanInt64() to arguments scanner.

    • readToken("filename or env var") is now readToken(from: "filename or env var")