update version and example of hello bot

This commit is contained in:
InsanusMokrassar 2020-07-02 16:37:12 +06:00
parent d9b42efc4a
commit df33e3ac38
3 changed files with 13 additions and 4 deletions

View File

@ -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()

5
build.gradle Normal file
View File

@ -0,0 +1,5 @@
allprojects {
repositories {
mavenLocal()
}
}

View File

@ -1,3 +1,3 @@
kotlin_version=1.3.72
telegram_bot_api_version=0.27.6
telegram_bot_api_version=0.27.8