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

add InlineQuery#createAnswer

This commit is contained in:
InsanusMokrassar 2019-02-07 14:19:13 +08:00
parent 05b447da85
commit 0138036ed2
4 changed files with 20 additions and 12 deletions

View File

@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.internal.BooleanSerializer
@ -30,3 +31,20 @@ data class AnswerInlineQuery(
override fun method(): String = "answerInlineQuery" override fun method(): String = "answerInlineQuery"
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
} }
fun InlineQuery.createAnswer(
results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null,
isPersonal: Boolean? = null,
nextOffset: String? = null,
switchPmText: String? = null,
switchPmParameter: String? = null
) = AnswerInlineQuery(
id,
results,
cachedTime,
isPersonal,
nextOffset,
switchPmText,
switchPmParameter
)

View File

@ -8,6 +8,4 @@ interface InlineQuery {
val from: User val from: User
val query: String val query: String
val offset: Long val offset: Long
fun answerQuery()
} }

View File

@ -9,8 +9,4 @@ data class BaseInlineQuery(
override val from: User, override val from: User,
override val query: String, override val query: String,
override val offset: Long override val offset: Long
) : InlineQuery { ) : InlineQuery
override fun answerQuery() {
TODO()
}
}

View File

@ -9,8 +9,4 @@ data class LocationInlineQuery(
override val query: String, override val query: String,
override val offset: Long, override val offset: Long,
val location: Location val location: Location
) : InlineQuery { ) : InlineQuery
override fun answerQuery() {
TODO()
}
}