1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00
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.*
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer
/**
* Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle
*
* Please, remember about restrictions for characters in custom title
*/
@Serializable @Serializable
data class SetChatAdministratorCustomTitle( data class SetChatAdministratorCustomTitle(
@SerialName(chatIdField) @SerialName(chatIdField)

View File

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

View File

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