Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heapy/kotbot

Bot for Kotlin chats in telegram.
https://github.com/heapy/kotbot

docker hacktoberfest kotlin telegram telegram-bot

Last synced: about 2 months ago
JSON representation

Bot for Kotlin chats in telegram.

Awesome Lists containing this project

README

        

# 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

## 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)
}
```