Skip to content

Commit 335a1b7

Browse files
committed
Bot API 7.9
1 parent 200f53d commit 335a1b7

File tree

77 files changed

+60257
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+60257
-322
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ build
1313
# Configuration
1414
/tgkotbot/src/main/resources/application.conf
1515
.env
16+
17+
# Publish
18+
publish.sh

README.md

+41-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,43 @@
11
# kotbot [![Build](https://github.com/Heapy/kotbot/actions/workflows/build.yml/badge.svg)](https://github.com/Heapy/kotbot/actions/workflows/build.yml)
22

3-
* [Core](https://github.com/Heapy/kotbot/tree/main/core#readme) – Lightweight, opinionated library implementing [telegram bot api](https://core.telegram.org/bots)
4-
* [Tgkotbot](https://github.com/Heapy/kotbot/tree/main/tgkotbot#readme) – Bot implementation for needs of [Kotlin Community](https://t.me/kotlin_forum) in the telegram
3+
* [Core](https://github.com/Heapy/kotbot/tree/main/core#readme) – Lightweight, opinionated library
4+
implementing [telegram bot api](https://core.telegram.org/bots)
5+
* [Tgkotbot](https://github.com/Heapy/kotbot/tree/main/tgkotbot#readme) – Bot implementation for needs
6+
of [Kotlin Community](https://t.me/kotlin_forum) in the telegram
7+
8+
## Bot API 7.9
9+
10+
### Install library
11+
12+
```kotlin
13+
implementation("io.heapy.kotbot:core:1.0.0")
14+
```
15+
16+
### Example
17+
18+
Execute a single method:
19+
20+
```kotlin
21+
suspend fun main() {
22+
val kotbot = Kotbot(
23+
token = System.getenv("KOTBOT_TOKEN"),
24+
)
25+
26+
kotbot.execute(GetMe())
27+
.also(::println)
28+
}
29+
```
30+
31+
Subscribe for updates:
32+
33+
```kotlin
34+
suspend fun main() {
35+
val kotbot = Kotbot(
36+
token = System.getenv("KOTBOT_TOKEN"),
37+
)
38+
39+
// Flow, which emits updates
40+
kotbot.receiveUpdates()
41+
.onEach(::println)
42+
}
43+
```

buildSrc/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}

buildSrc/settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "buildSrc"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import java.util.*
2+
3+
plugins {
4+
signing
5+
`java-library`
6+
`maven-publish`
7+
}
8+
9+
group = "io.heapy.kotbot"
10+
11+
java {
12+
withJavadocJar()
13+
withSourcesJar()
14+
}
15+
16+
val modules: Map<String, Map<String, String>> = mapOf(
17+
"core" to mapOf(
18+
"publishName" to "Telegram chat bot framework",
19+
"publishDescription" to "Unopinionated and flexible framework for building Telegram chat bots",
20+
),
21+
)
22+
23+
fun Project.getPublishName(): String = modules.getValue(name).getValue("publishName")
24+
fun Project.getPublishDescription(): String = modules.getValue(name).getValue("publishDescription")
25+
26+
publishing {
27+
publications {
28+
create<MavenPublication>("maven") {
29+
artifactId = project.name
30+
31+
from(components["java"])
32+
33+
pom {
34+
name = project.getPublishName()
35+
description = project.getPublishDescription()
36+
url = "https://github.com/Heapy/kotbot"
37+
inceptionYear = "2018"
38+
licenses {
39+
license {
40+
name = "GPL-3.0-only"
41+
url = "https://spdx.org/licenses/GPL-3.0-only.html"
42+
}
43+
}
44+
developers {
45+
developer {
46+
id = "ruslan.ibrahimau"
47+
name = "Ruslan Ibrahimau"
48+
email = "ruslan@heapy.io"
49+
}
50+
}
51+
scm {
52+
connection = "scm:git:https://github.com/Heapy/kotbot.git"
53+
developerConnection = "scm:git:ssh://github.com/Heapy/kotbot.git"
54+
url = "https://github.com/Heapy/kotbot"
55+
}
56+
}
57+
}
58+
}
59+
60+
repositories {
61+
maven {
62+
url = rootProject.layout.buildDirectory
63+
.dir("staging-deploy")
64+
.get().asFile.toURI()
65+
}
66+
}
67+
}
68+
69+
signing {
70+
sign(publishing.publications["maven"])
71+
}

core-gen/src/main/kotlin/Generate.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import kotlinx.serialization.json.Json
1818
fun main() {
1919
// https://ark0f.github.io/tg-bot-api/custom.json
2020
val apiJson = {}::class.java
21-
.getResource("api740.json")
21+
.getResource("api790.json")
2222
?.readText()
2323
?: error("custom.json not found")
2424

core-gen/src/main/kotlin/Parse.kt

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fun main() {
2323
"api700",
2424
"api710",
2525
"api740",
26+
"api790",
2627
).forEach { v ->
2728
val input = rootPath.resolve(v).readText()
2829
val output = processVersion(input)

core-gen/src/main/resources/api790

+14,459
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)