This commit is contained in:
InsanusMokrassar 2020-05-11 20:44:03 +06:00
parent 9cee22165d
commit ec6cf0f029
4 changed files with 32 additions and 11 deletions

View File

@ -5,11 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
/**
* Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle
*
* Please, remember about restrictions for characters in custom title
*/
@Serializable
data class SetChatAdministratorCustomTitle(
@SerialName(chatIdField)

View File

@ -4,9 +4,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.json.JsonObject
/**
* Will be used as SimpleRequest if
*/
class MultipartRequestImpl<D: DataRequest<R>, F: Files, R: Any>(
val data: D,
val files: F

View File

@ -2,6 +2,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.actions
import kotlinx.serialization.*
/**
* Use BotAction objects realisations to notify user about bot actions
*/
@Serializable(BotActionSerializer::class)
sealed class BotAction {
abstract val actionName: String
@ -31,54 +34,80 @@ internal object BotActionSerializer: KSerializer<BotAction> {
}
/**
* Use BotAction objects realisations to notify user about bot actions
* Will notify user that bot is "typing" something
*/
@Serializable(BotActionSerializer::class)
object TypingAction : BotAction() {
override val actionName: String = "typing"
}
/**
* Will notify user that bot is uploading some photo
*/
@Serializable(BotActionSerializer::class)
object UploadPhotoAction : BotAction() {
override val actionName: String = "upload_photo"
}
/**
* Will notify user that bot is recording some video
*/
@Serializable(BotActionSerializer::class)
object RecordVideoAction : BotAction() {
override val actionName: String = "record_video"
}
/**
* Will notify user that bot is uploading some photo
*/
@Serializable(BotActionSerializer::class)
object UploadVideoAction : BotAction() {
override val actionName: String = "upload_video"
}
/**
* Will notify user that bot is recording some audio
*/
@Serializable(BotActionSerializer::class)
object RecordAudioAction : BotAction() {
override val actionName: String = "record_audio"
}
/**
* Will notify user that bot is uploading some audio
*/
@Serializable(BotActionSerializer::class)
object UploadAudioAction : BotAction() {
override val actionName: String = "upload_audio"
}
/**
* Will notify user that bot is uploading some document
*/
@Serializable(BotActionSerializer::class)
object UploadDocumentAction : BotAction() {
override val actionName: String = "upload_document"
}
/**
* Will notify user that bot is trying to find location
*/
@Serializable(BotActionSerializer::class)
object FindLocationAction : BotAction() {
override val actionName: String = "find_location"
}
/**
* Will notify user that bot is recording video note
*/
@Serializable(BotActionSerializer::class)
object RecordVideoNoteAction : BotAction() {
override val actionName: String = "record_video_note"
}
/**
* Will notify user that bot is uploading video note
*/
@Serializable(BotActionSerializer::class)
object UploadVideoNoteAction : BotAction() {
override val actionName: String = "upload_video_note"

View File

@ -8,7 +8,7 @@ internal const val fileSizeField = "file_size"
internal const val filePathField = "file_path"
/**
* Declare common part of media files in Telegram. Note: it is not representation of `File` type
* Declare common part of media files in Telegram. Note: it is not representation of JVM `File` type
*/
interface TelegramMediaFile {
val fileId: FileId