popodidi/Slackbot


Slack bot in Swift with Vapor framework

License: MIT

Language: Swift


Slackbot 🤖

Slackbot is a project that could easily customize the response of a bot, utilizing Swift with Vapor framework.

Feel free to open any issue or pull request.

Environment

  • Xcode 8 beta 2
    • Toolchain : Xcode 8.0
  • Swift version
$ swift --version
Apple Swift version 3.0 (swiftlang-800.0.33.1 clang-800.0.31)
Target: x86_64-apple-macosx10.9
  • Vapor toolbox 0.7.0
    Vapor provides a command toolbox to run vapor apps. Check out the official document to get more details.

Get started

Clone

$ git clone https://github.com/popodidi/Slackbot

Build

$ cd Slackbot
$ vapor build

if $ vapor build doesn't work, try this one

$ swift build

Generate .xcodeproj (optional but recommended)

$ swift package generate-xcodeproj
$ open Slackbot.xcodeproj

Set bot token

Create a bot to get a token if you don't have one. Set it up in /App/Config.swift

import Foundation

struct Slack {
    struct Config {
        // set your bot token here
        static let BotToken = "----Your Bot Token----"
        static let SimpleLatest = true
        static let NoUnreads = true
    }
}

Run

Xcode

Choose App scheme and press Run button

Make sure you're using Xcode 8.0 toolchain in Xcode 8.0 beta 2

Terminal (Vapor toolbox)

$ vapor run

Terminal

$ .build/debug/App

Customize response

Check out /App/MyResponseHandler and follow the instructions written in comments to override the functions.

For example, if you want to respond to a specific message, "how are you?".

override func response(toMessage text: String) -> String{
    if text == "how are you?"{
        return "I'm good"
    }else{
        return "Sorry, my response is limited."
    }
}

License

Slackbot is freely distributable under the terms of the MIT license.

Project Statistics

Sourcerank 3
Repository Size 22.5 KB
Stars 0
Forks 0
Watchers 1
Open issues 0
Dependencies 2
Contributors 12
Tags 0
Created
Last updated
Last pushed

Top Contributors See all

Tanner Shaun Harrison Marcus Kida Logan Wright Hao Matthew Clarkson James Richard Jonathan Channon Kevin Vitale Adrien Cantérot Ross LeBeau Ali Abouzahr

Packages Referencing this Repo

github.com/popodidi/Slackbot
Slack bot in Swift with Vapor framework
Latest release - Published

Something wrong with this page? Make a suggestion

Last synced: 2016-07-20 12:55:37 UTC

Login to resync this repository