From fccd38235807771db9b31f85ef2114dd8f4c3260 Mon Sep 17 00:00:00 2001 From: MarianKijewski Date: Sat, 17 Jan 2026 16:01:03 +0100 Subject: [PATCH 1/3] add "github" prefix to the "help" command to ensure uniqueness --- src/main/kotlin/com/wire/github/EventsHandler.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/wire/github/EventsHandler.kt b/src/main/kotlin/com/wire/github/EventsHandler.kt index 209f1e2..68ff04a 100644 --- a/src/main/kotlin/com/wire/github/EventsHandler.kt +++ b/src/main/kotlin/com/wire/github/EventsHandler.kt @@ -18,7 +18,7 @@ class EventsHandler : WireEventsHandlerSuspending() { private val storage = redisConnection.sync() override suspend fun onTextMessageReceived(wireMessage: WireMessage.Text) { - if (wireMessage.text.equals("/help", ignoreCase = true)) { + if (wireMessage.text.equals(HELP_COMMAND, ignoreCase = true)) { logger.info( "Event received. Event: TextMessageReceived (HELP command), " + "conversationId: ${wireMessage.conversationId}, " + @@ -97,5 +97,6 @@ class EventsHandler : WireEventsHandlerSuspending() { private companion object { const val HOST_URL_PATTERN = "%s/%s/%s" + const val HELP_COMMAND = "/github help" } } From e7f259e252d52d10f01c7884814578e3d56a4f52 Mon Sep 17 00:00:00 2001 From: MarianKijewski Date: Sat, 17 Jan 2026 16:46:23 +0100 Subject: [PATCH 2/3] apply common welcome message structure --- .../kotlin/com/wire/github/EventsHandler.kt | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/wire/github/EventsHandler.kt b/src/main/kotlin/com/wire/github/EventsHandler.kt index 68ff04a..f178d8d 100644 --- a/src/main/kotlin/com/wire/github/EventsHandler.kt +++ b/src/main/kotlin/com/wire/github/EventsHandler.kt @@ -24,7 +24,7 @@ class EventsHandler : WireEventsHandlerSuspending() { "conversationId: ${wireMessage.conversationId}, " + "senderId: ${wireMessage.sender}" ) - val message = formatHelp( + val message = formatSetupInstructions( conversationId = wireMessage.conversationId, secret = storage.get(wireMessage.conversationId.toStorageKey()) ) @@ -50,7 +50,12 @@ class EventsHandler : WireEventsHandlerSuspending() { "Event received. Event: AppAddedToConversation, " + "conversationId: ${conversation.id}" ) - val message = formatHelp(conversationId = conversation.id) + val message = buildString { + appendLine(WELCOME_TEXT) + appendLine(formatSetupInstructions(conversationId = conversation.id)) + appendLine() + append("Use the `$HELP_COMMAND` to see this message again.") + } manager.sendMessage( message = WireMessage.Text.create( @@ -64,7 +69,7 @@ class EventsHandler : WireEventsHandlerSuspending() { ) } - private fun formatHelp( + private fun formatSetupInstructions( conversationId: QualifiedId, secret: String? = null ): String { @@ -81,8 +86,8 @@ class EventsHandler : WireEventsHandlerSuspending() { conversationId.domain ) - val message = String.format( - "Hi, I'm GitHub App. Here is how to set me up:\n\n" + + val setupInstructions = String.format( + "Here is how to set me up:\n\n" + "1. Go to the repository that you would like to connect to\n" + "2. Go to **Settings / Webhooks / Add webhook**\n" + "3. Add **Payload URL**: %s\n" + @@ -92,11 +97,17 @@ class EventsHandler : WireEventsHandlerSuspending() { generatedSecret ) - return message + return setupInstructions } private companion object { const val HOST_URL_PATTERN = "%s/%s/%s" + + const val WELCOME_TEXT = + "👋 Hi, I'm GitHub App. Thanks for adding me to the conversation.\n" + + "You can use me to receive GitHub notifications in Wire.\n" + + "I'm here to help make everyday work a little easier." + const val HELP_COMMAND = "/github help" } } From 4639be94a81b6737bae06b466a547804475cce71 Mon Sep 17 00:00:00 2001 From: MarianKijewski Date: Sun, 18 Jan 2026 16:04:12 +0100 Subject: [PATCH 3/3] specify that `/github help` is command --- src/main/kotlin/com/wire/github/EventsHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/wire/github/EventsHandler.kt b/src/main/kotlin/com/wire/github/EventsHandler.kt index f178d8d..7816463 100644 --- a/src/main/kotlin/com/wire/github/EventsHandler.kt +++ b/src/main/kotlin/com/wire/github/EventsHandler.kt @@ -54,7 +54,7 @@ class EventsHandler : WireEventsHandlerSuspending() { appendLine(WELCOME_TEXT) appendLine(formatSetupInstructions(conversationId = conversation.id)) appendLine() - append("Use the `$HELP_COMMAND` to see this message again.") + append("Use the `$HELP_COMMAND` command to see the usage again.") } manager.sendMessage(