Instantly share code, notes, and snippets.

Embed
What would you like to do?
daab-kt の動かせる構造など
package com.example
import com.lisb.daab.ActionResponse
import com.lisb.daab.Response
import com.lisb.daab.Robot
import com.lisb.daab.TextMessage
import com.lisb.daab.message.QuestionAfterMessageHandler
import com.lisb.daab.message.QuestionSent
import com.lisb.daab.message.Stamp
import com.lisb.daab.receive.Receive
import kotlin.js.RegExp
val application: (Robot) -> Unit = {robot: Robot ->
robot.hear(RegExp("PING", "i"), sendPong)
robot.respond(Receive.Stamp) { res: ActionResponse<Stamp> ->
println(res.json)
}
}
val sendPong: (Response<TextMessage>) -> Unit = { res: Response<TextMessage> ->
println(res.message.text)
res.send("pong")
res.send(QuestionAfterMessageHandler(question = "もふもふ", onSend = { sent: QuestionSent ->
println(sent)
println(sent)
}))
}
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath "com.lisb.daab:gradle-daab-plugin:${daabPluginVersion}"
}
}
apply plugin: 'daab-kt'
repositories {
mavenLocal()
}
dependencies {
compile "com.lisb.daab:daab-kt:${daabPluginVersion}"
}
daab {
mainPackage 'com.example'
appName 'application'
}
{
"name": "starter",
"version": "0.3.6",
"private": true,
"author": "L is B corp.",
"keywords": [
"hubot",
"direct",
"bot",
"daab"
],
"description": "A simple helpful robot for your Company",
"dependencies": {
"kotlin": "^1.1.3-2",
"lisb-hubot": "^2.16.0",
"lisb-hubot-redis-brain": "^0.0.3",
"lisb-forever": "^0.15.3"
},
"engines": {
"node": ">= 0.8.x",
"npm": ">= 1.1.x"
}
}
local-dev/
├── build.gradle
├── daab
│   ├── Berksfile
│   ├── Dockerfile
│   ├── LICENSE
│   ├── Procfile
│   ├── README.md
│   ├── Vagrantfile
│   ├── external-scripts.json
│   ├── hubot-err.log
│   ├── hubot.log
│   ├── package-lock.json
│   ├── package.json
│   └── scripts
│      ├── app.js
│      └── lib
│      ├── application
│      │   └── com
│      │   └── example
│      │   └── example.kjsm
│      ├── application.js
│      ├── application.js.map
│      ├── application.meta.js
│      └── daab-kt-js-binding.js
├── echo-path.sh
└── src
└── main
└── kotlin
└── com
└── example
└── App.kt
@mike-neck

This comment has been minimized.

Owner

mike-neck commented Jul 17, 2018

多分 daab-kt-js-binding.js を書き込む処理を書かないと動かないと思われる

@mike-neck

This comment has been minimized.

Owner

mike-neck commented Jul 17, 2018

処理が今の所見当たらない

@mike-neck

This comment has been minimized.

Owner

mike-neck commented Jul 18, 2018

daab-kt.js が見つからないらしい

@mike-neck

This comment has been minimized.

Owner

mike-neck commented Jul 18, 2018

Configuration.kt の 78 行目

            .also { it.executable = daab.executable }

が間違えてるので、修正する

@mike-neck

This comment has been minimized.

Owner

mike-neck commented Jul 18, 2018

daab-kt-js-bindings.js の読み込みを require('./daab-kt-js-bindings') としないと読み込めないっぽい

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment