Skip to content

Commit cf6be5e

Browse files
committed
Docs updated
1 parent e55416f commit cf6be5e

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

src/main/kotlin/com/github/demidko/telegram/TelegramStorage.kt

+14-19
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ import java.util.concurrent.ConcurrentHashMap
1717
import java.util.concurrent.Executors.newSingleThreadExecutor
1818

1919
/**
20-
* Immutable NoSQL database in your Telegram channel.
20+
* A free, 1M records NoSQL cloud database in your Telegram channel.
21+
* See [Telegram Bot API limits](https://core.telegram.org/bots/faq#handling-media)
2122
* @param K key value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
2223
* @param V storable value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
23-
* Also see [Telegram Bot API limits](https://core.telegram.org/bots/faq#handling-media)
24+
* @param bot Telegram bot. Must be admin of the [channel].
25+
* See [documentation](https://github.com/kotlin-telegram-bot/kotlin-telegram-bot)
26+
* @param channel Telegram channel. Use [fromId] or [fromChannelUsername].
27+
* Do not change the channel description or files!
2428
*/
2529
class TelegramStorage<K, V>(
2630
private val bot: Bot,
@@ -38,12 +42,8 @@ class TelegramStorage<K, V>(
3842
* @param botToken Telegram bot token. Must be admin of the [channelName]
3943
* @param channelName Telegram channel name. Do not change the channel description or files!
4044
*/
41-
inline fun <reified K, reified V> TelegramStorage(
42-
botToken: String,
43-
channelName: String
44-
): TelegramStorage<K, V> {
45-
return TelegramStorage(bot { token = botToken }, fromChannelUsername(channelName))
46-
}
45+
inline fun <reified K, reified V> TelegramStorage(botToken: String, channelName: String) =
46+
TelegramStorage<K, V>(bot { token = botToken }, fromChannelUsername(channelName))
4747

4848
/**
4949
* Immutable NoSQL database in your Telegram channel..
@@ -53,26 +53,21 @@ class TelegramStorage<K, V>(
5353
* @param botToken Telegram bot token. Must be admin of the [channelId]
5454
* @param channelId Telegram channel ID. Do not change the channel description or files!
5555
*/
56-
inline fun <reified K, reified V> TelegramStorage(
57-
botToken: String,
58-
channelId: Long
59-
): TelegramStorage<K, V> {
60-
return TelegramStorage(bot { token = botToken }, fromId(channelId))
61-
}
56+
inline fun <reified K, reified V> TelegramStorage(botToken: String, channelId: Long) =
57+
TelegramStorage<K, V>(bot { token = botToken }, fromId(channelId))
6258

6359
/**
6460
* Immutable NoSQL database in your Telegram channel.
6561
* @param K key value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
6662
* @param V storable value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
6763
* Also see [Telegram Bot API limits](https://core.telegram.org/bots/faq#handling-media)
68-
* @param bot Telegram bot.
64+
* @param bot Telegram bot. Must be admin of the [channel].
6965
* See [documentation](https://github.com/kotlin-telegram-bot/kotlin-telegram-bot)
70-
* @param channel Telegram channel. Use [fromId] or [fromChannelUsername]. The [bot] must be admin of this channel.
66+
* @param channel Telegram channel. Use [fromId] or [fromChannelUsername].
7167
* Do not change the channel description or files!
7268
*/
73-
inline fun <reified K, reified V> TelegramStorage(bot: Bot, channel: ChatId): TelegramStorage<K, V> {
74-
return TelegramStorage(bot, channel, serializer<K>(), serializer<V>())
75-
}
69+
inline fun <reified K, reified V> TelegramStorage(bot: Bot, channel: ChatId) =
70+
TelegramStorage<K, V>(bot, channel, serializer<K>(), serializer<V>())
7671
}
7772

7873
private val keystoreSerializer = MapSerializer(keySerializer, serializer<String>())

0 commit comments

Comments
 (0)