mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
moving to an explicit API mode
refactored the rest 🌚
This commit is contained in:
parent
f36373b718
commit
4085913bc3
@ -12,7 +12,7 @@ import io.ktor.client.engine.*
|
|||||||
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
|
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
|
||||||
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
|
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
|
||||||
*/
|
*/
|
||||||
data class BotBuilder internal constructor(
|
public data class BotBuilder internal constructor(
|
||||||
var proxy: ProxyConfig? = null,
|
var proxy: ProxyConfig? = null,
|
||||||
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
|
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
|
||||||
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null
|
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null
|
||||||
@ -37,12 +37,12 @@ data class BotBuilder internal constructor(
|
|||||||
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
||||||
* [block]
|
* [block]
|
||||||
*/
|
*/
|
||||||
fun buildBot(
|
public fun buildBot(
|
||||||
token: String,
|
token: String,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
block: BotBuilder.() -> Unit
|
block: BotBuilder.() -> Unit
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||||
BotBuilder().apply(block).createHttpClient()
|
BotBuilder().apply(block).createHttpClient()
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ import io.ktor.client.engine.*
|
|||||||
/**
|
/**
|
||||||
* Allows to create bot using bot [urlsKeeper] and already prepared [client]
|
* Allows to create bot using bot [urlsKeeper] and already prepared [client]
|
||||||
*/
|
*/
|
||||||
fun telegramBot(
|
public fun telegramBot(
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
client: HttpClient = HttpClient()
|
client: HttpClient = HttpClient()
|
||||||
): TelegramBot = telegramBot(urlsKeeper) {
|
): TelegramBot = telegramBot(urlsKeeper) {
|
||||||
@ -23,11 +23,11 @@ fun telegramBot(
|
|||||||
* configure it with [clientConfig]
|
* configure it with [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun <T: HttpClientEngineConfig> telegramBot(
|
public inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
clientFactory: HttpClientEngineFactory<T>,
|
clientFactory: HttpClientEngineFactory<T>,
|
||||||
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
urlsKeeper,
|
urlsKeeper,
|
||||||
HttpClient(clientFactory, clientConfig)
|
HttpClient(clientFactory, clientConfig)
|
||||||
)
|
)
|
||||||
@ -37,11 +37,11 @@ inline fun <T: HttpClientEngineConfig> telegramBot(
|
|||||||
* configure [HttpClient] using [clientConfig]
|
* configure [HttpClient] using [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun telegramBot(
|
public inline fun telegramBot(
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
clientEngine: HttpClientEngine,
|
clientEngine: HttpClientEngine,
|
||||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
urlsKeeper,
|
urlsKeeper,
|
||||||
HttpClient(clientEngine, clientConfig)
|
HttpClient(clientEngine, clientConfig)
|
||||||
)
|
)
|
||||||
@ -51,10 +51,10 @@ inline fun telegramBot(
|
|||||||
* [clientConfig]
|
* [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun telegramBot(
|
public inline fun telegramBot(
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
urlsKeeper,
|
urlsKeeper,
|
||||||
HttpClient(clientConfig)
|
HttpClient(clientConfig)
|
||||||
)
|
)
|
||||||
@ -63,7 +63,7 @@ inline fun telegramBot(
|
|||||||
* Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]
|
* Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun telegramBot(
|
public inline fun telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
@ -71,13 +71,13 @@ inline fun telegramBot(
|
|||||||
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client)
|
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client)
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun <T: HttpClientEngineConfig> telegramBot(
|
public inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
clientFactory: HttpClientEngineFactory<T>,
|
clientFactory: HttpClientEngineFactory<T>,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||||
clientFactory,
|
clientFactory,
|
||||||
clientConfig
|
clientConfig
|
||||||
@ -88,13 +88,13 @@ inline fun <T: HttpClientEngineConfig> telegramBot(
|
|||||||
* configure [HttpClient] using [clientConfig]
|
* configure [HttpClient] using [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun telegramBot(
|
public inline fun telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
clientEngine: HttpClientEngine,
|
clientEngine: HttpClientEngine,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||||
clientEngine,
|
clientEngine,
|
||||||
clientConfig
|
clientConfig
|
||||||
@ -105,12 +105,12 @@ inline fun telegramBot(
|
|||||||
* [clientConfig]
|
* [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun telegramBot(
|
public inline fun telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
||||||
) = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||||
clientConfig
|
clientConfig
|
||||||
)
|
)
|
||||||
|
@ -4,4 +4,4 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.local.Close
|
import dev.inmo.tgbotapi.requests.local.Close
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
suspend inline fun TelegramBot.close() = execute(Close)
|
public suspend inline fun TelegramBot.close(): Boolean = execute(Close)
|
||||||
|
@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
public suspend fun TelegramBot.deleteMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
DeleteMessage(chatId, messageId)
|
DeleteMessage(chatId, messageId)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
public suspend fun TelegramBot.deleteMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
) = deleteMessage(chat.id, messageId)
|
): Boolean = deleteMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
public suspend fun TelegramBot.deleteMessage(
|
||||||
message: AccessibleMessage
|
message: AccessibleMessage
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||||
@ -34,20 +34,20 @@ suspend fun TelegramBot.deleteMessage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
) = deleteMessage(chatId, messageId)
|
): Boolean = deleteMessage(chatId, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
) = deleteMessage(chat, messageId)
|
): Boolean = deleteMessage(chat, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
message: AccessibleMessage
|
message: AccessibleMessage
|
||||||
) = deleteMessage(message)
|
): Boolean = deleteMessage(message)
|
||||||
|
|
||||||
suspend fun AccessibleMessage.delete(
|
public suspend fun AccessibleMessage.delete(
|
||||||
requestsExecutor: TelegramBot
|
requestsExecutor: TelegramBot
|
||||||
) = requestsExecutor.deleteMessage(this)
|
): Boolean = requestsExecutor.deleteMessage(this)
|
||||||
|
@ -7,10 +7,10 @@ import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>
|
messageIds: List<MessageId>
|
||||||
) = messageIds.chunked(deleteMessagesLimit.last).map {
|
): Boolean = messageIds.chunked(deleteMessagesLimit.last).map {
|
||||||
execute(
|
execute(
|
||||||
DeleteMessages(
|
DeleteMessages(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
@ -19,17 +19,17 @@ suspend fun TelegramBot.deleteMessages(
|
|||||||
)
|
)
|
||||||
}.all { it }
|
}.all { it }
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>
|
messageIds: Array<MessageId>
|
||||||
) = deleteMessages(
|
): Boolean = deleteMessages(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
messageIds = messageIds.toList()
|
messageIds = messageIds.toList()
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
messagesMetas: List<Message.MetaInfo>
|
messagesMetas: List<Message.MetaInfo>
|
||||||
) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
|
): Boolean = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
|
||||||
deleteMessages(
|
deleteMessages(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
messageIds = messages.map { it.messageId }
|
messageIds = messages.map { it.messageId }
|
||||||
@ -37,25 +37,25 @@ suspend fun TelegramBot.deleteMessages(
|
|||||||
}.all { it }
|
}.all { it }
|
||||||
|
|
||||||
@JvmName("deleteMessagesWithMessages")
|
@JvmName("deleteMessagesWithMessages")
|
||||||
suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
messages: List<AccessibleMessage>
|
messages: List<AccessibleMessage>
|
||||||
) = deleteMessages(messages.map { it.metaInfo })
|
): Boolean = deleteMessages(messages.map { it.metaInfo })
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>
|
messageIds: List<MessageId>
|
||||||
) = deleteMessages(chatId = chatId, messageIds = messageIds)
|
): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>
|
messageIds: Array<MessageId>
|
||||||
) = deleteMessages(chatId = chatId, messageIds = messageIds)
|
): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
messagesMetas: List<Message.MetaInfo>
|
messagesMetas: List<Message.MetaInfo>
|
||||||
) = deleteMessages(messagesMetas)
|
): Boolean = deleteMessages(messagesMetas)
|
||||||
|
|
||||||
@JvmName("deleteWithMessages")
|
@JvmName("deleteWithMessages")
|
||||||
suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
messages: List<AccessibleMessage>
|
messages: List<AccessibleMessage>
|
||||||
) = deleteMessages(messages)
|
): Boolean = deleteMessages(messages)
|
||||||
|
@ -7,58 +7,59 @@ import dev.inmo.tgbotapi.types.MessageId
|
|||||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||||
import dev.inmo.tgbotapi.types.threadId
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = execute(
|
): PossiblyForwardedMessage = execute(
|
||||||
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
|
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)
|
||||||
|
@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessages(
|
public suspend fun TelegramBot.forwardMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>,
|
messageIds: List<MessageId>,
|
||||||
@ -16,7 +16,7 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = messageIds.chunked(forwardMessagesLimit.last).flatMap {
|
): List<MessageId> = messageIds.chunked(forwardMessagesLimit.last).flatMap {
|
||||||
execute(
|
execute(
|
||||||
ForwardMessages(
|
ForwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
@ -30,7 +30,7 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessages(
|
public suspend fun TelegramBot.forwardMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>,
|
messageIds: Array<MessageId>,
|
||||||
@ -38,7 +38,7 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = forwardMessages(
|
): List<MessageId> = forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = messageIds.toList(),
|
messageIds = messageIds.toList(),
|
||||||
@ -48,14 +48,14 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessages(
|
public suspend fun TelegramBot.forwardMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messagesMetas: List<Message.MetaInfo>,
|
messagesMetas: List<Message.MetaInfo>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
|
): List<MessageId> = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
|
||||||
forwardMessages(
|
forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
fromChatId = chatId,
|
fromChatId = chatId,
|
||||||
@ -68,14 +68,14 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("forwardMessagesWithMessages")
|
@JvmName("forwardMessagesWithMessages")
|
||||||
suspend fun TelegramBot.forwardMessages(
|
public suspend fun TelegramBot.forwardMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = forwardMessages(
|
): List<MessageId> = forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
messagesMetas = messages.map { it.metaInfo },
|
messagesMetas = messages.map { it.metaInfo },
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
@ -84,7 +84,7 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forward(
|
public suspend fun TelegramBot.forward(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>,
|
messageIds: List<MessageId>,
|
||||||
@ -92,7 +92,7 @@ suspend fun TelegramBot.forward(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = forwardMessages(
|
): List<MessageId> = forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = messageIds,
|
messageIds = messageIds,
|
||||||
@ -102,7 +102,7 @@ suspend fun TelegramBot.forward(
|
|||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forward(
|
public suspend fun TelegramBot.forward(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>,
|
messageIds: Array<MessageId>,
|
||||||
@ -110,7 +110,7 @@ suspend fun TelegramBot.forward(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = forwardMessages(
|
): List<MessageId> = forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = messageIds,
|
messageIds = messageIds,
|
||||||
@ -120,14 +120,14 @@ suspend fun TelegramBot.forward(
|
|||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forward(
|
public suspend fun TelegramBot.forward(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messagesMetas: List<Message.MetaInfo>,
|
messagesMetas: List<Message.MetaInfo>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = forwardMessages(
|
): List<MessageId> = forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
messagesMetas = messagesMetas,
|
messagesMetas = messagesMetas,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
@ -137,14 +137,14 @@ suspend fun TelegramBot.forward(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@JvmName("forwardWithMessages")
|
@JvmName("forwardWithMessages")
|
||||||
suspend fun TelegramBot.forward(
|
public suspend fun TelegramBot.forward(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
) = forwardMessages(
|
): List<MessageId> = forwardMessages(
|
||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
messages = messages,
|
messages = messages,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
@ -5,22 +5,22 @@ import dev.inmo.tgbotapi.requests.GetUpdates
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
suspend fun TelegramBot.getUpdates(
|
public suspend fun TelegramBot.getUpdates(
|
||||||
offset: UpdateId? = null,
|
offset: UpdateId? = null,
|
||||||
limit: Int = getUpdatesLimit.last,
|
limit: Int = getUpdatesLimit.last,
|
||||||
timeout: Seconds? = null,
|
timeout: Seconds? = null,
|
||||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
) = execute(
|
): List<Update> = execute(
|
||||||
GetUpdates(
|
GetUpdates(
|
||||||
offset, limit, timeout, allowed_updates
|
offset, limit, timeout, allowed_updates
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.getUpdates(
|
public suspend fun TelegramBot.getUpdates(
|
||||||
lastUpdate: Update,
|
lastUpdate: Update,
|
||||||
limit: Int = getUpdatesLimit.last,
|
limit: Int = getUpdatesLimit.last,
|
||||||
timeout: Seconds? = null,
|
timeout: Seconds? = null,
|
||||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
) = getUpdates(
|
): List<Update> = getUpdates(
|
||||||
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
||||||
)
|
)
|
||||||
|
@ -4,23 +4,24 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
|
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
|
||||||
suspend fun TelegramBot.getRawUpdates(
|
public suspend fun TelegramBot.getRawUpdates(
|
||||||
offset: UpdateId? = null,
|
offset: UpdateId? = null,
|
||||||
limit: Int = getUpdatesLimit.last,
|
limit: Int = getUpdatesLimit.last,
|
||||||
timeout: Seconds? = null,
|
timeout: Seconds? = null,
|
||||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
) = execute(
|
): JsonArray = execute(
|
||||||
GetUpdatesRaw(
|
GetUpdatesRaw(
|
||||||
offset, limit, timeout, allowed_updates
|
offset, limit, timeout, allowed_updates
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.getRawUpdates(
|
public suspend fun TelegramBot.getRawUpdates(
|
||||||
lastUpdate: Update,
|
lastUpdate: Update,
|
||||||
limit: Int = getUpdatesLimit.last,
|
limit: Int = getUpdatesLimit.last,
|
||||||
timeout: Seconds? = null,
|
timeout: Seconds? = null,
|
||||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
) = getRawUpdates(
|
): JsonArray = getRawUpdates(
|
||||||
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
|
||||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
|
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
|
||||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||||
import dev.inmo.tgbotapi.abstracts.*
|
import dev.inmo.tgbotapi.abstracts.Headed
|
||||||
|
import dev.inmo.tgbotapi.abstracts.HorizontallyAccured
|
||||||
|
import dev.inmo.tgbotapi.abstracts.Locationed
|
||||||
|
import dev.inmo.tgbotapi.abstracts.ProximityAlertable
|
||||||
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||||
@ -16,17 +18,20 @@ import dev.inmo.tgbotapi.types.location.LiveLocation
|
|||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.CoroutineStart
|
||||||
|
import kotlinx.coroutines.currentCoroutineContext
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.FlowCollector
|
import kotlinx.coroutines.flow.FlowCollector
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
import kotlinx.coroutines.isActive
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.js.JsName
|
import kotlin.js.JsName
|
||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EditLiveLocationInfo(
|
public data class EditLiveLocationInfo(
|
||||||
override val latitude: Double,
|
override val latitude: Double,
|
||||||
override val longitude: Double,
|
override val longitude: Double,
|
||||||
override val horizontalAccuracy: Meters? = null,
|
override val horizontalAccuracy: Meters? = null,
|
||||||
@ -39,7 +44,7 @@ data class EditLiveLocationInfo(
|
|||||||
* Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing,
|
* Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing,
|
||||||
* the message will be sent again and new edits will be applied to the new message
|
* the message will be sent again and new edits will be applied to the new message
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.handleLiveLocation(
|
public suspend fun TelegramBot.handleLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
locationsFlow: Flow<EditLiveLocationInfo>,
|
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
@ -112,7 +117,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
*/
|
*/
|
||||||
@JvmName("handleLiveLocationWithLocation")
|
@JvmName("handleLiveLocationWithLocation")
|
||||||
@JsName("handleLiveLocationWithLocation")
|
@JsName("handleLiveLocationWithLocation")
|
||||||
suspend fun TelegramBot.handleLiveLocation(
|
public suspend fun TelegramBot.handleLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
locationsFlow: Flow<Location>,
|
locationsFlow: Flow<Location>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
@ -153,7 +158,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
*/
|
*/
|
||||||
@JvmName("handleLiveLocationWithLatLong")
|
@JvmName("handleLiveLocationWithLatLong")
|
||||||
@JsName("handleLiveLocationWithLatLong")
|
@JsName("handleLiveLocationWithLatLong")
|
||||||
suspend fun TelegramBot.handleLiveLocation(
|
public suspend fun TelegramBot.handleLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
locationsFlow: Flow<Pair<Double, Double>>,
|
locationsFlow: Flow<Pair<Double, Double>>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
@ -23,13 +23,13 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
const val indefiniteLivePeriodDelayMillis = LiveLocation.INDEFINITE_LIVE_PERIOD * 1000L
|
public const val indefiniteLivePeriodDelayMillis: Long = LiveLocation.INDEFINITE_LIVE_PERIOD * 1000L
|
||||||
const val defaultLivePeriodDelayMillis = indefiniteLivePeriodDelayMillis
|
public const val defaultLivePeriodDelayMillis: Long = indefiniteLivePeriodDelayMillis
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see startLiveLocation
|
* @see startLiveLocation
|
||||||
*/
|
*/
|
||||||
class LiveLocationProvider internal constructor(
|
public class LiveLocationProvider internal constructor(
|
||||||
private val requestsExecutor: TelegramBot,
|
private val requestsExecutor: TelegramBot,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
autoCloseTimeDelay: Double,
|
autoCloseTimeDelay: Double,
|
||||||
@ -41,23 +41,23 @@ class LiveLocationProvider internal constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay)
|
private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay)
|
||||||
val leftUntilCloseMillis: TimeSpan
|
public val leftUntilCloseMillis: TimeSpan
|
||||||
get() = autoCloseTime - DateTime.now()
|
get() = autoCloseTime - DateTime.now()
|
||||||
|
|
||||||
var isClosed: Boolean = false
|
public var isClosed: Boolean = false
|
||||||
private set
|
private set
|
||||||
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
||||||
|
|
||||||
var message: ContentMessage<LocationContent> = initMessage
|
public var message: ContentMessage<LocationContent> = initMessage
|
||||||
private set
|
private set
|
||||||
val lastLocation: LiveLocation
|
public val lastLocation: LiveLocation
|
||||||
get() = message.content.location as LiveLocation
|
get() = message.content.location as LiveLocation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun updateLocation(
|
public suspend fun updateLocation(
|
||||||
location: LiveLocation,
|
location: LiveLocation,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
): LiveLocation {
|
): LiveLocation {
|
||||||
@ -86,7 +86,7 @@ class LiveLocationProvider internal constructor(
|
|||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.startLiveLocation(
|
public suspend fun TelegramBot.startLiveLocation(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
@ -135,7 +135,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.startLiveLocation(
|
public suspend fun TelegramBot.startLiveLocation(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
@ -173,7 +173,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.startLiveLocation(
|
public suspend fun TelegramBot.startLiveLocation(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
@ -210,7 +210,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.startLiveLocation(
|
public suspend fun TelegramBot.startLiveLocation(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
@ -247,7 +247,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
public suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||||
to: AccessibleMessage,
|
to: AccessibleMessage,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
@ -263,7 +263,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
scope,
|
scope,
|
||||||
to.chat,
|
to.chat,
|
||||||
latitude,
|
latitude,
|
||||||
@ -285,7 +285,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
public suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||||
to: AccessibleMessage,
|
to: AccessibleMessage,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
@ -300,7 +300,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
scope,
|
scope,
|
||||||
to.chat,
|
to.chat,
|
||||||
location,
|
location,
|
||||||
|
@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.local.LogOut
|
import dev.inmo.tgbotapi.requests.local.LogOut
|
||||||
|
|
||||||
suspend inline fun TelegramBot.logOut() = execute(LogOut)
|
public suspend inline fun TelegramBot.logOut(): Boolean = execute(LogOut)
|
||||||
|
@ -7,17 +7,18 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
|||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
import dev.inmo.tgbotapi.types.polls.Poll
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
public suspend fun TelegramBot.stopPoll(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
): Poll = execute(
|
||||||
StopPoll(chatId, messageId, businessConnectionId, replyMarkup)
|
StopPoll(chatId, messageId, businessConnectionId, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,31 +26,31 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
public suspend fun TelegramBot.stopPoll(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chat.id, messageId, businessConnectionId, replyMarkup)
|
): Poll = stopPoll(chat.id, messageId, businessConnectionId, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
public suspend fun TelegramBot.stopPoll(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chatId, message.messageId, businessConnectionId, replyMarkup)
|
): Poll = stopPoll(chatId, message.messageId, businessConnectionId, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
public suspend fun TelegramBot.stopPoll(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chat.id, message.messageId, businessConnectionId, replyMarkup)
|
): Poll = stopPoll(chat.id, message.messageId, businessConnectionId, replyMarkup)
|
||||||
|
@ -12,38 +12,38 @@ import dev.inmo.tgbotapi.types.UserId
|
|||||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
inputSticker: InputSticker
|
inputSticker: InputSticker
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
AddStickerToSet(userId, stickerSetName, inputSticker)
|
AddStickerToSet(userId, stickerSetName, inputSticker)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
inputSticker: InputSticker
|
inputSticker: InputSticker
|
||||||
) = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker)
|
): Boolean = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: InputSticker
|
sticker: InputSticker
|
||||||
) = addStickerToSet(
|
): Boolean = addStickerToSet(
|
||||||
userId,
|
userId,
|
||||||
stickerSet.name,
|
stickerSet.name,
|
||||||
sticker
|
sticker
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
keywords: List<String> = emptyList()
|
keywords: List<String> = emptyList()
|
||||||
) = addStickerToSet(
|
): Boolean = addStickerToSet(
|
||||||
userId,
|
userId,
|
||||||
stickerSet,
|
stickerSet,
|
||||||
when (stickerSet.stickerType) {
|
when (stickerSet.stickerType) {
|
||||||
@ -68,14 +68,14 @@ suspend fun TelegramBot.addStickerToSet(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
): Boolean = addStickerToSet(
|
||||||
userId,
|
userId,
|
||||||
stickerSet.name,
|
stickerSet.name,
|
||||||
when (stickerSet.stickerType) {
|
when (stickerSet.stickerType) {
|
||||||
@ -101,34 +101,34 @@ suspend fun TelegramBot.addStickerToSet(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: InputSticker
|
sticker: InputSticker
|
||||||
) = addStickerToSet(
|
): Boolean = addStickerToSet(
|
||||||
user.id,
|
user.id,
|
||||||
stickerSet.name,
|
stickerSet.name,
|
||||||
sticker
|
sticker
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
keywords: List<String> = emptyList()
|
keywords: List<String> = emptyList()
|
||||||
) = addStickerToSet(
|
): Boolean = addStickerToSet(
|
||||||
user.id, stickerSet, sticker, format, emojis, keywords
|
user.id, stickerSet, sticker, format, emojis, keywords
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.addStickerToSet(
|
public suspend fun TelegramBot.addStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
): Boolean = addStickerToSet(
|
||||||
user.id, stickerSet, sticker, format, emojis, maskPosition
|
user.id, stickerSet, sticker, format, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
@ -7,23 +7,23 @@ import dev.inmo.tgbotapi.types.StickerFormat
|
|||||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewStickerSet(
|
public suspend fun TelegramBot.createNewStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
title: String,
|
title: String,
|
||||||
stickers: List<InputSticker>,
|
stickers: List<InputSticker>,
|
||||||
needsRepainting: Boolean = false
|
needsRepainting: Boolean = false
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
CreateNewStickerSet(userId, name, title, stickers, needsRepainting)
|
CreateNewStickerSet(userId, name, title, stickers, needsRepainting)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
suspend fun TelegramBot.createNewStickerSet(
|
public suspend fun TelegramBot.createNewStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
title: String,
|
title: String,
|
||||||
stickers: List<InputSticker>,
|
stickers: List<InputSticker>,
|
||||||
needsRepainting: Boolean = false,
|
needsRepainting: Boolean = false,
|
||||||
) = createNewStickerSet(
|
): Boolean = createNewStickerSet(
|
||||||
user.id, name, title, stickers, needsRepainting
|
user.id, name, title, stickers, needsRepainting
|
||||||
)
|
)
|
||||||
|
@ -5,16 +5,16 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId
|
|||||||
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerFromSet(
|
public suspend fun TelegramBot.deleteStickerFromSet(
|
||||||
sticker: FileId
|
sticker: FileId
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
DeleteStickerFromSet(
|
DeleteStickerFromSet(
|
||||||
sticker
|
sticker
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerFromSet(
|
public suspend fun TelegramBot.deleteStickerFromSet(
|
||||||
sticker: Sticker
|
sticker: Sticker
|
||||||
) = deleteStickerFromSet(
|
): Boolean = deleteStickerFromSet(
|
||||||
sticker.fileId
|
sticker.fileId
|
||||||
)
|
)
|
||||||
|
@ -8,18 +8,18 @@ import dev.inmo.tgbotapi.types.StickerSetName
|
|||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerSet(
|
public suspend fun TelegramBot.deleteStickerSet(
|
||||||
name: StickerSetName
|
name: StickerSetName
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
DeleteStickerSet(name)
|
DeleteStickerSet(name)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerSet(
|
public suspend fun TelegramBot.deleteStickerSet(
|
||||||
sticker: Sticker
|
sticker: Sticker
|
||||||
) = deleteStickerSet(
|
): Boolean = deleteStickerSet(
|
||||||
sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker")
|
sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker")
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerSet(
|
public suspend fun TelegramBot.deleteStickerSet(
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
) = deleteStickerSet(stickerSet.name)
|
): Boolean = deleteStickerSet(stickerSet.name)
|
||||||
|
@ -14,35 +14,35 @@ import dev.inmo.tgbotapi.types.UserId
|
|||||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
newSticker: InputSticker
|
newSticker: InputSticker
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
ReplaceStickerInSet(userId, stickerSetName, oldSticker, newSticker)
|
ReplaceStickerInSet(userId, stickerSetName, oldSticker, newSticker)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
newSticker: InputSticker
|
newSticker: InputSticker
|
||||||
) = replaceStickerInSet(userId, StickerSetName(stickerSetName), oldSticker, newSticker)
|
): Boolean = replaceStickerInSet(userId, StickerSetName(stickerSetName), oldSticker, newSticker)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
newSticker: InputSticker
|
newSticker: InputSticker
|
||||||
) = replaceStickerInSet(
|
): Boolean = replaceStickerInSet(
|
||||||
userId,
|
userId,
|
||||||
stickerSet.name,
|
stickerSet.name,
|
||||||
oldSticker,
|
oldSticker,
|
||||||
newSticker
|
newSticker
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
@ -50,7 +50,7 @@ suspend fun TelegramBot.replaceStickerInSet(
|
|||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
keywords: List<String> = emptyList()
|
keywords: List<String> = emptyList()
|
||||||
) = replaceStickerInSet(
|
): Boolean = replaceStickerInSet(
|
||||||
userId,
|
userId,
|
||||||
stickerSet,
|
stickerSet,
|
||||||
oldSticker,
|
oldSticker,
|
||||||
@ -76,7 +76,7 @@ suspend fun TelegramBot.replaceStickerInSet(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
@ -84,7 +84,7 @@ suspend fun TelegramBot.replaceStickerInSet(
|
|||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = replaceStickerInSet(
|
): Boolean = replaceStickerInSet(
|
||||||
userId,
|
userId,
|
||||||
stickerSet.name,
|
stickerSet.name,
|
||||||
oldSticker,
|
oldSticker,
|
||||||
@ -111,19 +111,19 @@ suspend fun TelegramBot.replaceStickerInSet(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
newSticker: InputSticker
|
newSticker: InputSticker
|
||||||
) = replaceStickerInSet(
|
): Boolean = replaceStickerInSet(
|
||||||
user.id,
|
user.id,
|
||||||
stickerSet.name,
|
stickerSet.name,
|
||||||
oldSticker,
|
oldSticker,
|
||||||
newSticker
|
newSticker
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
@ -131,11 +131,11 @@ suspend fun TelegramBot.replaceStickerInSet(
|
|||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
keywords: List<String> = emptyList()
|
keywords: List<String> = emptyList()
|
||||||
) = replaceStickerInSet(
|
): Boolean = replaceStickerInSet(
|
||||||
user.id, stickerSet, oldSticker, sticker, format, emojis, keywords
|
user.id, stickerSet, oldSticker, sticker, format, emojis, keywords
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.replaceStickerInSet(
|
public suspend fun TelegramBot.replaceStickerInSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
oldSticker: FileId,
|
oldSticker: FileId,
|
||||||
@ -143,6 +143,6 @@ suspend fun TelegramBot.replaceStickerInSet(
|
|||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
emojis: List<String>,
|
emojis: List<String>,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = replaceStickerInSet(
|
): Boolean = replaceStickerInSet(
|
||||||
user.id, stickerSet, oldSticker, sticker, format, emojis, maskPosition
|
user.id, stickerSet, oldSticker, sticker, format, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
@ -11,16 +11,16 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
|
|||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail(
|
public suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail(
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
customEmojiId: CustomEmojiId
|
customEmojiId: CustomEmojiId
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetCustomEmojiStickerSetThumbnail(stickerSetName, customEmojiId)
|
SetCustomEmojiStickerSetThumbnail(stickerSetName, customEmojiId)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail(
|
public suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail(
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
customEmojiId: CustomEmojiId
|
customEmojiId: CustomEmojiId
|
||||||
) = setCustomEmojiStickerSetThumbnail(
|
): Boolean = setCustomEmojiStickerSetThumbnail(
|
||||||
stickerSet.name, customEmojiId
|
stickerSet.name, customEmojiId
|
||||||
)
|
)
|
||||||
|
@ -6,20 +6,20 @@ import dev.inmo.tgbotapi.requests.stickers.SetStickerEmojiList
|
|||||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerEmojiList(
|
public suspend fun TelegramBot.setStickerEmojiList(
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: List<String>
|
emojis: List<String>
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetStickerEmojiList(
|
SetStickerEmojiList(
|
||||||
sticker,
|
sticker,
|
||||||
emojis
|
emojis
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerEmojiList(
|
public suspend fun TelegramBot.setStickerEmojiList(
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
vararg emojis: String
|
vararg emojis: String
|
||||||
) = setStickerEmojiList(
|
): Boolean = setStickerEmojiList(
|
||||||
sticker.fileId,
|
sticker.fileId,
|
||||||
emojis.toList()
|
emojis.toList()
|
||||||
)
|
)
|
||||||
|
@ -7,20 +7,20 @@ import dev.inmo.tgbotapi.requests.stickers.SetStickerKeywords
|
|||||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerKeywords(
|
public suspend fun TelegramBot.setStickerKeywords(
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
keywords: List<String>
|
keywords: List<String>
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetStickerKeywords(
|
SetStickerKeywords(
|
||||||
sticker,
|
sticker,
|
||||||
keywords
|
keywords
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerKeywords(
|
public suspend fun TelegramBot.setStickerKeywords(
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
vararg keywords: String
|
vararg keywords: String
|
||||||
) = setStickerKeywords(
|
): Boolean = setStickerKeywords(
|
||||||
sticker.fileId,
|
sticker.fileId,
|
||||||
keywords.toList()
|
keywords.toList()
|
||||||
)
|
)
|
||||||
|
@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
|||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerMaskPosition(
|
public suspend fun TelegramBot.setStickerMaskPosition(
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
maskPosition: MaskPosition
|
maskPosition: MaskPosition
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetStickerMaskPosition(
|
SetStickerMaskPosition(
|
||||||
sticker,
|
sticker,
|
||||||
maskPosition
|
maskPosition
|
||||||
|
@ -5,20 +5,20 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId
|
|||||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerPositionInSet(
|
public suspend fun TelegramBot.setStickerPositionInSet(
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
position: Int
|
position: Int
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetStickerPositionInSet(
|
SetStickerPositionInSet(
|
||||||
sticker,
|
sticker,
|
||||||
position
|
position
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerPositionInSet(
|
public suspend fun TelegramBot.setStickerPositionInSet(
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
position: Int
|
position: Int
|
||||||
) = setStickerPositionInSet(
|
): Boolean = setStickerPositionInSet(
|
||||||
sticker.fileId,
|
sticker.fileId,
|
||||||
position
|
position
|
||||||
)
|
)
|
||||||
|
@ -10,74 +10,74 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
|
|||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: FileId
|
thumbnail: FileId
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail)
|
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: MultipartFile
|
thumbnail: MultipartFile
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail)
|
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: FileId
|
thumbnail: FileId
|
||||||
) = setStickerSetThumbnail(
|
): Boolean = setStickerSetThumbnail(
|
||||||
user.id, stickerSetName, format, thumbnail
|
user.id, stickerSetName, format, thumbnail
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSetName: StickerSetName,
|
stickerSetName: StickerSetName,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: MultipartFile
|
thumbnail: MultipartFile
|
||||||
) = setStickerSetThumbnail(
|
): Boolean = setStickerSetThumbnail(
|
||||||
user.id, stickerSetName, format, thumbnail
|
user.id, stickerSetName, format, thumbnail
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: FileId
|
thumbnail: FileId
|
||||||
) = setStickerSetThumbnail(
|
): Boolean = setStickerSetThumbnail(
|
||||||
userId, stickerSet.name, format, thumbnail
|
userId, stickerSet.name, format, thumbnail
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: MultipartFile
|
thumbnail: MultipartFile
|
||||||
) = setStickerSetThumbnail(
|
): Boolean = setStickerSetThumbnail(
|
||||||
userId, stickerSet.name, format, thumbnail
|
userId, stickerSet.name, format, thumbnail
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: FileId
|
thumbnail: FileId
|
||||||
) = setStickerSetThumbnail(
|
): Boolean = setStickerSetThumbnail(
|
||||||
user.id, stickerSet, format, thumbnail
|
user.id, stickerSet, format, thumbnail
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
public suspend fun TelegramBot.setStickerSetThumbnail(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
format: StickerFormat,
|
format: StickerFormat,
|
||||||
thumbnail: MultipartFile
|
thumbnail: MultipartFile
|
||||||
) = setStickerSetThumbnail(
|
): Boolean = setStickerSetThumbnail(
|
||||||
user.id, stickerSet, format, thumbnail
|
user.id, stickerSet, format, thumbnail
|
||||||
)
|
)
|
||||||
|
@ -6,17 +6,17 @@ import dev.inmo.tgbotapi.types.StickerSetName
|
|||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetTitle(
|
public suspend fun TelegramBot.setStickerSetTitle(
|
||||||
name: StickerSetName,
|
name: StickerSetName,
|
||||||
title: String
|
title: String
|
||||||
) = execute(SetStickerSetTitle(name, title))
|
): Boolean = execute(SetStickerSetTitle(name, title))
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetTitle(
|
public suspend fun TelegramBot.setStickerSetTitle(
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
title: String
|
title: String
|
||||||
) = setStickerSetTitle(sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker"), title)
|
): Boolean = setStickerSetTitle(sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker"), title)
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerSetTitle(
|
public suspend fun TelegramBot.setStickerSetTitle(
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
title: String
|
title: String
|
||||||
) = setStickerSetTitle(stickerSet.name, title)
|
): Boolean = setStickerSetTitle(stickerSet.name, title)
|
||||||
|
@ -6,19 +6,20 @@ import dev.inmo.tgbotapi.requests.stickers.UploadStickerFile
|
|||||||
import dev.inmo.tgbotapi.types.StickerFormat
|
import dev.inmo.tgbotapi.types.StickerFormat
|
||||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.files.File
|
||||||
|
|
||||||
suspend fun TelegramBot.uploadStickerFile(
|
public suspend fun TelegramBot.uploadStickerFile(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
stickerFormat: StickerFormat
|
stickerFormat: StickerFormat
|
||||||
) = execute(
|
): File = execute(
|
||||||
UploadStickerFile(userId, sticker, stickerFormat)
|
UploadStickerFile(userId, sticker, stickerFormat)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.uploadStickerFile(
|
public suspend fun TelegramBot.uploadStickerFile(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
stickerFormat: StickerFormat
|
stickerFormat: StickerFormat
|
||||||
) = execute(
|
): File = execute(
|
||||||
UploadStickerFile(user.id, sticker, stickerFormat)
|
UploadStickerFile(user.id, sticker, stickerFormat)
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@ import kotlinx.coroutines.launch
|
|||||||
*
|
*
|
||||||
* @see UpdateReceiver
|
* @see UpdateReceiver
|
||||||
*/
|
*/
|
||||||
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
|
public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
|
||||||
output: UpdateReceiver<Update>,
|
output: UpdateReceiver<Update>,
|
||||||
mediaGroupsDebounceMillis: Long = 1000L
|
mediaGroupsDebounceMillis: Long = 1000L
|
||||||
): UpdateReceiver<Update> {
|
): UpdateReceiver<Update> {
|
||||||
|
@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api.webhook
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.webhook.DeleteWebhook
|
import dev.inmo.tgbotapi.requests.webhook.DeleteWebhook
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteWebhook() = execute(DeleteWebhook())
|
public suspend fun TelegramBot.deleteWebhook(): Boolean = execute(DeleteWebhook())
|
||||||
|
@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.webhook
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.webhook.GetWebhookInfo
|
import dev.inmo.tgbotapi.requests.webhook.GetWebhookInfo
|
||||||
|
import dev.inmo.tgbotapi.types.WebhookInfo
|
||||||
|
|
||||||
suspend fun TelegramBot.getWebhookInfo() = execute(GetWebhookInfo())
|
public suspend fun TelegramBot.getWebhookInfo(): WebhookInfo = execute(GetWebhookInfo())
|
||||||
|
@ -9,14 +9,14 @@ import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST
|
|||||||
/**
|
/**
|
||||||
* Use this method to send information about webhook (like [url])
|
* Use this method to send information about webhook (like [url])
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.setWebhookInfo(
|
public suspend fun TelegramBot.setWebhookInfo(
|
||||||
url: String,
|
url: String,
|
||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||||
dropPendingUpdates: Boolean? = null,
|
dropPendingUpdates: Boolean? = null,
|
||||||
secretToken: String? = null
|
secretToken: String? = null
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetWebhook(
|
SetWebhook(
|
||||||
url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||||
)
|
)
|
||||||
@ -25,7 +25,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
|||||||
/**
|
/**
|
||||||
* Use this method to send information about webhook (like [url] and [certificate])
|
* Use this method to send information about webhook (like [url] and [certificate])
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.setWebhookInfo(
|
public suspend fun TelegramBot.setWebhookInfo(
|
||||||
url: String,
|
url: String,
|
||||||
certificate: FileId,
|
certificate: FileId,
|
||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
@ -33,7 +33,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
|||||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||||
dropPendingUpdates: Boolean? = null,
|
dropPendingUpdates: Boolean? = null,
|
||||||
secretToken: String? = null
|
secretToken: String? = null
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetWebhook(
|
SetWebhook(
|
||||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||||
)
|
)
|
||||||
@ -42,7 +42,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
|||||||
/**
|
/**
|
||||||
* Use this method to send information about webhook (like [url] and [certificate])
|
* Use this method to send information about webhook (like [url] and [certificate])
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.setWebhookInfo(
|
public suspend fun TelegramBot.setWebhookInfo(
|
||||||
url: String,
|
url: String,
|
||||||
certificate: MultipartFile,
|
certificate: MultipartFile,
|
||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
@ -50,7 +50,7 @@ suspend fun TelegramBot.setWebhookInfo(
|
|||||||
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
allowedUpdates: List<String>? = ALL_UPDATES_LIST,
|
||||||
dropPendingUpdates: Boolean? = null,
|
dropPendingUpdates: Boolean? = null,
|
||||||
secretToken: String? = null
|
secretToken: String? = null
|
||||||
) = execute(
|
): Boolean = execute(
|
||||||
SetWebhook(
|
SetWebhook(
|
||||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user