Skip to content

Commit

Permalink
Random searching messages (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchristov committed Feb 18, 2024
1 parent e0cf723 commit 16e40ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 0 additions & 5 deletions modules.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
includeBuild("gradle-plugins")
include("common")
include("common:pubsub")
include("common:pubsub-testfixtures")
include("common:test")
Expand All @@ -8,9 +7,7 @@ include("common:network-testfixtures")
include("common:kotlin")
include("common:firebase")
include("common:monitoring")
include("landing-page")
include("landing-page:service")
include("search")
include("search:adapter")
include("search:domain")
include("search:proto")
Expand All @@ -20,12 +17,10 @@ include("self-destruct:adapter")
include("self-destruct:domain")
include("self-destruct:proto")
include("self-destruct:service")
include("slack")
include("slack:adapter")
include("slack:domain")
include("slack:proto")
include("slack:service")
include("statistics")
include("statistics:adapter")
include("statistics:domain")
include("statistics:proto")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SlackSlashCommandPubSubHandler(
*/
private suspend fun PubSubSlackSlashCommandMessage.handle() = slackRepository.postMessageToUrl(
url = responseUrl,
message = slackMessageFactory.message("🔎 Hang tight, we're finding your GIF...")
message = slackMessageFactory.searchingMessage(),
)
.flatMap { slackSearchRepository.search(text) }
.fold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface SlackMessageFactory {
attachments: List<SlackMessage.Attachment>? = null,
): SlackMessage

fun searchingMessage(): SlackMessage

fun cancelMessage(): SlackMessage

fun searchResultMessage(
Expand Down Expand Up @@ -78,6 +80,8 @@ internal class RealSlackMessageFactory(
attachments = attachments,
)

override fun searchingMessage() = message(randomSearchingMessage())

override fun cancelMessage() = message(deleteOriginal = true)

override fun searchResultMessage(
Expand Down Expand Up @@ -224,5 +228,13 @@ internal class RealSlackMessageFactory(
private const val ActionStylePrimary = "primary"

private const val PostedUsingFooter = "Posted using /codinglove"

private fun randomSearchingMessage() = listOf(
"\uD83D\uDD75\uFE0F\u200D♀\uFE0F Hang tight, we're finding your GIF...",
"\uD83E\uDDD0 Keep calm, we're on the hunt for your GIF...",
"\uD83D\uDD0D Hold on, we're in pursuit of your GIF...",
"\uD83D\uDD75\uFE0F\u200D♂\uFE0F Don't fret, we're locating your GIF...",
"\uD83D\uDE80 Stay patient, we're rocketing to find your GIF...",
).random()
}
}

0 comments on commit 16e40ed

Please sign in to comment.