withTyping

suspend fun <T : MessageChannelBehavior, R> T.withTyping(block: suspend T.() -> R): R(source)

Requests to trigger the typing indicator for the bot in this channel. The typing status will be refreshed until the block has been completed.

Returns the result of the block or rethrows its exception.

channel.withTyping {
delay(42.seconds) // some very long task
createMessage("done!")
}

Throws

if something went wrong during a type request.