No description, website, or topics provided.
Swift Ruby Objective-C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Barnabot.xcodeproj
Barnabot
BarnabotTests
fastlane
.gitignore
.travis.yml
Barnabot.podspec
Gemfile
LICENSE
README.md

README.md

Build Status

BarnaBot

A local bot written in Swift for awesome user interactions!
Inspired by the Microsoft Bot Framework

Simple declaration

    var botBuilder = BBBuilder("Barnabot")
    var botSession = BBSession.sharedInstance
    botSession.delegate = self

    botBuilder
        .dialog(path: "/", [{(session : BBSession) -> Void in
            if let name = session.getUserData("name") {
                session.next()
            } else {
                session.beginDialog("/profile")
            }
        },
        {(session : BBSession) -> Void in
            if let name = session.getUserData("name") {
                session.send("Hello \(name)!")
            }
            session.endDialog()
        }])
        .dialog(path "/profile", [{(session : BBSession) -> Void in
            session.promptText("What's your name?")
        },{(session : BBSession) -> Void in
            session.saveUserData(value: session.result, forKey: "name").endDialog()
        }])

    botSession.beginConversation()

Intents support

  botBuilder
    .matches("^help$", priority: 0, redir: "/help")
    .matches("^bonjour", priority: 0, [{(session : BBSession) -> Void in
      session.send("I'm glad to see u back")
      session.promptText("How are you today?")
    },{(session : BBSession) -> Void in
      session.saveUserData(value: session.result, forKey: "mood").endDialog()
    }])