mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
commit
0959c0b0d7
15
CHANGELOG.md
15
CHANGELOG.md
@ -35,6 +35,21 @@
|
|||||||
* `GetMe` now return `ExtendedBot` object
|
* `GetMe` now return `ExtendedBot` object
|
||||||
* Now extension `javaLocale` is extension for `CommonUser`
|
* Now extension `javaLocale` is extension for `CommonUser`
|
||||||
|
|
||||||
|
### 0.23.1
|
||||||
|
|
||||||
|
* Versions updates:
|
||||||
|
* Klock `1.8.6` -> `1.8.7`
|
||||||
|
* Ktor `1.3.0` -> `1.3.1`
|
||||||
|
* Now it is possible to get updates by polling with custom executor engine
|
||||||
|
* `CommonMultipartFileRequest` now is internal
|
||||||
|
* Added `LiveLocation` class for more useful tracking live locations
|
||||||
|
* `InvoiceOfPayment` is renamed to `InvoiceContent` and now is `MessageContent` instead of `PaymentInfo`
|
||||||
|
* `SendInvoice` now return `ContentMessage<InvoiceContent>`
|
||||||
|
* `paymentInfo` inside of `CommonMessageImpl` now can be set only to `SuccessfulPaymentInfo`
|
||||||
|
* Added `RecordVideoNoteAction` and `UploadVideoNoteAction` for `record_video_note` and `upload_video_note` actions
|
||||||
|
* For most part of messages was added `RequestsExecutor` extensions for more useful way of usage
|
||||||
|
* `toInputFile` extensions now will return more exact types
|
||||||
|
|
||||||
## 0.22.0
|
## 0.22.0
|
||||||
|
|
||||||
* **`KtorCallFactory` must return `HttpStatement` instead of `HttpClientCall`**
|
* **`KtorCallFactory` must return `HttpStatement` instead of `HttpClientCall`**
|
||||||
|
42
README.md
42
README.md
@ -78,10 +78,10 @@ important objects:
|
|||||||
Types declare different objects representation. For example, `Chat` for now represented as
|
Types declare different objects representation. For example, `Chat` for now represented as
|
||||||
interface and has several realisations:
|
interface and has several realisations:
|
||||||
|
|
||||||
* PrivateChat
|
* `PrivateChat`
|
||||||
* GroupChat
|
* `GroupChat`
|
||||||
* SupergroupChat
|
* `SupergroupChat`
|
||||||
* ChannelChat
|
* `ChannelChat`
|
||||||
|
|
||||||
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
|
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
|
||||||
here it was separated for more obvious difference between chats types and their possible content.
|
here it was separated for more obvious difference between chats types and their possible content.
|
||||||
@ -98,7 +98,14 @@ val requestsExecutor: RequestsExecutor = ...
|
|||||||
requestsExecutor.execute(GetMe())
|
requestsExecutor.execute(GetMe())
|
||||||
```
|
```
|
||||||
|
|
||||||
The result type of [GetMe](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
|
Or you can use new syntax:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val bot: RequestsExecutor = ...
|
||||||
|
bot.getMe()
|
||||||
|
```
|
||||||
|
|
||||||
|
The result type of [GetMe (and getMe extension)](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
|
||||||
request is
|
request is
|
||||||
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
||||||
|
|
||||||
@ -109,31 +116,38 @@ realisation of `RequestsExecutor`, but it is possible, that in future it will be
|
|||||||
project. How to create `RequestsExecutor`:
|
project. How to create `RequestsExecutor`:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val requestsExecutor = KtorRequestsExecutor(TOKEN)
|
val requestsExecutor = KtorRequestsExecutor(
|
||||||
|
TelegramAPIUrlsKeeper(TOKEN)
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Here `KtorRequestsExecutor` - default realisation with Ktor. `TOKEN` is just a token of bot which was retrieved
|
Here:
|
||||||
according to [instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
|
|
||||||
|
|
||||||
Besides, for correct usage of this, you must implement in your project both one of engines for client and server
|
* `KtorRequestsExecutor` - default realisation with [ktor](https://ktor.io)
|
||||||
Ktor libraries:
|
* `TelegramAPIUrlsKeeper` - special keeper, which you can save and use for getting files full urls (`resolveFileURL`
|
||||||
|
extension inside of `PathedFile.kt`)
|
||||||
|
* `TOKEN` is just a token of bot which was retrieved according to
|
||||||
|
[instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
|
||||||
|
|
||||||
|
By default, for JVM there is implemented `CIO` client engine, but there is not server engine. Both can be changed like
|
||||||
|
here:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
// ...
|
// ...
|
||||||
implementation "io.ktor:ktor-server-cio:$ktor_version"
|
implementation "io.ktor:ktor-server-cio:$ktor_version" // for implementing of server engine
|
||||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
It is able to avoid using of `server` dependency in case if will not be used `Webhook`s. In this case,
|
You can avoid using of `server` dependency in case if you will not use `Webhook`s. In this case,
|
||||||
dependencies list will be simplify:
|
dependencies list will be simplify:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
// ...
|
// ...
|
||||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -17,7 +17,7 @@ plugins {
|
|||||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = "0.23.0"
|
project.version = "0.23.1"
|
||||||
project.group = "com.github.insanusmokrassar"
|
project.group = "com.github.insanusmokrassar"
|
||||||
|
|
||||||
apply from: "publish.gradle"
|
apply from: "publish.gradle"
|
||||||
|
@ -2,8 +2,8 @@ kotlin.code.style=official
|
|||||||
kotlin_version=1.3.61
|
kotlin_version=1.3.61
|
||||||
kotlin_coroutines_version=1.3.3
|
kotlin_coroutines_version=1.3.3
|
||||||
kotlin_serialisation_runtime_version=0.14.0
|
kotlin_serialisation_runtime_version=0.14.0
|
||||||
klock_version=1.8.6
|
klock_version=1.8.7
|
||||||
uuid_version=0.0.7
|
uuid_version=0.0.7
|
||||||
ktor_version=1.3.0
|
ktor_version=1.3.1
|
||||||
|
|
||||||
gradle_bintray_plugin_version=1.8.4
|
gradle_bintray_plugin_version=1.8.4
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -20,3 +23,23 @@ data class DeleteMessage(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteMessage(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier
|
||||||
|
) = execute(
|
||||||
|
DeleteMessage(chatId, messageId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteMessage(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier
|
||||||
|
) = deleteMessage(chat.id, messageId)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteMessage(
|
||||||
|
message: Message
|
||||||
|
) = deleteMessage(message.chat, message.messageId)
|
||||||
|
|
||||||
|
suspend fun Message.delete(
|
||||||
|
requestsExecutor: RequestsExecutor
|
||||||
|
) = requestsExecutor.deleteMessage(this)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.message.abstracts.PossiblyForwardedMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@ -30,3 +32,45 @@ data class ForwardMessage(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.forwardMessage(
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = execute(
|
||||||
|
ForwardMessage(fromChatId, toChatId, messageId, disableNotification)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.forwardMessage(
|
||||||
|
fromChat: Chat,
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.forwardMessage(
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
toChat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.forwardMessage(
|
||||||
|
fromChat: Chat,
|
||||||
|
toChat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.forwardMessage(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
message: Message,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.forwardMessage(
|
||||||
|
toChat: Chat,
|
||||||
|
message: Message,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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 kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -12,3 +13,5 @@ class GetMe : SimpleRequest<ExtendedBot> {
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getMe() = execute(GetMe())
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
|
||||||
@ -27,3 +28,23 @@ data class GetUpdates(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getUpdates(
|
||||||
|
offset: UpdateIdentifier? = null,
|
||||||
|
limit: Int? = null,
|
||||||
|
timeout: Int? = null,
|
||||||
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
|
) = execute(
|
||||||
|
GetUpdates(
|
||||||
|
offset, limit, timeout, allowed_updates
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getUpdates(
|
||||||
|
lastUpdate: Update,
|
||||||
|
limit: Int? = null,
|
||||||
|
timeout: Int? = null,
|
||||||
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
|
) = getUpdates(
|
||||||
|
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
||||||
|
)
|
||||||
|
@ -0,0 +1,133 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendLocation
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
|
import com.soywiz.klock.DateTime
|
||||||
|
import com.soywiz.klock.TimeSpan
|
||||||
|
import io.ktor.utils.io.core.Closeable
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
import kotlin.math.ceil
|
||||||
|
|
||||||
|
private val livePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
||||||
|
class LiveLocation internal constructor(
|
||||||
|
private val requestsExecutor: RequestsExecutor,
|
||||||
|
scope: CoroutineScope,
|
||||||
|
autoCloseTimeDelay: Double,
|
||||||
|
initMessage: ContentMessage<LocationContent>
|
||||||
|
) : Closeable {
|
||||||
|
private val doWhenClose = {
|
||||||
|
scope.launch {
|
||||||
|
requestsExecutor.stopLiveLocation(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay)
|
||||||
|
val leftUntilCloseMillis: TimeSpan
|
||||||
|
get() = autoCloseTime - DateTime.now()
|
||||||
|
|
||||||
|
var isClosed: Boolean = false
|
||||||
|
private set
|
||||||
|
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
||||||
|
|
||||||
|
private var message: ContentMessage<LocationContent> = initMessage
|
||||||
|
val lastLocation: Location
|
||||||
|
get() = message.content.location
|
||||||
|
|
||||||
|
suspend fun updateLocation(
|
||||||
|
location: Location,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
): Location {
|
||||||
|
if (!isClosed) {
|
||||||
|
message = requestsExecutor.editLiveLocation(
|
||||||
|
message,
|
||||||
|
location,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
return lastLocation
|
||||||
|
} else {
|
||||||
|
error("LiveLocation is closed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun close() {
|
||||||
|
if (isClosed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isClosed = true
|
||||||
|
doWhenClose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.startLiveLocation(
|
||||||
|
scope: CoroutineScope,
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): LiveLocation {
|
||||||
|
val liveTimeAsDouble = liveTimeMillis.toDouble()
|
||||||
|
val locationMessage = execute(
|
||||||
|
SendLocation(
|
||||||
|
chatId,
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
ceil(liveTimeAsDouble / 1000).toLong(),
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return LiveLocation(
|
||||||
|
this,
|
||||||
|
scope,
|
||||||
|
liveTimeAsDouble,
|
||||||
|
locationMessage
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.startLiveLocation(
|
||||||
|
scope: CoroutineScope,
|
||||||
|
chat: Chat,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): LiveLocation = startLiveLocation(
|
||||||
|
scope, chat.id, latitude, longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.startLiveLocation(
|
||||||
|
scope: CoroutineScope,
|
||||||
|
chatId: ChatId,
|
||||||
|
location: Location,
|
||||||
|
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): LiveLocation = startLiveLocation(
|
||||||
|
scope, chatId, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.startLiveLocation(
|
||||||
|
scope: CoroutineScope,
|
||||||
|
chat: Chat,
|
||||||
|
location: Location,
|
||||||
|
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): LiveLocation = startLiveLocation(
|
||||||
|
scope, chat.id, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
@ -2,9 +2,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup.EditChatMessageReplyMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@ -23,3 +27,29 @@ data class StopPoll(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
StopPoll(chatId, messageId, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopPoll(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = stopPoll(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopPoll(
|
||||||
|
chatId: ChatId,
|
||||||
|
message: Message,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = stopPoll(chatId, message.messageId, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopPoll(
|
||||||
|
chat: Chat,
|
||||||
|
message: Message,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
||||||
|
@ -18,7 +18,7 @@ data class FileId(
|
|||||||
override val fileId: String
|
override val fileId: String
|
||||||
) : InputFile()
|
) : InputFile()
|
||||||
|
|
||||||
fun String.toInputFile(): InputFile = FileId(this)
|
fun String.toInputFile() = FileId(this)
|
||||||
|
|
||||||
@Serializer(InputFile::class)
|
@Serializer(InputFile::class)
|
||||||
internal object InputFileSerializer : KSerializer<InputFile> {
|
internal object InputFileSerializer : KSerializer<InputFile> {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.CallbackQuery.CallbackQuery
|
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery
|
||||||
@ -32,3 +33,19 @@ fun CallbackQuery.createAnswer(
|
|||||||
url: String? = null,
|
url: String? = null,
|
||||||
cachedTimeSeconds: Int? = null
|
cachedTimeSeconds: Int? = null
|
||||||
): AnswerCallbackQuery = AnswerCallbackQuery(id, text, showAlert, url, cachedTimeSeconds)
|
): AnswerCallbackQuery = AnswerCallbackQuery(id, text, showAlert, url, cachedTimeSeconds)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerCallbackQuery(
|
||||||
|
callbackQueryId: CallbackQueryIdentifier,
|
||||||
|
text: String? = null,
|
||||||
|
showAlert: Boolean? = null,
|
||||||
|
url: String? = null,
|
||||||
|
cachedTimeSeconds: Int? = null
|
||||||
|
) = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerCallbackQuery(
|
||||||
|
callbackQuery: CallbackQuery,
|
||||||
|
text: String? = null,
|
||||||
|
showAlert: Boolean? = null,
|
||||||
|
url: String? = null,
|
||||||
|
cachedTimeSeconds: Int? = null
|
||||||
|
) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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
|
||||||
@ -51,6 +52,28 @@ fun InlineQuery.createAnswer(
|
|||||||
switchPmParameter
|
switchPmParameter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerInlineQuery(
|
||||||
|
inlineQueryID: InlineQueryIdentifier,
|
||||||
|
results: List<InlineQueryResult> = emptyList(),
|
||||||
|
cachedTime: Int? = null,
|
||||||
|
isPersonal: Boolean? = null,
|
||||||
|
nextOffset: String? = null,
|
||||||
|
switchPmText: String? = null,
|
||||||
|
switchPmParameter: String? = null
|
||||||
|
) = execute(
|
||||||
|
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerInlineQuery(
|
||||||
|
inlineQuery: InlineQuery,
|
||||||
|
results: List<InlineQueryResult> = emptyList(),
|
||||||
|
cachedTime: Int? = null,
|
||||||
|
isPersonal: Boolean? = null,
|
||||||
|
nextOffset: String? = null,
|
||||||
|
switchPmText: String? = null,
|
||||||
|
switchPmParameter: String? = null
|
||||||
|
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
|
|
||||||
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ArrayListSerializer(
|
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ArrayListSerializer(
|
||||||
InlineQueryResultSerializer
|
InlineQueryResultSerializer
|
||||||
)
|
)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerPreCheckoutQuery
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerPreCheckoutQuery
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -40,3 +41,19 @@ fun PreCheckoutQuery.createAnswerError(
|
|||||||
id,
|
id,
|
||||||
error
|
error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerPreCheckoutQueryOk(
|
||||||
|
id: PreCheckoutQueryId
|
||||||
|
) = execute(AnswerPreCheckoutQueryOk(id))
|
||||||
|
suspend fun RequestsExecutor.answerPreCheckoutQueryOk(
|
||||||
|
preCheckoutQuery: PreCheckoutQuery
|
||||||
|
) = answerPreCheckoutQueryOk(preCheckoutQuery.id)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerPreCheckoutQueryError(
|
||||||
|
id: PreCheckoutQueryId,
|
||||||
|
error: String
|
||||||
|
) = execute(AnswerPreCheckoutQueryError(id, error))
|
||||||
|
suspend fun RequestsExecutor.answerPreCheckoutQueryError(
|
||||||
|
preCheckoutQuery: PreCheckoutQuery,
|
||||||
|
error: String
|
||||||
|
) = answerPreCheckoutQueryError(preCheckoutQuery.id, error)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption
|
||||||
@ -51,3 +52,23 @@ fun ShippingQuery.createAnswerError(
|
|||||||
id,
|
id,
|
||||||
error
|
error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerShippingQueryOk(
|
||||||
|
id: ShippingQueryIdentifier,
|
||||||
|
shippingOptions: List<ShippingOption>
|
||||||
|
) = execute(AnswerShippingQueryOk(id, shippingOptions))
|
||||||
|
suspend fun RequestsExecutor.answerShippingQueryOk(
|
||||||
|
shippingQuery: ShippingQuery,
|
||||||
|
shippingOptions: List<ShippingOption>
|
||||||
|
) = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.answerShippingQueryError(
|
||||||
|
id: ShippingQueryIdentifier,
|
||||||
|
error: String
|
||||||
|
) = execute(AnswerShippingQueryError(id, error))
|
||||||
|
suspend fun RequestsExecutor.answerShippingQueryError(
|
||||||
|
shippingQuery: ShippingQuery,
|
||||||
|
error: String
|
||||||
|
) = answerShippingQueryError(shippingQuery.id, error)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.StringSerializer
|
import kotlinx.serialization.internal.StringSerializer
|
||||||
@ -18,3 +21,11 @@ data class ExportChatInviteLink(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.exportChatInviteLink(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(ExportChatInviteLink(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.exportChatInviteLink(
|
||||||
|
chat: PublicChat
|
||||||
|
) = exportChatInviteLink(chat.id)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
@ -18,3 +21,11 @@ data class LeaveChat(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.leaveChat(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(LeaveChat(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.leaveChat(
|
||||||
|
chat: PublicChat
|
||||||
|
) = leaveChat(chat.id)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ExtendedChatSerializer
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ExtendedChatSerializer
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -19,3 +21,11 @@ data class GetChat(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChat(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(GetChat(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChat(
|
||||||
|
chat: Chat
|
||||||
|
) = getChat(chat.id)
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.ArrayListSerializer
|
import kotlinx.serialization.internal.ArrayListSerializer
|
||||||
@ -24,3 +27,11 @@ data class GetChatAdministrators(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatAdministrators(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(GetChatAdministrators(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatAdministrators(
|
||||||
|
chat: PublicChat
|
||||||
|
) = getChatAdministrators(chat.id)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.IntSerializer
|
import kotlinx.serialization.internal.IntSerializer
|
||||||
@ -18,3 +21,11 @@ data class GetChatMembersCount(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatMembersCount(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(GetChatMembersCount(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatMembersCount(
|
||||||
|
chat: PublicChat
|
||||||
|
) = getChatMembersCount(chat.id)
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.getChatMembersCount
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -19,3 +23,23 @@ data class GetChatMember(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatMember(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId
|
||||||
|
) = execute(GetChatMember(chatId, userId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId
|
||||||
|
) = getChatMember(chat.id, userId)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatMember(
|
||||||
|
chatId: ChatId,
|
||||||
|
user: User
|
||||||
|
) = getChatMember(chatId, user.id)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User
|
||||||
|
) = getChatMember(chat.id, user.id)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -21,3 +24,27 @@ data class KickChatMember(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.kickChatMember(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId,
|
||||||
|
untilDate: TelegramDate? = null
|
||||||
|
) = execute(KickChatMember(chatId, userId, untilDate))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.kickChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId,
|
||||||
|
untilDate: TelegramDate? = null
|
||||||
|
) = kickChatMember(chat.id, userId, untilDate)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.kickChatMember(
|
||||||
|
chatId: ChatId,
|
||||||
|
user: User,
|
||||||
|
untilDate: TelegramDate? = null
|
||||||
|
) = kickChatMember(chatId, user.id, untilDate)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.kickChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User,
|
||||||
|
untilDate: TelegramDate? = null
|
||||||
|
) = kickChatMember(chat.id, user.id, untilDate)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -37,3 +40,109 @@ data class PromoteChatMember(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.promoteChatMember(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
canChangeInfo: Boolean? = null,
|
||||||
|
canPostMessages: Boolean? = null,
|
||||||
|
canEditMessages: Boolean? = null,
|
||||||
|
canDeleteMessages: Boolean? = null,
|
||||||
|
canInviteUsers: Boolean? = null,
|
||||||
|
canRestrictMembers: Boolean? = null,
|
||||||
|
canPinMessages: Boolean? = null,
|
||||||
|
canPromoteMembers: Boolean? = null
|
||||||
|
) = execute(
|
||||||
|
PromoteChatMember(
|
||||||
|
chatId,
|
||||||
|
userId,
|
||||||
|
untilDate,
|
||||||
|
canChangeInfo,
|
||||||
|
canPostMessages,
|
||||||
|
canEditMessages,
|
||||||
|
canDeleteMessages,
|
||||||
|
canInviteUsers,
|
||||||
|
canRestrictMembers,
|
||||||
|
canPinMessages,
|
||||||
|
canPromoteMembers
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.promoteChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
canChangeInfo: Boolean? = null,
|
||||||
|
canPostMessages: Boolean? = null,
|
||||||
|
canEditMessages: Boolean? = null,
|
||||||
|
canDeleteMessages: Boolean? = null,
|
||||||
|
canInviteUsers: Boolean? = null,
|
||||||
|
canRestrictMembers: Boolean? = null,
|
||||||
|
canPinMessages: Boolean? = null,
|
||||||
|
canPromoteMembers: Boolean? = null
|
||||||
|
) = promoteChatMember(
|
||||||
|
chat.id,
|
||||||
|
userId,
|
||||||
|
untilDate,
|
||||||
|
canChangeInfo,
|
||||||
|
canPostMessages,
|
||||||
|
canEditMessages,
|
||||||
|
canDeleteMessages,
|
||||||
|
canInviteUsers,
|
||||||
|
canRestrictMembers,
|
||||||
|
canPinMessages,
|
||||||
|
canPromoteMembers
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.promoteChatMember(
|
||||||
|
chatId: ChatId,
|
||||||
|
user: User,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
canChangeInfo: Boolean? = null,
|
||||||
|
canPostMessages: Boolean? = null,
|
||||||
|
canEditMessages: Boolean? = null,
|
||||||
|
canDeleteMessages: Boolean? = null,
|
||||||
|
canInviteUsers: Boolean? = null,
|
||||||
|
canRestrictMembers: Boolean? = null,
|
||||||
|
canPinMessages: Boolean? = null,
|
||||||
|
canPromoteMembers: Boolean? = null
|
||||||
|
) = promoteChatMember(
|
||||||
|
chatId,
|
||||||
|
user.id,
|
||||||
|
untilDate,
|
||||||
|
canChangeInfo,
|
||||||
|
canPostMessages,
|
||||||
|
canEditMessages,
|
||||||
|
canDeleteMessages,
|
||||||
|
canInviteUsers,
|
||||||
|
canRestrictMembers,
|
||||||
|
canPinMessages,
|
||||||
|
canPromoteMembers
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.promoteChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
canChangeInfo: Boolean? = null,
|
||||||
|
canPostMessages: Boolean? = null,
|
||||||
|
canEditMessages: Boolean? = null,
|
||||||
|
canDeleteMessages: Boolean? = null,
|
||||||
|
canInviteUsers: Boolean? = null,
|
||||||
|
canRestrictMembers: Boolean? = null,
|
||||||
|
canPinMessages: Boolean? = null,
|
||||||
|
canPromoteMembers: Boolean? = null
|
||||||
|
) = promoteChatMember(
|
||||||
|
chat.id,
|
||||||
|
user.id,
|
||||||
|
untilDate,
|
||||||
|
canChangeInfo,
|
||||||
|
canPostMessages,
|
||||||
|
canEditMessages,
|
||||||
|
canDeleteMessages,
|
||||||
|
canInviteUsers,
|
||||||
|
canRestrictMembers,
|
||||||
|
canPinMessages,
|
||||||
|
canPromoteMembers
|
||||||
|
)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -16,7 +19,7 @@ data class RestrictChatMember(
|
|||||||
@SerialName(untilDateField)
|
@SerialName(untilDateField)
|
||||||
override val untilDate: TelegramDate? = null,
|
override val untilDate: TelegramDate? = null,
|
||||||
@SerialName(permissionsField)
|
@SerialName(permissionsField)
|
||||||
val permissions: ChatPermissions
|
val permissions: ChatPermissions = ChatPermissions()
|
||||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||||
override fun method(): String = "restrictChatMember"
|
override fun method(): String = "restrictChatMember"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
@ -24,3 +27,32 @@ data class RestrictChatMember(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.restrictChatMember(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
permissions: ChatPermissions = ChatPermissions()
|
||||||
|
) = execute(RestrictChatMember(chatId, userId, untilDate, permissions))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.restrictChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
permissions: ChatPermissions = ChatPermissions()
|
||||||
|
) = restrictChatMember(chat.id, userId, untilDate, permissions)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.restrictChatMember(
|
||||||
|
chatId: ChatId,
|
||||||
|
user: User,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
permissions: ChatPermissions = ChatPermissions()
|
||||||
|
) = restrictChatMember(chatId, user.id, untilDate, permissions)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.restrictChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User,
|
||||||
|
untilDate: TelegramDate? = null,
|
||||||
|
permissions: ChatPermissions = ChatPermissions()
|
||||||
|
) = restrictChatMember(chat.id, user.id, untilDate, permissions)
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -13,7 +16,7 @@ import kotlinx.serialization.internal.BooleanSerializer
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class SetChatAdministratorCustomTitle(
|
data class SetChatAdministratorCustomTitle(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatId,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(userIdField)
|
@SerialName(userIdField)
|
||||||
override val userId: UserId,
|
override val userId: UserId,
|
||||||
@SerialName(customTitleField)
|
@SerialName(customTitleField)
|
||||||
@ -31,3 +34,27 @@ data class SetChatAdministratorCustomTitle(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||||
|
chatId: ChatId,
|
||||||
|
userId: UserId,
|
||||||
|
customTitle: String
|
||||||
|
) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId,
|
||||||
|
customTitle: String
|
||||||
|
) = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||||
|
chatId: ChatId,
|
||||||
|
user: User,
|
||||||
|
customTitle: String
|
||||||
|
) = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User,
|
||||||
|
customTitle: String
|
||||||
|
) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)
|
@ -1,7 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -18,3 +21,24 @@ data class UnbanChatMember(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.unbanChatMember(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId
|
||||||
|
) = execute(UnbanChatMember(chatId, userId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.unbanChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId
|
||||||
|
) = unbanChatMember(chat.id, userId)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.unbanChatMember(
|
||||||
|
chatId: ChatId,
|
||||||
|
user: User
|
||||||
|
) = unbanChatMember(chatId, user.id)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.unbanChatMember(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User
|
||||||
|
) = unbanChatMember(chat.id, user.id)
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.GetChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
@ -18,3 +22,11 @@ data class DeleteChatPhoto(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteChatPhoto(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(DeleteChatPhoto(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteChatPhoto(
|
||||||
|
chat: PublicChat
|
||||||
|
) = deleteChatPhoto(chat.id)
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -21,3 +25,24 @@ data class PinChatMessage (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.pinChatMessage(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = execute(PinChatMessage(chatId, messageId, disableNotification))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.pinChatMessage(
|
||||||
|
chat: PublicChat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.pinChatMessage(
|
||||||
|
message: Message,
|
||||||
|
disableNotification: Boolean = false
|
||||||
|
) = if (message.chat is PublicChat) {
|
||||||
|
pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
||||||
|
} else {
|
||||||
|
error("It is possible to pin messages only in non one-to-one chats")
|
||||||
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -25,3 +28,13 @@ data class SetChatDescription (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatDescription(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
description: String
|
||||||
|
) = execute(SetChatDescription(chatId, description))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatDescription(
|
||||||
|
chat: PublicChat,
|
||||||
|
description: String
|
||||||
|
) = setChatDescription(chat.id, description)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.chat.ChatPermissions
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -20,3 +22,13 @@ data class SetChatPermissions (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setDefaultChatMembersPermissions(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
permissions: ChatPermissions
|
||||||
|
) = execute(SetChatPermissions(chatId, permissions))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setDefaultChatMembersPermissions(
|
||||||
|
chat: PublicChat,
|
||||||
|
permissions: ChatPermissions
|
||||||
|
) = setDefaultChatMembersPermissions(chat.id, permissions)
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
@ -21,3 +25,13 @@ data class SetChatPhoto (
|
|||||||
override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo)
|
override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo)
|
||||||
override val paramsJson: JsonObject = toJson(serializer())
|
override val paramsJson: JsonObject = toJson(serializer())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatPhoto(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
photo: MultipartFile
|
||||||
|
) = execute(SetChatPhoto(chatId, photo))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatPhoto(
|
||||||
|
chat: PublicChat,
|
||||||
|
photo: MultipartFile
|
||||||
|
) = setChatPhoto(chat.id, photo)
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
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.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -25,3 +29,13 @@ data class SetChatTitle (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatTitle(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
title: String
|
||||||
|
) = execute(SetChatTitle(chatId, title))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatTitle(
|
||||||
|
chat: PublicChat,
|
||||||
|
title: String
|
||||||
|
) = setChatTitle(chat.id, title)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
@ -18,3 +21,11 @@ data class UnpinChatMessage(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.unpinChatMessage(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(UnpinChatMessage(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.unpinChatMessage(
|
||||||
|
chat: PublicChat
|
||||||
|
) = unpinChatMessage(chat.id)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.DeleteChatPhoto
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
@ -18,3 +21,11 @@ data class DeleteChatStickerSet(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteChatStickerSet(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(DeleteChatStickerSet(chatId))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteChatStickerSet(
|
||||||
|
chat: SupergroupChat
|
||||||
|
) = deleteChatStickerSet(chat.id)
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.chat.abstracts.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -19,3 +21,13 @@ data class SetChatStickerSet(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatStickerSet(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
stickerSetName: StickerSetName
|
||||||
|
) = execute(SetChatStickerSet(chatId, stickerSetName))
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setChatStickerSet(
|
||||||
|
chat: SupergroupChat,
|
||||||
|
stickerSetName: StickerSetName
|
||||||
|
) = setChatStickerSet(chat.id, stickerSetName)
|
||||||
|
@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.common
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
|
||||||
data class CommonMultipartFileRequest<T: Any>(
|
internal data class CommonMultipartFileRequest<T: Any>(
|
||||||
val data: SimpleRequest<T>,
|
val data: SimpleRequest<T>,
|
||||||
override val mediaMap: Map<String, MultipartFile>
|
override val mediaMap: Map<String, MultipartFile>
|
||||||
) : MultipartRequest<T>, Request<T> by data {
|
) : MultipartRequest<T>, Request<T> by data {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
@ -29,3 +31,54 @@ data class EditChatMessageLiveLocation(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditChatMessageLiveLocation(
|
||||||
|
chatId, messageId, latitude, longitude, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(chat.id, messageId, latitude, longitude, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
message: ContentMessage<LocationContent>,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(message.chat, message.messageId, latitude, longitude, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
location: Location,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditChatMessageLiveLocation(
|
||||||
|
chatId, messageId, location.latitude, location.longitude, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
location: Location,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
message: ContentMessage<LocationContent>,
|
||||||
|
location: Location,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, replyMarkup)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
@ -20,3 +21,19 @@ data class EditInlineMessageLiveLocation(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditInlineMessageLiveLocation(
|
||||||
|
inlineMessageId, latitude, longitude, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
suspend fun RequestsExecutor.editLiveLocation(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
location: Location,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, replyMarkup)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
@ -26,3 +28,25 @@ data class StopChatMessageLiveLocation(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopLiveLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
StopChatMessageLiveLocation(
|
||||||
|
chatId, messageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopLiveLocation(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = stopLiveLocation(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopLiveLocation(
|
||||||
|
message: ContentMessage<LocationContent>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = stopLiveLocation(message.chat, message.messageId, replyMarkup)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
@ -17,3 +18,12 @@ data class StopInlineMessageLiveLocation(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.stopLiveLocation(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
StopInlineMessageLiveLocation(
|
||||||
|
inlineMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.EditChatMessageMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -29,3 +33,23 @@ data class EditChatMessageReplyMarkup(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditChatMessageReplyMarkup(chatId, messageId, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||||
|
message: Message,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.EditInlineMessageMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@ -17,3 +20,8 @@ data class EditInlineMessageReplyMarkup(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.MediaContentMessageResultDeserializer
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.MediaContentMessageResultDeserializer
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text.EditChatMessageText
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.CommonMessageImpl
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
const val editMessageCaptionMethod = "editMessageCaption"
|
const val editMessageCaptionMethod = "editMessageCaption"
|
||||||
@ -32,3 +40,30 @@ data class EditChatMessageCaption(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageCaption(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditChatMessageCaption(chatId, messageId, text, parseMode, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageCaption(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun <T> RequestsExecutor.editMessageCaption(
|
||||||
|
message: ContentMessage<T>,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
|
||||||
|
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup)
|
||||||
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text.EditInlineMessageText
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
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
|
||||||
@ -22,3 +24,10 @@ data class EditInlineMessageCaption(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageCaption(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup))
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption.EditChatMessageCaption
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.CommonMessageImpl
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
const val editMessageMediaMethod = "editMessageMedia"
|
const val editMessageMediaMethod = "editMessageMedia"
|
||||||
@ -38,3 +45,25 @@ data class EditChatMessageMedia(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageMedia(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
media: InputMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditChatMessageMedia(chatId, messageId, media, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageMedia(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
media: InputMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageMedia(
|
||||||
|
message: ContentMessage<out MediaContent>,
|
||||||
|
media: InputMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption.EditInlineMessageCaption
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@ -27,3 +30,9 @@ data class EditInlineMessageMedia(
|
|||||||
|
|
||||||
override fun method(): String = editMessageMediaMethod
|
override fun method(): String = editMessageMediaMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageCaption(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
media: InputMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.TextContentMessageResultDeserializer
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.TextContentMessageResultDeserializer
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@ -34,3 +37,31 @@ data class EditChatMessageText(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageText(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageText(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageText(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
@ -1,11 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.editMessageMediaMethod
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.editMessageMediaMethod
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -25,3 +27,11 @@ data class EditInlineMessageText(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.editMessageText(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup))
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -17,3 +21,50 @@ data class GetGameHighScoresByChat (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
chatId: ChatId,
|
||||||
|
messageId: MessageIdentifier
|
||||||
|
) = execute(
|
||||||
|
GetGameHighScoresByChat(userId, chatId, messageId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
chatId: ChatId,
|
||||||
|
messageId: MessageIdentifier
|
||||||
|
) = getGameScore(
|
||||||
|
user.id, chatId, messageId
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier
|
||||||
|
) = getGameScore(
|
||||||
|
userId, chat.id, messageId
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier
|
||||||
|
) = getGameScore(
|
||||||
|
user.id, chat.id, messageId
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
message: ContentMessage<GameContent>
|
||||||
|
) = getGameScore(
|
||||||
|
userId, message.chat.id, message.messageId
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
message: ContentMessage<GameContent>
|
||||||
|
) = getGameScore(
|
||||||
|
user.id, message.chat.id, message.messageId
|
||||||
|
)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -15,3 +16,17 @@ data class GetGameHighScoresByInlineMessageId (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
inlineMessageId: InlineMessageIdentifier
|
||||||
|
) = execute(
|
||||||
|
GetGameHighScoresByInlineMessageId(
|
||||||
|
userId, inlineMessageId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
inlineMessageId: InlineMessageIdentifier
|
||||||
|
) = getGameScore(user.id, inlineMessageId)
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -23,3 +27,68 @@ data class SetGameScoreByChatId (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
score: Long,
|
||||||
|
chatId: ChatId,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = execute(
|
||||||
|
SetGameScoreByChatId(userId, score, chatId, messageId, force, disableEditMessage)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
score: Long,
|
||||||
|
chatId: ChatId,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = setGameScore(
|
||||||
|
user.id, score, chatId, messageId, force, disableEditMessage
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
score: Long,
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = setGameScore(
|
||||||
|
userId, score, chat.id, messageId, force, disableEditMessage
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
score: Long,
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = setGameScore(
|
||||||
|
user.id, score, chat.id, messageId, force, disableEditMessage
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
score: Long,
|
||||||
|
message: ContentMessage<GameContent>,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = setGameScore(
|
||||||
|
userId, score, message.chat.id, message.messageId, force, disableEditMessage
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
score: Long,
|
||||||
|
message: ContentMessage<GameContent>,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = setGameScore(
|
||||||
|
user.id, score, message.chat.id, message.messageId, force, disableEditMessage
|
||||||
|
)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -21,3 +22,23 @@ data class SetGameScoreByInlineMessageId (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
userId: UserId,
|
||||||
|
score: Long,
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = execute(
|
||||||
|
SetGameScoreByInlineMessageId(
|
||||||
|
userId, score, inlineMessageId, force, disableEditMessage
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setGameScore(
|
||||||
|
user: CommonUser,
|
||||||
|
score: Long,
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
force: Boolean = false,
|
||||||
|
disableEditMessage: Boolean = false
|
||||||
|
) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage)
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PathedFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PathedFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.fileIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.fileIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@ -17,3 +19,13 @@ data class GetFile(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getFileAdditionalInfo(
|
||||||
|
fileId: FileId
|
||||||
|
) = execute(
|
||||||
|
GetFile(fileId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getFileAdditionalInfo(
|
||||||
|
file: TelegramMediaFile
|
||||||
|
) = getFileAdditionalInfo(file.fileId)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -16,3 +18,15 @@ data class GetStickerSet(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getStickerSet(
|
||||||
|
name: String
|
||||||
|
) = execute(
|
||||||
|
GetStickerSet(name)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getStickerSet(
|
||||||
|
sticker: Sticker
|
||||||
|
) = getStickerSet(
|
||||||
|
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
|
||||||
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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 kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -28,3 +29,19 @@ data class GetUserProfilePhotos(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getUserProfilePhotos(
|
||||||
|
userId: UserId,
|
||||||
|
offset: Int? = null,
|
||||||
|
limit: Int? = null
|
||||||
|
) = execute(
|
||||||
|
GetUserProfilePhotos(
|
||||||
|
userId, offset, limit
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getUserProfilePhotos(
|
||||||
|
user: CommonUser,
|
||||||
|
offset: Int? = null,
|
||||||
|
limit: Int? = null
|
||||||
|
) = getUserProfilePhotos(user.id, offset, limit)
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendChatMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendChatMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.actions.BotAction
|
import com.github.insanusmokrassar.TelegramBotAPI.types.actions.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
|
|
||||||
@ -22,3 +24,99 @@ data class SendAction(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendBotAction(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
action: BotAction
|
||||||
|
) = execute(
|
||||||
|
SendAction(chatId, action)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendBotAction(
|
||||||
|
chat: Chat,
|
||||||
|
action: BotAction
|
||||||
|
) = sendBotAction(chat.id, action)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionTyping(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, TypingAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadPhoto(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, UploadPhotoAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionRecordVideo(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, RecordVideoAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadVideo(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, UploadVideoAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionRecordAudio(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, RecordAudioAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadAudio(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, UploadAudioAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadDocument(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, UploadDocumentAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionFindLocation(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, FindLocationAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionRecordVideoNote(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, RecordVideoNoteAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadVideoNote(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = sendBotAction(chatId, UploadVideoNoteAction)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionTyping(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, TypingAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadPhoto(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, UploadPhotoAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionRecordVideo(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, RecordVideoAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadVideo(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, UploadVideoAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionRecordAudio(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, RecordAudioAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadAudio(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, UploadAudioAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadDocument(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, UploadDocumentAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionFindLocation(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, FindLocationAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionRecordVideoNote(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, RecordVideoNoteAction)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendActionUploadVideoNote(
|
||||||
|
chat: Chat
|
||||||
|
) = sendBotAction(chat, UploadVideoNoteAction)
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent
|
||||||
@ -66,3 +68,51 @@ fun Contact.toRequest(
|
|||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendContact(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
phoneNumber: String,
|
||||||
|
firstName: String,
|
||||||
|
lastName: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendContact(
|
||||||
|
chatId, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendContact(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
contact: Contact,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendContact(
|
||||||
|
chatId, contact, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendContact(
|
||||||
|
chat: Chat,
|
||||||
|
phoneNumber: String,
|
||||||
|
firstName: String,
|
||||||
|
lastName: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendContact(
|
||||||
|
chat.id, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendContact(
|
||||||
|
chat: Chat,
|
||||||
|
contact: Contact,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendContact(
|
||||||
|
chat.id, contact, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.EditChatMessageLiveLocation
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.StopChatMessageLiveLocation
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.executeAsync
|
||||||
|
import com.soywiz.klock.DateTime
|
||||||
|
import com.soywiz.klock.TimeSpan
|
||||||
|
import io.ktor.utils.io.core.Closeable
|
||||||
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
|
||||||
@ -33,10 +43,79 @@ data class SendLocation(
|
|||||||
ReplyingMarkupSendMessageRequest<ContentMessage<LocationContent>>,
|
ReplyingMarkupSendMessageRequest<ContentMessage<LocationContent>>,
|
||||||
PositionedSendMessageRequest<ContentMessage<LocationContent>>
|
PositionedSendMessageRequest<ContentMessage<LocationContent>>
|
||||||
{
|
{
|
||||||
|
|
||||||
override fun method(): String = "sendLocation"
|
override fun method(): String = "sendLocation"
|
||||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
|
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
|
||||||
get() = commonResultDeserializer
|
get() = commonResultDeserializer
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (livePeriod != null && livePeriod !in livePeriodLimit) {
|
||||||
|
error("Live period for sending location must be in $livePeriodLimit, but was $livePeriod")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendLocation(
|
||||||
|
chatId,
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
replyToMessageId = replyToMessageId,
|
||||||
|
replyMarkup = replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
location: Location,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendLocation(
|
||||||
|
chatId,
|
||||||
|
location.latitude,
|
||||||
|
location.longitude,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendLocation(
|
||||||
|
chat: Chat,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendLocation(
|
||||||
|
chat.id,
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendLocation(
|
||||||
|
chat: Chat,
|
||||||
|
location: Location,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendLocation(
|
||||||
|
chat.id,
|
||||||
|
location.latitude,
|
||||||
|
location.longitude,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableWebPagePreview
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableWebPagePreview
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
||||||
@ -55,3 +57,48 @@ data class SendTextMessage(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
typealias SendMessage = SendTextMessage
|
typealias SendMessage = SendTextMessage
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendMessage(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendTextMessage(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendMessage(
|
||||||
|
chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendMessage(
|
||||||
|
chat: Chat,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendTextMessage(
|
||||||
|
chat: Chat,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent
|
||||||
@ -73,3 +75,55 @@ fun Venue.toRequest(
|
|||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVenue(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
title: String,
|
||||||
|
address: String,
|
||||||
|
foursquareId: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendVenue(
|
||||||
|
chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVenue(
|
||||||
|
chat: Chat,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
title: String,
|
||||||
|
address: String,
|
||||||
|
foursquareId: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVenue(
|
||||||
|
chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVenue(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
venue: Venue,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendVenue(
|
||||||
|
chatId, venue, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVenue(
|
||||||
|
chat: Chat,
|
||||||
|
venue: Venue,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVenue(
|
||||||
|
chat.id, venue, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
|
||||||
@ -32,3 +35,45 @@ data class SendGame (
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendGame(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
gameShortName: String,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendGame(
|
||||||
|
chatId, gameShortName, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendGame(
|
||||||
|
chat: Chat,
|
||||||
|
gameShortName: String,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendGame(
|
||||||
|
chat.id, gameShortName, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendGame(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
game: Game,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendGame(
|
||||||
|
chatId, game.title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendGame(
|
||||||
|
chat: Chat,
|
||||||
|
game: Game,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendGame(
|
||||||
|
chat.id, game.title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -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.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -7,6 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AnimationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AnimationContent
|
||||||
@ -112,3 +115,137 @@ data class SendAnimationFiles internal constructor(
|
|||||||
animationField to animation,
|
animationField to animation,
|
||||||
thumbField to thumb
|
thumbField to thumb
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: FileId,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendAnimationData(
|
||||||
|
chatId,
|
||||||
|
animation.fileId,
|
||||||
|
thumb ?.fileId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
duration,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: AnimationFile,
|
||||||
|
thumb: PhotoSize? = animation.thumb,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendAnimation(
|
||||||
|
chatId, animation.fileId, thumb ?.fileId, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: MultipartFile,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendAnimationData(
|
||||||
|
chatId, null, thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendAnimationFiles(animation)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: MultipartFile,
|
||||||
|
thumb: MultipartFile? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendAnimationData(
|
||||||
|
chatId, null, null, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendAnimationFiles(animation, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: FileId,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendAnimationData(
|
||||||
|
chatId, animation.fileId, null, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendAnimationFiles(null, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: MultipartFile,
|
||||||
|
thumb: PhotoSize? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendAnimation(
|
||||||
|
chatId, animation, thumb ?.fileId , text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: AnimationFile,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendAnimation(
|
||||||
|
chatId, animation.fileId, thumb, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
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.CommonAbstracts.Performerable
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -8,6 +9,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AudioContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AudioContent
|
||||||
@ -114,3 +117,138 @@ data class SendAudioFiles internal constructor(
|
|||||||
audioField to audio,
|
audioField to audio,
|
||||||
thumbField to thumb
|
thumbField to thumb
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: FileId,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendAudioData(
|
||||||
|
chatId,
|
||||||
|
audio.fileId,
|
||||||
|
thumb ?.fileId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
duration,
|
||||||
|
performer,
|
||||||
|
title,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: AudioFile,
|
||||||
|
thumb: PhotoSize? = audio.thumb,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
title: String? = audio.title,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendAudio(
|
||||||
|
chatId, audio.fileId, thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: MultipartFile,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendAudioData(
|
||||||
|
chatId, null, thumb ?.fileId, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendAudioFiles(audio)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: MultipartFile,
|
||||||
|
thumb: MultipartFile? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendAudioData(
|
||||||
|
chatId, null, null, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendAudioFiles(audio, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: FileId,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendAudioData(
|
||||||
|
chatId, audio.fileId, null, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendAudioFiles(null, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: MultipartFile,
|
||||||
|
thumb: PhotoSize? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendAudio(
|
||||||
|
chatId, audio, thumb ?.fileId , text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: AudioFile,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
title: String? = audio.title,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendAudio(
|
||||||
|
chatId, audio.fileId, thumb, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -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.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -7,6 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.DocumentContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.DocumentContent
|
||||||
@ -98,3 +101,118 @@ data class SendDocumentFiles internal constructor(
|
|||||||
documentField to document,
|
documentField to document,
|
||||||
thumbField to thumb
|
thumbField to thumb
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: FileId,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendDocumentData(
|
||||||
|
chatId,
|
||||||
|
document.fileId,
|
||||||
|
thumb ?.fileId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: DocumentFile,
|
||||||
|
thumb: PhotoSize? = document.thumb,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendDocument(
|
||||||
|
chatId, document.fileId, thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: MultipartFile,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendDocumentData(
|
||||||
|
chatId, null, thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendDocumentFiles(document)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: MultipartFile,
|
||||||
|
thumb: MultipartFile? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendDocumentData(
|
||||||
|
chatId, null, null, text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendDocumentFiles(document, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: FileId,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendDocumentData(
|
||||||
|
chatId, document.fileId, null, text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendDocumentFiles(null, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: MultipartFile,
|
||||||
|
thumb: PhotoSize? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendDocument(
|
||||||
|
chatId, document, thumb ?.fileId , text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: DocumentFile,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendDocument(
|
||||||
|
chatId, document.fileId, thumb, text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls
|
||||||
@ -85,3 +87,23 @@ data class SendMediaGroupData internal constructor(
|
|||||||
data class SendMediaGroupFiles internal constructor(
|
data class SendMediaGroupFiles internal constructor(
|
||||||
val files: List<MultipartFile>
|
val files: List<MultipartFile>
|
||||||
) : Files by (files.map { it.fileId to it }.toMap())
|
) : Files by (files.map { it.fileId to it }.toMap())
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendMediaGroup(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
media: List<MediaGroupMemberInputMedia>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null
|
||||||
|
) = execute(
|
||||||
|
SendMediaGroup(
|
||||||
|
chatId, media, disableNotification, replyToMessageId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendMediaGroup(
|
||||||
|
chat: Chat,
|
||||||
|
media: List<MediaGroupMemberInputMedia>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null
|
||||||
|
) = sendMediaGroup(
|
||||||
|
chat.id, media, disableNotification, replyToMessageId
|
||||||
|
)
|
||||||
|
@ -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.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -7,6 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
|
||||||
@ -82,3 +85,89 @@ data class SendPhotoFiles internal constructor(
|
|||||||
) : Files by mapOf(
|
) : Files by mapOf(
|
||||||
photoField to photo
|
photoField to photo
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendPhoto(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendPhotoData(
|
||||||
|
chatId,
|
||||||
|
fileId.fileId,
|
||||||
|
caption,
|
||||||
|
parseMode,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendPhoto(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
file: PhotoSize,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendPhoto(
|
||||||
|
chatId, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendPhoto(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
photo: Photo,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendPhoto(
|
||||||
|
chatId, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendPhoto(
|
||||||
|
chat: Chat,
|
||||||
|
fileId: FileId,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendPhoto(
|
||||||
|
chat.id,
|
||||||
|
fileId,
|
||||||
|
caption,
|
||||||
|
parseMode,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendPhoto(
|
||||||
|
chat: Chat,
|
||||||
|
file: PhotoSize,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendPhoto(
|
||||||
|
chat.id, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendPhoto(
|
||||||
|
chat: Chat,
|
||||||
|
photo: Photo,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendPhoto(
|
||||||
|
chat.id, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.StickerContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.StickerContent
|
||||||
@ -64,3 +68,60 @@ data class SendStickerByFile internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendSticker(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
sticker: FileId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendStickerByFileId(chatId, sticker, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendSticker(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendStickerByFile(
|
||||||
|
SendStickerByFileId(chatId, null, disableNotification, replyToMessageId, replyMarkup),
|
||||||
|
sticker
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendSticker(
|
||||||
|
chat: Chat,
|
||||||
|
sticker: FileId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendSticker(
|
||||||
|
chat: Chat,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendSticker(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
sticker: Sticker,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendSticker(
|
||||||
|
chatId, sticker.fileId, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendSticker(
|
||||||
|
chat: Chat,
|
||||||
|
sticker: Sticker,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendSticker(chat.id, sticker.fileId, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
|
@ -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.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -7,6 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoContent
|
||||||
@ -116,3 +119,141 @@ data class SendVideoFiles internal constructor(
|
|||||||
videoField to video,
|
videoField to video,
|
||||||
thumbField to thumb
|
thumbField to thumb
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: FileId,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendVideoData(
|
||||||
|
chatId,
|
||||||
|
video.fileId,
|
||||||
|
thumb ?.fileId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
duration,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
null,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: VideoFile,
|
||||||
|
thumb: PhotoSize? = video.thumb,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVideo(
|
||||||
|
chatId, video.fileId, thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: MultipartFile,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
supportStreaming: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVideoData(
|
||||||
|
chatId, null, thumb ?.fileId, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVideoFiles(video)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: MultipartFile,
|
||||||
|
thumb: MultipartFile? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
supportStreaming: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVideoData(
|
||||||
|
chatId, null, null, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVideoFiles(video, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: FileId,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVideoData(
|
||||||
|
chatId, video.fileId, null, text, parseMode, duration, width, height, null, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVideoFiles(null, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: MultipartFile,
|
||||||
|
thumb: PhotoSize? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
supportStreaming: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVideo(
|
||||||
|
chatId, video, thumb ?.fileId , text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: VideoFile,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVideo(
|
||||||
|
chatId, video.fileId, thumb, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
@ -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.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -7,6 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoNoteContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoNoteContent
|
||||||
@ -111,3 +114,130 @@ data class SendVideoNoteFiles internal constructor(
|
|||||||
videoNoteField to videoNote,
|
videoNoteField to videoNote,
|
||||||
thumbField to thumb
|
thumbField to thumb
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: FileId,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
size: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendVideoNoteData(
|
||||||
|
chatId,
|
||||||
|
videoNote.fileId,
|
||||||
|
thumb ?.fileId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
duration,
|
||||||
|
size,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: VideoFile,
|
||||||
|
thumb: PhotoSize? = videoNote.thumb,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVideoNote(
|
||||||
|
chatId, videoNote.fileId, thumb ?.fileId, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: MultipartFile,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
size: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVideoNoteData(
|
||||||
|
chatId, null, thumb ?.fileId, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVideoNoteFiles(videoNote)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: MultipartFile,
|
||||||
|
thumb: MultipartFile? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
size: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVideoNoteData(
|
||||||
|
chatId, null, null, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVideoNoteFiles(videoNote, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: FileId,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
size: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVideoNoteData(
|
||||||
|
chatId, videoNote.fileId, null, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVideoNoteFiles(null, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: MultipartFile,
|
||||||
|
thumb: PhotoSize? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
size: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVideoNote(
|
||||||
|
chatId, videoNote, thumb ?.fileId , text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVideoNote(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
videoNote: VideoFile,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVideoNote(
|
||||||
|
chatId, videoNote.fileId, thumb, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -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.bot.RequestsExecutor
|
||||||
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.*
|
||||||
@ -7,6 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
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
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VoiceContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VoiceContent
|
||||||
@ -103,3 +106,125 @@ data class SendVoiceFiles internal constructor(
|
|||||||
voiceField to voice,
|
voiceField to voice,
|
||||||
thumbField to thumb
|
thumbField to thumb
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: FileId,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendVoiceData(
|
||||||
|
chatId,
|
||||||
|
voice.fileId,
|
||||||
|
thumb ?.fileId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
duration,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: AudioFile,
|
||||||
|
thumb: PhotoSize? = voice.thumb,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVoice(
|
||||||
|
chatId, voice.fileId, thumb ?.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: MultipartFile,
|
||||||
|
thumb: FileId? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVoiceData(
|
||||||
|
chatId, null, thumb ?.fileId, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVoiceFiles(voice)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: MultipartFile,
|
||||||
|
thumb: MultipartFile? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVoiceData(
|
||||||
|
chatId, null, null, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVoiceFiles(voice, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: FileId,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SendVoiceData(
|
||||||
|
chatId, voice.fileId, null, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
),
|
||||||
|
SendVoiceFiles(null, thumb)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: MultipartFile,
|
||||||
|
thumb: PhotoSize? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVoice(
|
||||||
|
chatId, voice, thumb ?.fileId , text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: AudioFile,
|
||||||
|
thumb: MultipartFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendVoice(
|
||||||
|
chatId, voice.fileId, thumb, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPrice
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPrice
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPricesSerializer
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPricesSerializer
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.abstracts.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
private val invoiceMessageSerializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
|
||||||
|
= TelegramBotAPIMessageDeserializationStrategyClass()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param providerData - JSON-ENCODED FIELD
|
* @param providerData - JSON-ENCODED FIELD
|
||||||
*/
|
*/
|
||||||
@ -61,10 +65,10 @@ data class SendInvoice(
|
|||||||
DisableNotification,
|
DisableNotification,
|
||||||
ReplyMessageId,
|
ReplyMessageId,
|
||||||
ReplyMarkup,
|
ReplyMarkup,
|
||||||
SendMessageRequest<Message> {
|
SendMessageRequest<ContentMessage<InvoiceContent>> {
|
||||||
override fun method(): String = "sendInvoice"
|
override fun method(): String = "sendInvoice"
|
||||||
override val resultDeserializer: DeserializationStrategy<Message>
|
override val resultDeserializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
|
||||||
get() = TelegramBotAPIMessageDeserializationStrategy
|
get() = invoiceMessageSerializer
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
|
||||||
@ -101,3 +105,49 @@ data class SendInvoice(
|
|||||||
photoHeight = null
|
photoHeight = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendInvoice(
|
||||||
|
chatId: ChatId,
|
||||||
|
title: String,
|
||||||
|
description: String,
|
||||||
|
payload: String,
|
||||||
|
providerToken: String,
|
||||||
|
startParameter: StartParameter,
|
||||||
|
currency: Currency,
|
||||||
|
prices: List<LabeledPrice>,
|
||||||
|
providerData: String? = null,
|
||||||
|
requireName: Boolean = false,
|
||||||
|
requirePhoneNumber: Boolean = false,
|
||||||
|
requireEmail: Boolean = false,
|
||||||
|
requireShippingAddress: Boolean = false,
|
||||||
|
shouldSendPhoneNumberToProvider: Boolean = false,
|
||||||
|
shouldSendEmailToProvider: Boolean = false,
|
||||||
|
priceDependOnShipAddress: Boolean = false,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendInvoice(
|
||||||
|
user: CommonUser,
|
||||||
|
title: String,
|
||||||
|
description: String,
|
||||||
|
payload: String,
|
||||||
|
providerToken: String,
|
||||||
|
startParameter: StartParameter,
|
||||||
|
currency: Currency,
|
||||||
|
prices: List<LabeledPrice>,
|
||||||
|
providerData: String? = null,
|
||||||
|
requireName: Boolean = false,
|
||||||
|
requirePhoneNumber: Boolean = false,
|
||||||
|
requireEmail: Boolean = false,
|
||||||
|
requireShippingAddress: Boolean = false,
|
||||||
|
shouldSendPhoneNumberToProvider: Boolean = false,
|
||||||
|
shouldSendEmailToProvider: Boolean = false,
|
||||||
|
priceDependOnShipAddress: Boolean = false,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent
|
||||||
@ -183,3 +185,128 @@ data class SendQuizPoll(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendRegularPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
question: String,
|
||||||
|
options: List<String>,
|
||||||
|
isAnonymous: Boolean = true,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
allowMultipleAnswers: Boolean = false,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendRegularPoll(
|
||||||
|
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
suspend fun RequestsExecutor.sendRegularPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
poll: RegularPoll,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
question: String = poll.question,
|
||||||
|
options: List<String> = poll.options.map { it.text },
|
||||||
|
isAnonymous: Boolean = poll.isAnonymous,
|
||||||
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendRegularPoll(
|
||||||
|
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendRegularPoll(
|
||||||
|
chat: Chat,
|
||||||
|
question: String,
|
||||||
|
options: List<String>,
|
||||||
|
isAnonymous: Boolean = true,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
allowMultipleAnswers: Boolean = false,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendRegularPoll(
|
||||||
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendRegularPoll(
|
||||||
|
chat: Chat,
|
||||||
|
poll: RegularPoll,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
question: String = poll.question,
|
||||||
|
options: List<String> = poll.options.map { it.text },
|
||||||
|
isAnonymous: Boolean = poll.isAnonymous,
|
||||||
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendRegularPoll(
|
||||||
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendQuizPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
question: String,
|
||||||
|
options: List<String>,
|
||||||
|
correctOptionId: Int,
|
||||||
|
isAnonymous: Boolean = true,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendQuizPoll(
|
||||||
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendQuizPoll(
|
||||||
|
chat: Chat,
|
||||||
|
question: String,
|
||||||
|
options: List<String>,
|
||||||
|
correctOptionId: Int,
|
||||||
|
isAnonymous: Boolean = true,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendQuizPoll(
|
||||||
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendQuizPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
quizPoll: QuizPoll,
|
||||||
|
question: String = quizPoll.question,
|
||||||
|
options: List<String> = quizPoll.options.map { it.text },
|
||||||
|
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
|
||||||
|
isAnonymous: Boolean = quizPoll.isAnonymous,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendQuizPoll(
|
||||||
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendQuizPoll(
|
||||||
|
chat: Chat,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
quizPoll: QuizPoll,
|
||||||
|
question: String = quizPoll.question,
|
||||||
|
options: List<String> = quizPoll.options.map { it.text },
|
||||||
|
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
|
||||||
|
isAnonymous: Boolean = quizPoll.isAnonymous,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendQuizPoll(
|
||||||
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||||
|
)
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun AddStickerToSet(
|
fun AddStickerToSet(
|
||||||
@ -48,3 +50,90 @@ data class AddStickerToSet internal constructor(
|
|||||||
|
|
||||||
override fun method(): String = "addStickerToSet"
|
override fun method(): String = "addStickerToSet"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
AddStickerToSet(
|
||||||
|
userId, stickerSetName, emojis, sticker, maskPosition
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CommonMultipartFileRequest(
|
||||||
|
AddStickerToSet(
|
||||||
|
userId, stickerSetName, emojis, null, maskPosition
|
||||||
|
),
|
||||||
|
mapOf(pngStickerField to sticker)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addStickerToSet(
|
||||||
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addStickerToSet(
|
||||||
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addStickerToSet(
|
||||||
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addStickerToSet(
|
||||||
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addStickerToSet(
|
||||||
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addStickerToSet(
|
||||||
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
@ -51,3 +53,52 @@ data class CreateNewStickerSet internal constructor(
|
|||||||
|
|
||||||
override fun method(): String = "createNewStickerSet"
|
override fun method(): String = "createNewStickerSet"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CreateNewStickerSet(userId, name, emojis, sticker, containsMasks, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CommonMultipartFileRequest(
|
||||||
|
CreateNewStickerSet(userId, name, emojis, null, containsMasks, maskPosition),
|
||||||
|
mapOf(pngStickerField to sticker)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewStickerSet(
|
||||||
|
user: CommonUser,
|
||||||
|
name: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = createNewStickerSet(
|
||||||
|
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewStickerSet(
|
||||||
|
user: CommonUser,
|
||||||
|
name: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = createNewStickerSet(
|
||||||
|
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||||
|
)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.BooleanSerializer
|
import kotlinx.serialization.internal.BooleanSerializer
|
||||||
@ -17,3 +19,19 @@ data class DeleteStickerFromSet(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteStickerFromSet(
|
||||||
|
sticker: FileId
|
||||||
|
) = execute(
|
||||||
|
DeleteStickerFromSet(
|
||||||
|
sticker
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.deleteStickerFromSet(
|
||||||
|
sticker: Sticker
|
||||||
|
) = deleteStickerFromSet(
|
||||||
|
sticker.fileId
|
||||||
|
)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.positionField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.positionField
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -26,3 +28,21 @@ data class SetStickerPositionInSet(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setStickerPositionInSet(
|
||||||
|
sticker: FileId,
|
||||||
|
position: Int
|
||||||
|
) = execute(
|
||||||
|
SetStickerPositionInSet(
|
||||||
|
sticker,
|
||||||
|
position
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setStickerPositionInSet(
|
||||||
|
sticker: Sticker,
|
||||||
|
position: Int
|
||||||
|
) = setStickerPositionInSet(
|
||||||
|
sticker.fileId,
|
||||||
|
position
|
||||||
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
@ -27,3 +28,18 @@ data class UploadStickerFile(
|
|||||||
override val resultDeserializer: DeserializationStrategy<File>
|
override val resultDeserializer: DeserializationStrategy<File>
|
||||||
get() = File.serializer()
|
get() = File.serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.uploadStickerFile(
|
||||||
|
userId: UserId,
|
||||||
|
sticker: MultipartFile
|
||||||
|
) = execute(
|
||||||
|
UploadStickerFile(userId, sticker)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.uploadStickerFile(
|
||||||
|
user: CommonUser,
|
||||||
|
sticker: MultipartFile
|
||||||
|
) = execute(
|
||||||
|
UploadStickerFile(user.id, sticker)
|
||||||
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.WebhookInfo
|
import com.github.insanusmokrassar.TelegramBotAPI.types.WebhookInfo
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -13,3 +14,5 @@ class GetWebhookInfo : SimpleRequest<WebhookInfo> {
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getWebhookInfo() = execute(GetWebhookInfo())
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.DataRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.DataRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
|
||||||
@ -64,3 +65,28 @@ data class SetWebhook internal constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setWebhookInfo(
|
||||||
|
url: String,
|
||||||
|
certificate: FileId,
|
||||||
|
maxAllowedConnections: Int? = null,
|
||||||
|
allowedUpdates: List<String>? = null
|
||||||
|
) = execute(
|
||||||
|
SetWebhook(
|
||||||
|
url, certificate.fileId, maxAllowedConnections, allowedUpdates
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setWebhookInfo(
|
||||||
|
url: String,
|
||||||
|
certificate: MultipartFile,
|
||||||
|
maxAllowedConnections: Int? = null,
|
||||||
|
allowedUpdates: List<String>? = null
|
||||||
|
) = execute(
|
||||||
|
MultipartRequestImpl(
|
||||||
|
SetWebhook(
|
||||||
|
url, null, maxAllowedConnections, allowedUpdates
|
||||||
|
),
|
||||||
|
mapOf(certificateField to certificate)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -23,6 +23,8 @@ internal object BotActionSerializer: KSerializer<BotAction> {
|
|||||||
UploadAudioAction.actionName -> UploadAudioAction
|
UploadAudioAction.actionName -> UploadAudioAction
|
||||||
UploadDocumentAction.actionName -> UploadDocumentAction
|
UploadDocumentAction.actionName -> UploadDocumentAction
|
||||||
FindLocationAction.actionName -> FindLocationAction
|
FindLocationAction.actionName -> FindLocationAction
|
||||||
|
RecordVideoNoteAction.actionName -> RecordVideoNoteAction
|
||||||
|
UploadVideoNoteAction.actionName -> UploadVideoNoteAction
|
||||||
else -> throw IllegalStateException("Unknown action type: $actionName")
|
else -> throw IllegalStateException("Unknown action type: $actionName")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,3 +73,13 @@ object UploadDocumentAction : BotAction() {
|
|||||||
object FindLocationAction : BotAction() {
|
object FindLocationAction : BotAction() {
|
||||||
override val actionName: String = "find_location"
|
override val actionName: String = "find_location"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable(BotActionSerializer::class)
|
||||||
|
object RecordVideoNoteAction : BotAction() {
|
||||||
|
override val actionName: String = "record_video_note"
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable(BotActionSerializer::class)
|
||||||
|
object UploadVideoNoteAction : BotAction() {
|
||||||
|
override val actionName: String = "upload_video_note"
|
||||||
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Photo
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.CommonEvent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.CommonEvent
|
||||||
|
|
||||||
data class NewChatPhoto(
|
data class NewChatPhoto(
|
||||||
val photo: List<PhotoSize>
|
val photo: Photo
|
||||||
): CommonEvent
|
): CommonEvent
|
||||||
|
@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMa
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.SuccessfulPaymentInfo
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
|
|
||||||
@ -19,5 +20,5 @@ data class CommonMessageImpl<T: MessageContent>(
|
|||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
val paymentInfo: PaymentInfo?
|
val paymentInfo: SuccessfulPaymentInfo?
|
||||||
) : Message, CommonMessage<T>, FromUserMessage
|
) : Message, CommonMessage<T>, FromUserMessage
|
@ -14,9 +14,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Unknow
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceOfPayment
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.SuccessfulPaymentInfo
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.SuccessfulPaymentInfo
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||||
@ -130,6 +129,7 @@ internal data class RawMessage(
|
|||||||
location != null -> LocationContent(location)
|
location != null -> LocationContent(location)
|
||||||
venue != null -> VenueContent(venue)
|
venue != null -> VenueContent(venue)
|
||||||
poll != null -> PollContent(poll)
|
poll != null -> PollContent(poll)
|
||||||
|
invoice != null -> InvoiceContent(invoice)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,9 +175,8 @@ internal data class RawMessage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val paymentInfo: PaymentInfo? by lazy {
|
private val paymentInfo: SuccessfulPaymentInfo? by lazy {
|
||||||
when {
|
when {
|
||||||
invoice != null -> InvoiceOfPayment(invoice)
|
|
||||||
successful_payment != null -> SuccessfulPaymentInfo(successful_payment)
|
successful_payment != null -> SuccessfulPaymentInfo(successful_payment)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.biggest
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaCollectionContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaCollectionContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||||
@ -19,7 +18,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
||||||
|
|
||||||
data class PhotoContent(
|
data class PhotoContent(
|
||||||
override val mediaCollection: List<PhotoSize>,
|
override val mediaCollection: Photo,
|
||||||
override val caption: String? = null,
|
override val caption: String? = null,
|
||||||
override val captionEntities: List<TextPart> = emptyList()
|
override val captionEntities: List<TextPart> = emptyList()
|
||||||
) : MediaCollectionContent<PhotoSize>, MediaGroupContent {
|
) : MediaCollectionContent<PhotoSize>, MediaGroupContent {
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.payments
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
|
||||||
|
|
||||||
|
data class InvoiceContent(
|
||||||
|
val invoice: Invoice
|
||||||
|
) : MessageContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<ContentMessage<InvoiceContent>> {
|
||||||
|
error("Unfortunately, currently InvoiceOfPayment can not be resend due to requirement of additional parameters," +
|
||||||
|
" which can't be provided during the call of this method")
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.payments
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
|
|
||||||
|
|
||||||
data class InvoiceOfPayment(
|
|
||||||
val invoice: Invoice
|
|
||||||
) : PaymentInfo
|
|
@ -26,6 +26,8 @@ class BotActionTests {
|
|||||||
UploadAudioAction -> example.botAction.actionName
|
UploadAudioAction -> example.botAction.actionName
|
||||||
UploadDocumentAction -> example.botAction.actionName
|
UploadDocumentAction -> example.botAction.actionName
|
||||||
FindLocationAction -> example.botAction.actionName
|
FindLocationAction -> example.botAction.actionName
|
||||||
|
RecordVideoNoteAction -> example.botAction.actionName
|
||||||
|
UploadVideoNoteAction -> example.botAction.actionName
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -52,7 +54,9 @@ class BotActionTests {
|
|||||||
RecordAudioAction.example(),
|
RecordAudioAction.example(),
|
||||||
UploadAudioAction.example(),
|
UploadAudioAction.example(),
|
||||||
UploadDocumentAction.example(),
|
UploadDocumentAction.example(),
|
||||||
FindLocationAction.example()
|
FindLocationAction.example(),
|
||||||
|
RecordVideoNoteAction.example(),
|
||||||
|
UploadVideoNoteAction.example()
|
||||||
).forEach {
|
).forEach {
|
||||||
checkBotActionSerializeDeserialize(it)
|
checkBotActionSerializeDeserialize(it)
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
fun File.toInputFile(): InputFile = MultipartFile(
|
fun File.toInputFile() = MultipartFile(
|
||||||
StorageFile(this)
|
StorageFile(this)
|
||||||
)
|
)
|
||||||
|
@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdateReceiver
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdateReceiver
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
|
import io.ktor.client.engine.HttpClientEngine
|
||||||
import io.ktor.client.engine.cio.CIO
|
import io.ktor.client.engine.cio.CIO
|
||||||
import io.ktor.client.engine.cio.endpoint
|
import io.ktor.client.engine.cio.endpoint
|
||||||
import io.ktor.util.KtorExperimentalAPI
|
import io.ktor.util.KtorExperimentalAPI
|
||||||
@ -42,3 +43,35 @@ fun KtorUpdatesPoller(
|
|||||||
updatesReceiver
|
updatesReceiver
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@KtorExperimentalAPI
|
||||||
|
fun KtorUpdatesPoller(
|
||||||
|
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
|
timeoutSeconds: Int? = null,
|
||||||
|
oneTimeUpdatesLimit: Int? = null,
|
||||||
|
allowedUpdates: List<String> = ALL_UPDATES_LIST,
|
||||||
|
exceptionsHandler: (Exception) -> Boolean = { true },
|
||||||
|
clientEngine: HttpClientEngine = CIO.create {
|
||||||
|
endpoint {
|
||||||
|
timeoutSeconds ?.times(1000) ?.also { timeOutMillis ->
|
||||||
|
keepAliveTime = timeOutMillis.toLong()
|
||||||
|
}
|
||||||
|
connectTimeout = 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updatesReceiver: UpdateReceiver<Update>
|
||||||
|
): KtorUpdatesPoller {
|
||||||
|
val executor = KtorRequestsExecutor(
|
||||||
|
telegramAPIUrlsKeeper,
|
||||||
|
HttpClient(clientEngine)
|
||||||
|
)
|
||||||
|
|
||||||
|
return KtorUpdatesPoller(
|
||||||
|
executor,
|
||||||
|
timeoutSeconds,
|
||||||
|
oneTimeUpdatesLimit,
|
||||||
|
allowedUpdates,
|
||||||
|
exceptionsHandler,
|
||||||
|
updatesReceiver
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user