1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

add Audio InlineQueryResult

This commit is contained in:
InsanusMokrassar 2019-02-07 12:47:08 +08:00
parent 1ce4c97899
commit fa10535a70
10 changed files with 115 additions and 6 deletions

View File

@ -0,0 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
interface Performerable {
val performer: String?
}

View File

@ -1,5 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -74,7 +75,7 @@ data class SendAudioData internal constructor(
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(performerField) @SerialName(performerField)
@Optional @Optional
val performer: String? = null, override val performer: String? = null,
@SerialName(titleField) @SerialName(titleField)
@Optional @Optional
override val title: String? = null, override val title: String? = null,
@ -93,7 +94,8 @@ data class SendAudioData internal constructor(
TextableSendMessageRequest<RawMessage>, TextableSendMessageRequest<RawMessage>,
ThumbedSendMessageRequest<RawMessage>, ThumbedSendMessageRequest<RawMessage>,
TitledSendMessageRequest<RawMessage>, TitledSendMessageRequest<RawMessage>,
DuratedSendMessageRequest<RawMessage> DuratedSendMessageRequest<RawMessage>,
Performerable
{ {
init { init {
text ?.let { text ?.let {

View File

@ -85,6 +85,10 @@ const val videoWidthField = "video_width"
const val videoHeightField = "video_height" const val videoHeightField = "video_height"
const val videoDurationField = "video_duration" const val videoDurationField = "video_duration"
const val audioUrlField = "audio_url"
const val audioFileIdField = "audio_file_id"
const val audioDurationField = "audio_duration"
const val gameShortNameField = "game_short_name" const val gameShortNameField = "game_short_name"
const val thumbUrlField = "thumb_url" const val thumbUrlField = "thumb_url"

View File

@ -0,0 +1,33 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
data class InlineQueryResultAudioCachedImpl(
@SerialName(idField)
override val id: String,
@SerialName(audioFileIdField)
override val fileId: FileId,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultAudioCached

View File

@ -0,0 +1,39 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
data class InlineQueryResultAudioImpl(
@SerialName(idField)
override val id: String,
@SerialName(audioUrlField)
override val url: String,
@SerialName(performerField)
override val performer: String?,
@SerialName(audioDurationField)
@Optional
override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultAudio

View File

@ -0,0 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.audio
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultAudio : InlineQueryResultAudioCommon, UrlInlineQueryResult, DuratedInlineResultQuery, Performerable, TitledInlineQueryResult

View File

@ -0,0 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.audio
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultAudioCached : InlineQueryResultAudioCommon, WithFileIdInlineQueryResult

View File

@ -0,0 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.audio
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Captioned
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.MimeTyped
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultAudioCommon : InlineQueryResult,
Captioned,
WithInputMessageContentInlineQueryResult
{
override val type: String
get() = "audio"
}

View File

@ -1,5 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
@ -18,11 +19,11 @@ data class InputMediaAudio(
@Optional @Optional
override val duration: Long? = null, override val duration: Long? = null,
@Optional @Optional
val performer: String? = null, override val performer: String? = null,
@Optional @Optional
override val title: String? = null, override val title: String? = null,
override val thumb: InputFile? = null override val thumb: InputFile? = null
) : InputMedia, DuratedInputMedia, ThumbedInputMedia, TitledInputMedia, CaptionedInputMedia { ) : InputMedia, DuratedInputMedia, ThumbedInputMedia, TitledInputMedia, CaptionedInputMedia, Performerable {
override val type: String = "audio" override val type: String = "audio"
@SerialName(mediaField) @SerialName(mediaField)

View File

@ -1,5 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.*
import kotlinx.serialization.* import kotlinx.serialization.*
@ -11,7 +12,7 @@ data class AudioFile(
@Optional @Optional
override val duration: Long? = null, override val duration: Long? = null,
@Optional @Optional
val performer: String? = null, override val performer: String? = null,
@Optional @Optional
override val title: String? = null, override val title: String? = null,
@SerialName(mimeTypeField) @SerialName(mimeTypeField)
@ -22,4 +23,4 @@ data class AudioFile(
override val fileSize: Long? = null, override val fileSize: Long? = null,
@Optional @Optional
override val thumb: PhotoSize? = null override val thumb: PhotoSize? = null
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile ) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile, Performerable