Skip to content

Commit

Permalink
7.3.0 (#235)
Browse files Browse the repository at this point in the history
* Supported Telegram API [7.10](https://core.telegram.org/bots/api-changelog#september-6-2024)
* Added option to auto clean state in `@InputChain` as annotation parameter [🔬].
* Added option to set chaining strategy for `@InputChain` links, to have more control over flow.
* Added option to set custom argument parser for specific activities (`@CommandHandler`, `@CommonHandler`).
* Removed special deeplink case handling, now will need to use the basic mechanism (can be caught by ordered parameters).
  • Loading branch information
vendelieu authored Sep 7, 2024
1 parent 1c5cfec commit affb462
Show file tree
Hide file tree
Showing 85 changed files with 1,863 additions and 2,660 deletions.
747 changes: 366 additions & 381 deletions CHANGELOG.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Adding new Update part

1. Add new field to [Update](./telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/Update.kt)
2. Add new entry to [UpdateType](telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/UpdateType.kt)
3. Add new [ProcessedUpdate](telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/ProcessedUpdate.kt)
subclass
4. Add new clause to [processUpdate()](telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/ProcessUpdate.kt)
5. Add [TypeRef](ksp/src/jvmMain/kotlin/eu/vendeli/ksp/utils/HelperUtils.kt) to ksp and
to [lambda builder](ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InvocationLambdaBuilder.kt)
6. Run helper ksp to add a new section for [FunctionalDSLUtils](telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/FunctionalDSLUtils.kt)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build.gradle.kts example:
```gradle
plugins {
// ...
id("com.google.devtools.ksp") version "2.0.10-1.0.24"
id("com.google.devtools.ksp") version "2.0.20-1.0.25"
id("eu.vendeli.telegram-bot") version "7.2.2"
}
```
Expand All @@ -32,7 +32,7 @@ To set up the project without using the plugin, you need to add a dependency and
```gradle
plugins {
// ...
id("com.google.devtools.ksp") version "2.0.10-1.0.24"
id("com.google.devtools.ksp") version "2.0.20-1.0.24"
}
dependencies {
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ plugins {
}

tasks.create("prepareRelease") {
dependsOn("telegram-bot:clean")
dependsOn("telegram-bot:kspCommonMainKotlinMetadata")
dependsOn("telegram-bot:apiCheck")

dependsOn("telegram-bot:kdocUpdate")
dependsOn("telegram-bot:formatKotlin")
dependsOn("ktgram-gradle-plugin:formatKotlin")
dependsOn("helper:formatKotlin")

dependsOn("ksp:detekt")
dependsOn("telegram-bot:detekt")

dependsOn("telegram-bot:clean")
dependsOn("telegram-bot:kspCommonMainKotlinMetadata")
dependsOn("telegram-bot:apiCheck")
}
41 changes: 18 additions & 23 deletions buildSrc/src/main/kotlin/ConfiguredKotlinExt.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@

import org.gradle.api.Project
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

private val jvmTargetVer = JvmTarget.JVM_17

private fun KotlinMultiplatformExtension.configureJvm() {
jvm {
withJava()
compilations.all {
compileTaskProvider.configure {
compilerOptions {
jvmTarget.set(jvmTargetVer)
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
}
}
jvmToolchain(jvmTargetVer.target.toInt())
}

fun Project.onlyJvmConfiguredKotlin(block: KotlinMultiplatformExtension.() -> Unit) {
plugins.apply("kotlin-multiplatform")

configure<KotlinMultiplatformExtension> {
jvm {
withJava()
compilations.all {
compileTaskProvider.configure {
compilerOptions {
jvmTarget.set(jvmTargetVer)
}
}
}
}
jvmToolchain(jvmTargetVer.target.toInt())
configureJvm()
block()
}
}
Expand All @@ -29,20 +34,10 @@ fun Project.configuredKotlin(block: KotlinMultiplatformExtension.() -> Unit) {
plugins.apply("kotlin-multiplatform")

configure<KotlinMultiplatformExtension> {
jvm {
withJava()
compilations.all {
compileTaskProvider.configure {
compilerOptions {
jvmTarget.set(jvmTargetVer)
}
}
}
}
configureJvm()
js { nodejs() }
mingwX64()
linuxX64()
jvmToolchain(jvmTargetVer.target.toInt())
block()
}
}
131 changes: 119 additions & 12 deletions buildSrc/src/main/resources/api.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "Bot API 7.9",
"release_date": "August 14, 2024",
"changelog": "https://core.telegram.org/bots/api#august-14-2024",
"version": "Bot API 7.10",
"release_date": "September 6, 2024",
"changelog": "https://core.telegram.org/bots/api#september-6-2024",
"methods": {
"getUpdates": {
"name": "getUpdates",
Expand Down Expand Up @@ -1601,7 +1601,7 @@
"Integer"
],
"required": true,
"description": "The number of Telegram Stars that must be paid to buy access to the media"
"description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500"
},
{
"name": "media",
Expand All @@ -1611,6 +1611,14 @@
"required": true,
"description": "A JSON-serialized array describing the media to be sent; up to 10 items"
},
{
"name": "payload",
"types": [
"String"
],
"required": false,
"description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes."
},
{
"name": "caption",
"types": [
Expand Down Expand Up @@ -5709,7 +5717,7 @@
"String"
],
"required": true,
"description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes."
"description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."
},
{
"name": "provider_token",
Expand Down Expand Up @@ -5929,7 +5937,7 @@
"String"
],
"required": true,
"description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes."
"description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."
},
{
"name": "provider_token",
Expand Down Expand Up @@ -6569,6 +6577,14 @@
"required": false,
"description": "Optional. New incoming pre-checkout query. Contains full information about checkout"
},
{
"name": "purchased_paid_media",
"types": [
"PaidMediaPurchased"
],
"required": false,
"description": "Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat"
},
{
"name": "poll",
"types": [
Expand Down Expand Up @@ -10328,7 +10344,17 @@
"name": "GiveawayCreated",
"href": "https://core.telegram.org/bots/api#giveawaycreated",
"description": [
"This object represents a service message about the creation of a scheduled giveaway. Currently holds no information."
"This object represents a service message about the creation of a scheduled giveaway."
],
"fields": [
{
"name": "prize_star_count",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"
}
]
},
"Giveaway": {
Expand Down Expand Up @@ -10394,13 +10420,21 @@
"required": false,
"description": "Optional. A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways."
},
{
"name": "prize_star_count",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"
},
{
"name": "premium_subscription_month_count",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for"
"description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only"
}
]
},
Expand Down Expand Up @@ -10459,13 +10493,21 @@
"required": false,
"description": "Optional. The number of other chats the user had to join in order to be eligible for the giveaway"
},
{
"name": "prize_star_count",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only"
},
{
"name": "premium_subscription_month_count",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for"
"description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only"
},
{
"name": "unclaimed_prize_count",
Expand Down Expand Up @@ -10531,6 +10573,14 @@
],
"required": false,
"description": "Optional. Message with the giveaway that was completed, if it wasn't deleted"
},
{
"name": "is_star_giveaway",
"types": [
"Boolean"
],
"required": false,
"description": "Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway."
}
]
},
Expand Down Expand Up @@ -11407,6 +11457,22 @@
],
"required": false,
"description": "Optional. Number of pending join requests created using this link"
},
{
"name": "subscription_period",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of seconds the subscription will be active for before the next payment"
},
{
"name": "subscription_price",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link"
}
]
},
Expand Down Expand Up @@ -13145,7 +13211,7 @@
"name": "ChatBoostSourceGiveaway",
"href": "https://core.telegram.org/bots/api#chatboostsourcegiveaway",
"description": [
"The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription."
"The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways."
],
"fields": [
{
Expand All @@ -13170,7 +13236,15 @@
"User"
],
"required": false,
"description": "Optional. User that won the prize in the giveaway if any"
"description": "Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only"
},
{
"name": "prize_star_count",
"types": [
"Integer"
],
"required": false,
"description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"
},
{
"name": "is_unclaimed",
Expand Down Expand Up @@ -16705,7 +16779,7 @@
"String"
],
"required": true,
"description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes."
"description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."
},
{
"name": "provider_token",
Expand Down Expand Up @@ -17340,6 +17414,31 @@
}
]
},
"PaidMediaPurchased": {
"name": "PaidMediaPurchased",
"href": "https://core.telegram.org/bots/api#paidmediapurchased",
"description": [
"This object contains information about a paid media purchase."
],
"fields": [
{
"name": "from",
"types": [
"User"
],
"required": true,
"description": "User who purchased the media"
},
{
"name": "paid_media_payload",
"types": [
"String"
],
"required": true,
"description": "Bot-specified paid media payload"
}
]
},
"RevenueWithdrawalState": {
"name": "RevenueWithdrawalState",
"href": "https://core.telegram.org/bots/api#revenuewithdrawalstate",
Expand Down Expand Up @@ -17486,6 +17585,14 @@
],
"required": false,
"description": "Optional. Information about the paid media bought by the user"
},
{
"name": "paid_media_payload",
"types": [
"String"
],
"required": false,
"description": "Optional. Bot-specified paid media payload"
}
],
"subtype_of": [
Expand Down
7 changes: 6 additions & 1 deletion buildSrc/src/main/resources/scrape.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
import re
import string

Expand All @@ -24,6 +25,10 @@
['Message', 'Boolean'] # Edit returns either the new message, or an OK to confirm the edit.
]

# Construct the full path for the output file
def output_path(filename: str) -> str:
return os.path.join(os.path.dirname(os.path.abspath(__file__)), filename + ".json")


def retrieve_info(url: str) -> dict:
r = requests.get(url)
Expand Down Expand Up @@ -358,7 +363,7 @@ def main():
print("Failed to validate schema. View logs above for more information.")
exit(1)

with open(f"{filename}.json", "w") as f:
with open(output_path(filename), "w") as f:
json.dump(items, f, indent=2)


Expand Down
Loading

0 comments on commit affb462

Please sign in to comment.