Skip to content

Commit

Permalink
Kotbot 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Jan 17, 2025
1 parent 1d04943 commit 6bde09d
Show file tree
Hide file tree
Showing 26 changed files with 61,927 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
### Install library

```kotlin
implementation("io.heapy.kotbot:core:1.2.0")
implementation("io.heapy.kotbot:core:1.3.0")
```

### Example
Expand Down
2 changes: 1 addition & 1 deletion core-gen/src/main/kotlin/Generate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import kotlinx.serialization.json.Json
fun main() {
// https://ark0f.github.io/tg-bot-api/custom.json
val apiJson = {}::class.java
.getResource("api810.json")
.getResource("api820.json")
?.readText()
?: error("custom.json not found")

Expand Down
1 change: 1 addition & 0 deletions core-gen/src/main/kotlin/Parse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fun main() {
"api790",
"api800",
"api810",
"api820",
).forEach { v ->
val input = rootPath.resolve(v).readText()
val output = processVersion(input)
Expand Down
15,209 changes: 15,209 additions & 0 deletions core-gen/src/main/resources/api820

Large diffs are not rendered by default.

17,521 changes: 17,521 additions & 0 deletions core-gen/src/main/resources/api820.json

Large diffs are not rendered by default.

6,525 changes: 6,525 additions & 0 deletions core-gen/src/main/resources/api820.md

Large diffs are not rendered by default.

22,445 changes: 22,445 additions & 0 deletions core-gen/src/main/resources/api820_v2.json

Large diffs are not rendered by default.

122 changes: 76 additions & 46 deletions core-gen/src/main/resources/latest.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public data class AnswerShippingQuery(
*/
public val shipping_options: List<ShippingOption>? = null,
/**
* Required if *ok* is *False*. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
* Required if *ok* is *False*. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user.
*/
public val error_message: String? = null,
) : Method<AnswerShippingQuery, Boolean> by Companion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public data class GetUpdates(
/**
* A JSON-serialized list of the update types you want your bot to receive. For example, specify `["message", "edited_channel_post", "callback_query"]` to only receive updates of these types. See [Update](https://core.telegram.org/bots/api/#update) for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.
*
* Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.
* Please note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.
*/
public val allowed_updates: List<String>? = null,
) : Method<GetUpdates, List<Update>> by Companion {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.heapy.kotbot.bot.method

import io.heapy.kotbot.bot.Method
import io.heapy.kotbot.bot.Response
import io.heapy.kotbot.bot.model.ChatId
import kotlin.Boolean
import kotlin.String
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer

/**
* Removes verification from a chat that is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) represented by the bot. Returns *True* on success.
*/
@Serializable
public data class RemoveChatVerification(
/**
* Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
*/
public val chat_id: ChatId,
) : Method<RemoveChatVerification, Boolean> by Companion {
public companion object : Method<RemoveChatVerification, Boolean> {
override val _deserializer: KSerializer<Response<Boolean>> =
Response.serializer(Boolean.serializer())

override val _serializer: KSerializer<RemoveChatVerification> = serializer()

override val _name: String = "removeChatVerification"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.heapy.kotbot.bot.method

import io.heapy.kotbot.bot.Method
import io.heapy.kotbot.bot.Response
import kotlin.Boolean
import kotlin.Long
import kotlin.String
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer

/**
* Removes verification from a user who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) represented by the bot. Returns *True* on success.
*/
@Serializable
public data class RemoveUserVerification(
/**
* Unique identifier of the target user
*/
public val user_id: Long,
) : Method<RemoveUserVerification, Boolean> by Companion {
public companion object : Method<RemoveUserVerification, Boolean> {
override val _deserializer: KSerializer<Response<Boolean>> =
Response.serializer(Boolean.serializer())

override val _serializer: KSerializer<RemoveUserVerification> = serializer()

override val _name: String = "removeUserVerification"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public data class SendGift(
* Identifier of the gift
*/
public val gift_id: String,
/**
* Pass *True* to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
*/
public val pay_for_upgrade: Boolean? = null,
/**
* Text that will be shown along with the gift; 0-255 characters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public data class SetStickerSetThumbnail(
*/
public val user_id: Long,
/**
* A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see [https://core.telegram.org/stickers#animation-requirements](https://core.telegram.org/stickers#animation-requirements) for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see [https://core.telegram.org/stickers#video-requirements](https://core.telegram.org/stickers#video-requirements) for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More information on Sending Files &raquo;](https://core.telegram.org/bots/api/#sending-files). Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
* A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see [https://core.telegram.org/stickers#animation-requirements](https://core.telegram.org/stickers#animation-requirements) for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see [https://core.telegram.org/stickers#video-requirements](https://core.telegram.org/stickers#video-requirements) for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More information on Sending Files &raquo;](https://core.telegram.org/bots/api/#sending-files). Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
*/
public val thumbnail: Thumbnail? = null,
/**
* Format of the thumbnail, must be one of "static" for a **.WEBP** or **.PNG** image, "animated" for a **.TGS** animation, or "video" for a **WEBM** video
* Format of the thumbnail, must be one of "static" for a **.WEBP** or **.PNG** image, "animated" for a **.TGS** animation, or "video" for a **.WEBM** video
*/
public val format: String,
) : Method<SetStickerSetThumbnail, Boolean> by Companion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer

/**
* Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized [Update](https://core.telegram.org/bots/api/#update). In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns *True* on success.
* Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized [Update](https://core.telegram.org/bots/api/#update). In case of an unsuccessful request (a request with response [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) different from `2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns *True* on success.
*
* If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header "X-Telegram-Bot-Api-Secret-Token" with the secret token as content.
*/
Expand Down
34 changes: 34 additions & 0 deletions core/src/generated/kotlin/io/heapy/kotbot/bot/method/VerifyChat.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.heapy.kotbot.bot.method

import io.heapy.kotbot.bot.Method
import io.heapy.kotbot.bot.Response
import io.heapy.kotbot.bot.model.ChatId
import kotlin.Boolean
import kotlin.String
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer

/**
* Verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot. Returns *True* on success.
*/
@Serializable
public data class VerifyChat(
/**
* Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
*/
public val chat_id: ChatId,
/**
* Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
*/
public val custom_description: String? = null,
) : Method<VerifyChat, Boolean> by Companion {
public companion object : Method<VerifyChat, Boolean> {
override val _deserializer: KSerializer<Response<Boolean>> =
Response.serializer(Boolean.serializer())

override val _serializer: KSerializer<VerifyChat> = serializer()

override val _name: String = "verifyChat"
}
}
34 changes: 34 additions & 0 deletions core/src/generated/kotlin/io/heapy/kotbot/bot/method/VerifyUser.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.heapy.kotbot.bot.method

import io.heapy.kotbot.bot.Method
import io.heapy.kotbot.bot.Response
import kotlin.Boolean
import kotlin.Long
import kotlin.String
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer

/**
* Verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot. Returns *True* on success.
*/
@Serializable
public data class VerifyUser(
/**
* Unique identifier of the target user
*/
public val user_id: Long,
/**
* Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
*/
public val custom_description: String? = null,
) : Method<VerifyUser, Boolean> by Companion {
public companion object : Method<VerifyUser, Boolean> {
override val _deserializer: KSerializer<Response<Boolean>> =
Response.serializer(Boolean.serializer())

override val _serializer: KSerializer<VerifyUser> = serializer()

override val _name: String = "verifyUser"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlin.String
import kotlinx.serialization.Serializable

/**
* The background is a PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user.
* The background is a .PNG or .TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user.
*/
@Serializable
public data class BackgroundTypePattern(
Expand Down
4 changes: 4 additions & 0 deletions core/src/generated/kotlin/io/heapy/kotbot/bot/model/Gift.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public data class Gift(
* The number of Telegram Stars that must be paid to send the sticker
*/
public val star_count: Int,
/**
* *Optional*. The number of Telegram Stars that must be paid to upgrade the gift to a unique one
*/
public val upgrade_star_count: Int? = null,
/**
* *Optional*. The total number of the gifts of this type that can be sent; for limited gifts only
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.heapy.kotbot.bot.model

import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -34,10 +33,6 @@ public data class InlineQueryResultArticle(
* *Optional*. URL of the result
*/
public val url: String? = null,
/**
* *Optional*. Pass *True* if you don't want the URL to be shown in the message
*/
public val hide_url: Boolean? = null,
/**
* *Optional*. Short description of the result
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public data class InlineQueryResultGif(
*/
public val id: String,
/**
* A valid URL for the GIF file. File size must not exceed 1MB
* A valid URL for the GIF file
*/
public val gif_url: String,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public data class InlineQueryResultMpeg4Gif(
*/
public val id: String,
/**
* A valid URL for the MPEG4 file. File size must not exceed 1MB
* A valid URL for the MPEG4 file
*/
public val mpeg4_url: String,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public data class InputSticker(
*/
public val sticker: Sticker,
/**
* Format of the added sticker, must be one of "static" for a **.WEBP** or **.PNG** image, "animated" for a **.TGS** animation, "video" for a **WEBM** video
* Format of the added sticker, must be one of "static" for a **.WEBP** or **.PNG** image, "animated" for a **.TGS** animation, "video" for a **.WEBM** video
*/
public val format: String,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlin.String
import kotlinx.serialization.Serializable

/**
* Describes a Telegram Star transaction.
* Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control.
*/
@Serializable
public data class StarTransaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlin.String
import kotlinx.serialization.Serializable

/**
* This object contains basic information about a successful payment.
* This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control.
*/
@Serializable
public data class SuccessfulPayment(
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=io.heapy.kotbot
version=1.2.0
version=1.3.0
kotlin.code.style=official

0 comments on commit 6bde09d

Please sign in to comment.