mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
add choose_sticker
This commit is contained in:
parent
4715eb424f
commit
a76a7ae630
@ -100,3 +100,7 @@ suspend fun TelegramBot.sendActionUploadVideoNote(
|
|||||||
chat: Chat
|
chat: Chat
|
||||||
) = sendBotAction(chat, UploadVideoNoteAction)
|
) = sendBotAction(chat, UploadVideoNoteAction)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.sendActionChooseStickerAction(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, ChooseStickerAction)
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: ChatId, block: Tele
|
|||||||
suspend fun <T> TelegramBot.withFindLocationAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, FindLocationAction, block)
|
suspend fun <T> TelegramBot.withFindLocationAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, FindLocationAction, block)
|
||||||
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoNoteAction, block)
|
||||||
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoNoteAction, block)
|
||||||
|
suspend fun <T> TelegramBot.withChooseStickerAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, ChooseStickerAction, block)
|
||||||
|
|
||||||
|
|
||||||
suspend fun <T> TelegramBot.withTypingAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, TypingAction, block)
|
suspend fun <T> TelegramBot.withTypingAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, TypingAction, block)
|
||||||
@ -71,3 +72,4 @@ suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, block: Telegram
|
|||||||
suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, FindLocationAction, block)
|
suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, FindLocationAction, block)
|
||||||
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoNoteAction, block)
|
||||||
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoNoteAction, block)
|
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoNoteAction, block)
|
||||||
|
suspend fun <T> TelegramBot.withChooseStickerAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, ChooseStickerAction, block)
|
||||||
|
@ -36,6 +36,7 @@ object BotActionSerializer: KSerializer<BotAction> {
|
|||||||
FindLocationAction.actionName -> FindLocationAction
|
FindLocationAction.actionName -> FindLocationAction
|
||||||
RecordVideoNoteAction.actionName -> RecordVideoNoteAction
|
RecordVideoNoteAction.actionName -> RecordVideoNoteAction
|
||||||
UploadVideoNoteAction.actionName -> UploadVideoNoteAction
|
UploadVideoNoteAction.actionName -> UploadVideoNoteAction
|
||||||
|
ChooseStickerAction.actionName -> ChooseStickerAction
|
||||||
else -> CustomBotAction(actionName)
|
else -> CustomBotAction(actionName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,6 +152,17 @@ inline val uploadVideoNote
|
|||||||
get() = UploadVideoNoteAction
|
get() = UploadVideoNoteAction
|
||||||
inline fun BotAction.asUploadVideoNote() = this as? UploadVideoNoteAction
|
inline fun BotAction.asUploadVideoNote() = this as? UploadVideoNoteAction
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will notify user that bot is uploading video note
|
||||||
|
*/
|
||||||
|
@Serializable(BotActionSerializer::class)
|
||||||
|
object ChooseStickerAction : BotAction {
|
||||||
|
override val actionName: String = "choose_sticker"
|
||||||
|
}
|
||||||
|
inline val chooseSticker
|
||||||
|
get() = ChooseStickerAction
|
||||||
|
inline fun BotAction.asChooseStickerAction() = this as? ChooseStickerAction
|
||||||
|
|
||||||
@Serializable(BotActionSerializer::class)
|
@Serializable(BotActionSerializer::class)
|
||||||
@Warning("Use this action only in case you are pretty sure that there are no other action for your needs")
|
@Warning("Use this action only in case you are pretty sure that there are no other action for your needs")
|
||||||
class CustomBotAction @RiskFeature("Usage of this action may lead to errors") constructor(
|
class CustomBotAction @RiskFeature("Usage of this action may lead to errors") constructor(
|
||||||
|
@ -1274,6 +1274,15 @@ inline fun BotAction.asTypingAction(): TypingAction? = this as? TypingAction
|
|||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun BotAction.requireTypingAction(): TypingAction = this as TypingAction
|
inline fun BotAction.requireTypingAction(): TypingAction = this as TypingAction
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun <T> BotAction.whenChooseStickerAction(block: (ChooseStickerAction) -> T) = asChooseStickerAction() ?.let(block)
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun BotAction.asChooseStickerAction(): ChooseStickerAction? = this as? ChooseStickerAction
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
inline fun BotAction.requireChooseStickerAction(): ChooseStickerAction = this as ChooseStickerAction
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> BotAction.whenUploadVoiceAction(block: (UploadVoiceAction) -> T) = asUploadVoiceAction() ?.let(block)
|
inline fun <T> BotAction.whenUploadVoiceAction(block: (UploadVoiceAction) -> T) = asUploadVoiceAction() ?.let(block)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user