diff --git a/bot/src/main/kotlin/io/heapy/kotbot/bot/command/Commands.kt b/bot/src/main/kotlin/io/heapy/kotbot/bot/command/Commands.kt index d350843..18cdca2 100644 --- a/bot/src/main/kotlin/io/heapy/kotbot/bot/command/Commands.kt +++ b/bot/src/main/kotlin/io/heapy/kotbot/bot/command/Commands.kt @@ -72,3 +72,24 @@ class HelloWorldCommand( ) } } + +class ChatInfoCommand( + override val info: Info = INFO +) : Command { + override fun execute(update: Update, args: List): Flow { + return flowOf(ReplyAction( + chatId = update.message.chatId, + message = """ + Chat id: ${update.message.chatId} + """.trimIndent() + )) + } + + companion object { + private val INFO = CommandInfo( + name = "!chat-info", + context = Context.GROUP_CHAT, + access = Access.ADMIN + ) + } +} diff --git a/src/main/kotlin/io/heapy/kotbot/Application.kt b/src/main/kotlin/io/heapy/kotbot/Application.kt index 1c27004..5e77d13 100644 --- a/src/main/kotlin/io/heapy/kotbot/Application.kt +++ b/src/main/kotlin/io/heapy/kotbot/Application.kt @@ -4,6 +4,7 @@ import com.typesafe.config.ConfigFactory import io.github.config4k.extract import io.heapy.kotbot.bot.KotBot import io.heapy.kotbot.bot.command.HelloWorldCommand +import io.heapy.kotbot.bot.command.ChatInfoCommand import io.heapy.kotbot.bot.rule.CombotCasRule import io.heapy.kotbot.bot.rule.DeleteHelloRule import io.heapy.kotbot.bot.rule.DeleteJoinRule @@ -48,7 +49,8 @@ object Application { CombotCasRule(client, configuration.cas) ) val commands = listOf( - HelloWorldCommand() + HelloWorldCommand(), + ChatInfoCommand() ) startServer(