mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2026-10-25 13:37:06 +00:00
update version and example of hello bot
This commit is contained in:
1 parent
d9b42efc4a
commit
df33e3ac38
3 files changed
+13
-4
No files matched your search
@@ -36,14 +36,18 @@ suspend fun main(vararg args: String) {
|
|||||||
is GroupChat -> bot.getChat(chat).inviteLink ?.let {
|
is GroupChat -> bot.getChat(chat).inviteLink ?.let {
|
||||||
chat.title.linkMarkdownV2(it)
|
chat.title.linkMarkdownV2(it)
|
||||||
} ?: chat.title
|
} ?: chat.title
|
||||||
is ChannelChat -> (chat.username ?.username ?: bot.getChat(chat).inviteLink) ?.let {
|
|
||||||
chat.title.linkMarkdownV2(it)
|
|
||||||
} ?: chat.title
|
|
||||||
else -> "Unknown :(".escapeMarkdownV2Common()
|
else -> "Unknown :(".escapeMarkdownV2Common()
|
||||||
}
|
}
|
||||||
bot.sendTextMessage(chat, message, MarkdownV2)
|
bot.sendTextMessage(chat, message, MarkdownV2)
|
||||||
}
|
}
|
||||||
}.launchIn(scope)
|
}.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()
|
scope.coroutineContext[Job]!!.join()
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
kotlin_version=1.3.72
|
kotlin_version=1.3.72
|
||||||
|
|
||||||
telegram_bot_api_version=0.27.6
|
telegram_bot_api_version=0.27.8
|
||||||
Reference in new issue
Block a user