Created
May 29, 2017 13:53
-
-
Save jeffreyolchovy/744966a1e8c9fa14369359a3daeab46b to your computer and use it in GitHub Desktop.
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
// The one input task that will be available to our plugin users, by default | |
tweeterTweet := { | |
val log = streams.value.log | |
val tweet = spaceDelimited("<text of tweet>").parsed.mkString(" ") | |
val consumerKey = tweeterConsumerKey.value | |
val consumerSecret = tweeterConsumerSecret.value | |
val accessToken = tweeterAccessToken.value | |
val accessTokenSecret = tweeterAccessTokenSecret.value | |
val client = TweeterService(consumerKey, consumerSecret, accessToken, accessTokenSecret) | |
client.post(tweet) match { | |
case Success(tweetId) => log.info(s"""Successfully tweeted: "$tweet" ($tweetId)"""); tweetId | |
case Failure(e) => sys.error("An error was encountered when trying to tweet: " + ErrorHandling.reducedToString(e)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment