From df33e3ac38b3757049310f0d11bdf20142d2046c Mon Sep 17 00:00:00 2001
From: InsanusMokrassar <ovsyannikov.alexey95@gmail.com>
Date: Thu, 2 Jul 2020 16:37:12 +0600
Subject: [PATCH] update version and example of hello bot

---
 HelloBot/src/main/kotlin/HelloBot.kt | 10 +++++++---
 build.gradle                         |  5 +++++
 gradle.properties                    |  2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)
 create mode 100644 build.gradle

diff --git a/HelloBot/src/main/kotlin/HelloBot.kt b/HelloBot/src/main/kotlin/HelloBot.kt
index 968ee1c..9651fb0 100644
--- a/HelloBot/src/main/kotlin/HelloBot.kt
+++ b/HelloBot/src/main/kotlin/HelloBot.kt
@@ -36,14 +36,18 @@ suspend fun main(vararg args: String) {
                     is GroupChat -> bot.getChat(chat).inviteLink ?.let {
                         chat.title.linkMarkdownV2(it)
                     } ?: chat.title
-                    is ChannelChat -> (chat.username ?.username ?: bot.getChat(chat).inviteLink) ?.let {
-                        chat.title.linkMarkdownV2(it)
-                    } ?: chat.title
                     else -> "Unknown :(".escapeMarkdownV2Common()
                 }
                 bot.sendTextMessage(chat, message, MarkdownV2)
             }
         }.launchIn(scope)
+        channelPostFlow.onEach {
+            safely {
+                val chat = it.data.chat
+                val message = "Hi everybody in this channel \"${(chat as ChannelChat).title}\""
+                bot.sendTextMessage(chat, message, MarkdownV2)
+            }
+        }.launchIn(scope)
     }
 
     scope.coroutineContext[Job]!!.join()
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..20f4210
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,5 @@
+allprojects {
+    repositories {
+        mavenLocal()
+    }
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 3de8887..7aaae27 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,3 @@
 kotlin_version=1.3.72
 
-telegram_bot_api_version=0.27.6
+telegram_bot_api_version=0.27.8