Skip to content

Instantly share code, notes, and snippets.

@ryanpbrewster
Created May 10, 2016 18:03
Show Gist options
  • Select an option

  • Save ryanpbrewster/d37e3022cd906024fe512b39a97a79e5 to your computer and use it in GitHub Desktop.

Select an option

Save ryanpbrewster/d37e3022cd906024fe512b39a97a79e5 to your computer and use it in GitHub Desktop.
import SlackErrorCode._
def tryToUpdateMessage(token: SlackAccessToken, channel: SlackChannelId, ts: SlackTimestamp, newText: String): Future[Unit] = {
val updateRequest = SlackMessageUpdateRequest(
text = newText,
attachments = Seq.empty,
unfurlLinks = false,
unfurlMedia = false,
parseMode = "none"
)
slackClient.updateMessage(token, channel, ts, updateRequest)
.map { _ => () }
.recover { case SlackErrorCode(CANT_UPDATE_MESSAGE) => () }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment