Skip to content

Commit

Permalink
Merge pull request #916 from InsanusMokrassar/20.0.0
Browse files Browse the repository at this point in the history
20.0.0
  • Loading branch information
InsanusMokrassar authored Nov 1, 2024
2 parents b26d21a + fa9c95f commit 4a0c0bd
Show file tree
Hide file tree
Showing 95 changed files with 7,480 additions and 2,554 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# TelegramBotAPI changelog

## 20.0.0

**THIS UPDATE CONTAINS SUPPORT OF [BOTS API 7.11](https://core.telegram.org/bots/api-changelog#october-31-2024)**

* `All`:
* **ALL SEND METHODS GOT PARAMETER `allowPaidBroadcast` WHICH POTENTIALLY MAY SPEND MONEYS FROM BOT BALANCE**

## 19.0.0

**THIS UPDATE CONTAINS BREAKING CHANGES**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-7.10-blue)](https://core.telegram.org/bots/api-changelog#september-6-2024)
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-7.11-blue)](https://core.telegram.org/bots/api-changelog#october-31-2024)

| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true

library_group=dev.inmo
library_version=19.0.0
library_version=20.0.0
1,744 changes: 866 additions & 878 deletions tgbotapi.api/api/tgbotapi.api.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public suspend fun TelegramBot.handleLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
Expand Down Expand Up @@ -90,6 +91,7 @@ public suspend fun TelegramBot.handleLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
allowPaidBroadcast,
effectId,
replyParameters,
it.replyMarkup
Expand Down Expand Up @@ -126,6 +128,7 @@ public suspend fun TelegramBot.handleLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
Expand All @@ -147,6 +150,7 @@ public suspend fun TelegramBot.handleLiveLocation(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
Expand All @@ -167,6 +171,7 @@ public suspend fun TelegramBot.handleLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
Expand All @@ -184,6 +189,7 @@ public suspend fun TelegramBot.handleLiveLocation(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,29 @@ public suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider {
val liveTimeAsDouble = liveTimeMillis.toDouble()
val locationMessage = execute(
SendLiveLocation(
chatId,
latitude,
longitude,
ceil(liveTimeAsDouble / 1000).toInt(),
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = ceil(liveTimeAsDouble / 1000).toInt(),
horizontalAccuracy = initHorizontalAccuracy,
heading = initHeading,
proximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

Expand Down Expand Up @@ -148,25 +150,27 @@ public suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
chat.id,
latitude,
longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
scope = scope,
chatId = chat.id,
latitude = latitude,
longitude = longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

/**
Expand All @@ -185,25 +189,27 @@ public suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
chatId,
location.latitude,
location.longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
scope = scope,
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

/**
Expand All @@ -222,25 +228,27 @@ public suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
chat.id,
location.latitude,
location.longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
scope = scope,
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

/**
Expand All @@ -260,25 +268,27 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
to.chat,
latitude,
longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
scope = scope,
chat = to.chat,
latitude = latitude,
longitude = longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)

/**
Expand All @@ -297,22 +307,24 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
to.chat,
location,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
scope = scope,
chat = to.chat,
location = location,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.media.addMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
Expand Down Expand Up @@ -173,6 +174,17 @@ public suspend fun TelegramBot.edit(
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message, media, businessConnectionId, replyMarkup)

/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.addMedia(
message: ContentMessage<TextContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = addMessageMedia(message, media, businessConnectionId, replyMarkup)

/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MediaContent
import dev.inmo.tgbotapi.types.message.content.TextContent
import kotlin.jvm.JvmName

/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
Expand Down Expand Up @@ -48,3 +50,14 @@ public suspend fun TelegramBot.editMessageMedia(
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message.chat.id, message.messageId, media, businessConnectionId, replyMarkup)

/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.addMessageMedia(
message: ContentMessage<TextContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message.chat.id, message.messageId, media, businessConnectionId, replyMarkup)
Loading

0 comments on commit 4a0c0bd

Please sign in to comment.