Skip to content

Commit

Permalink
Bot API 7.9
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Aug 23, 2024
1 parent 200f53d commit 335a1b7
Show file tree
Hide file tree
Showing 77 changed files with 60,257 additions and 322 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ build
# Configuration
/tgkotbot/src/main/resources/application.conf
.env

# Publish
publish.sh
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
# kotbot [![Build](https://github.com/Heapy/kotbot/actions/workflows/build.yml/badge.svg)](https://github.com/Heapy/kotbot/actions/workflows/build.yml)

* [Core](https://github.com/Heapy/kotbot/tree/main/core#readme) – Lightweight, opinionated library implementing [telegram bot api](https://core.telegram.org/bots)
* [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
* [Core](https://github.com/Heapy/kotbot/tree/main/core#readme) – Lightweight, opinionated library
implementing [telegram bot api](https://core.telegram.org/bots)
* [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

## Bot API 7.9

### Install library

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

### Example

Execute a single method:

```kotlin
suspend fun main() {
val kotbot = Kotbot(
token = System.getenv("KOTBOT_TOKEN"),
)

kotbot.execute(GetMe())
.also(::println)
}
```

Subscribe for updates:

```kotlin
suspend fun main() {
val kotbot = Kotbot(
token = System.getenv("KOTBOT_TOKEN"),
)

// Flow, which emits updates
kotbot.receiveUpdates()
.onEach(::println)
}
```
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
1 change: 1 addition & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "buildSrc"
71 changes: 71 additions & 0 deletions buildSrc/src/main/kotlin/kotbot-publish-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import java.util.*

plugins {
signing
`java-library`
`maven-publish`
}

group = "io.heapy.kotbot"

java {
withJavadocJar()
withSourcesJar()
}

val modules: Map<String, Map<String, String>> = mapOf(
"core" to mapOf(
"publishName" to "Telegram chat bot framework",
"publishDescription" to "Unopinionated and flexible framework for building Telegram chat bots",
),
)

fun Project.getPublishName(): String = modules.getValue(name).getValue("publishName")
fun Project.getPublishDescription(): String = modules.getValue(name).getValue("publishDescription")

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = project.name

from(components["java"])

pom {
name = project.getPublishName()
description = project.getPublishDescription()
url = "https://github.com/Heapy/kotbot"
inceptionYear = "2018"
licenses {
license {
name = "GPL-3.0-only"
url = "https://spdx.org/licenses/GPL-3.0-only.html"
}
}
developers {
developer {
id = "ruslan.ibrahimau"
name = "Ruslan Ibrahimau"
email = "[email protected]"
}
}
scm {
connection = "scm:git:https://github.com/Heapy/kotbot.git"
developerConnection = "scm:git:ssh://github.com/Heapy/kotbot.git"
url = "https://github.com/Heapy/kotbot"
}
}
}
}

repositories {
maven {
url = rootProject.layout.buildDirectory
.dir("staging-deploy")
.get().asFile.toURI()
}
}
}

signing {
sign(publishing.publications["maven"])
}
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("api740.json")
.getResource("api790.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 @@ -23,6 +23,7 @@ fun main() {
"api700",
"api710",
"api740",
"api790",
).forEach { v ->
val input = rootPath.resolve(v).readText()
val output = processVersion(input)
Expand Down
14,459 changes: 14,459 additions & 0 deletions core-gen/src/main/resources/api790

Large diffs are not rendered by default.

Loading

0 comments on commit 335a1b7

Please sign in to comment.