-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Данила Беляков
authored and
Данила Беляков
committed
Aug 18, 2024
1 parent
2f6bfc6
commit a764fef
Showing
10 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
package com.github.examples | ||
|
||
class Handlers { | ||
import com.github.alice.ktx.dispatch | ||
import com.github.alice.ktx.handlers.impl.buttonPressed | ||
import com.github.alice.ktx.handlers.impl.newSession | ||
import com.github.alice.ktx.models.button.button | ||
import com.github.alice.ktx.models.response.response | ||
import com.github.alice.ktx.server.impl.ktorWebServer | ||
import com.github.alice.ktx.skill | ||
|
||
/** | ||
* Демонстрация новых хендлеров [newSession], [buttonPressed] | ||
* */ | ||
fun main() { | ||
skill { | ||
webServer = ktorWebServer { | ||
port = 8080 | ||
path = "/alice" | ||
} | ||
dispatch { | ||
newSession { | ||
response { | ||
text = "Start" | ||
button { | ||
title = "Test" | ||
payload = mapOf("test" to "1") | ||
} | ||
} | ||
} | ||
|
||
buttonPressed({ payload["test"] == "1" }) { | ||
response { | ||
text = "Click" | ||
} | ||
} | ||
} | ||
}.run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters