Created
March 6, 2020 08:08
-
-
Save seratch/9fa8980b9469993d03a5503053a26bf0 to your computer and use it in GitHub Desktop.
Bolt for Java 1.0.0-RC1
This file contains hidden or 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
| plugins { | |
| id("application") | |
| } | |
| java { | |
| sourceCompatibility = JavaVersion.VERSION_11 | |
| targetCompatibility = JavaVersion.VERSION_11 | |
| } | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| implementation("com.slack.api:bolt:1.0.0-RC1") | |
| implementation("com.slack.api:bolt-jetty:1.0.0-RC1") | |
| implementation("org.slf4j:slf4j-simple:1.7.30") | |
| } | |
| application { | |
| mainClassName = "hello.MyApp" | |
| } | |
| run { | |
| // gradle run -DslackLogLevel=debug | |
| systemProperty "org.slf4j.simpleLogger.log.com.slack.api", System.getProperty("slackLogLevel") | |
| } |
This file contains hidden or 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
| package hello; | |
| import com.slack.api.bolt.App; | |
| import com.slack.api.bolt.jetty.SlackAppServer; | |
| public class MyApp { | |
| public static void main(String[] args) throws Exception { | |
| var app = new App(); | |
| app.message("Are you ready?", (req, ctx) -> { | |
| var mesage = "<@" + req.getEvent().getUser() + "> Let's go!"; | |
| var result = ctx.say(mesage); | |
| ctx.logger.info("result: {}", result); | |
| return ctx.ack(); | |
| }); | |
| var server = new SlackAppServer(app); | |
| server.start(); // http://localhost:3000/slack/events | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment