subscribe
inline fun <T> Bot.subscribe(name: String? = null, sequence: SubscribeSequence = SubscribeSequence.NORMAL, crossinline processor: suspend (Event, T) -> Unit)(source)
Bot.subscribe simplified extension. Matches events based on type T (and optional name).
Note: If the matched type does not match the name, the result may never be matched.
bot.subscribe<Message> { event: Event, content: Message ->
// ...
}
bot.subscribe<Message>("edited_message", sequence = ...) { event: Event, event: Message ->
// ...
}
bot.subscribe<Message>(UpdateValues.EDITED_MESSAGE_NAME, sequence = ...) { event: Event, event: Message ->
// ...
}
Content copied to clipboard