demidko / telegram-storage

Immutable no-sql database in your Telegram channel.

Home Page:https://jitpack.io/#demidko/telegram-storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Storage

Telegram cloud client. You need a channel (name or ID) in which your bot has full administrator rights. Do not change the channel description! The bot stores the keystore identifier in the channel description.

Download

Supports Kotlin 1.8.0 and higher. You need Gradle, or Maven, or other build tool.

Also, you need to add Kotlin serialization plugin, for example, in build.gradle.kts

plugins {
    kotlin("plugin.serialization") version "1.8.0"
}

Usage example

import com.github.demidko.telegram.*
import kotlinx.serialization.Serializable

@Serializable
data class People(val name: String, val address: String)

fun main() {
    val token = "Example Telegram Bot API access token"
    val channel = "Example channel name or numeric id"
    val storage = TelegramStorage(token, channel)

    storage["id"] = People("Elon Musk", "Texas")

    val obj: People = storage["id"] // People("Elon Musk", "Texas")
}

About

Immutable no-sql database in your Telegram channel.

https://jitpack.io/#demidko/telegram-storage

License:MIT License


Languages

Language:Kotlin 100.0%