mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
Merge pull request #485 from madhead/feature/possibly-reply-casts
PossiblyReplyMessage casts
This commit is contained in:
commit
5b13d3dded
1
.github/workflows/label.yml
vendored
1
.github/workflows/label.yml
vendored
@ -12,6 +12,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
triage:
|
triage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.actor == github.repository_owner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/labeler@v2
|
- uses: actions/labeler@v2
|
||||||
with:
|
with:
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
* Two new dsl:
|
* Two new dsl:
|
||||||
* `inlineKeyboard` for creating `InlineKeyboardMarkup`
|
* `inlineKeyboard` for creating `InlineKeyboardMarkup`
|
||||||
* `replyKeyboard` for creating `ReplyKeyboardMarkup`
|
* `replyKeyboard` for creating `ReplyKeyboardMarkup`
|
||||||
|
* Cast helpers for `Message`:
|
||||||
|
* `asPossiblyReplyMessage`: tries to cast a `Message` to `PossiblyReplyMessage`, returns `null` if the message is not of that type
|
||||||
|
* `requirePossiblyReplyMessage`: casts a `Message` to `PossiblyReplyMessage`, fails if the message is not of that type
|
||||||
|
* `whenPossiblyReplyMessage`: tries to cast a `Message` to `PossiblyReplyMessage` and runs the given block of code with it, if the cast is successful
|
||||||
* `Behaviour Builder`:
|
* `Behaviour Builder`:
|
||||||
* New expecters and waiters:
|
* New expecters and waiters:
|
||||||
* `waitShippingQueries`/`onShippingQuery`
|
* `waitShippingQueries`/`onShippingQuery`
|
||||||
|
@ -1132,6 +1132,15 @@ inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as?
|
|||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
|
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun <T> Message.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) = asPossiblyReplyMessage() ?.let(block)
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun Message.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun Message.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) = asPossiblyForwardedMessage() ?.let(block)
|
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) = asPossiblyForwardedMessage() ?.let(block)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user