@@ -17,10 +17,14 @@ import java.util.concurrent.ConcurrentHashMap
17
17
import java.util.concurrent.Executors.newSingleThreadExecutor
18
18
19
19
/* *
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)
21
22
* @param K key value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
22
23
* @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!
24
28
*/
25
29
class TelegramStorage <K , V >(
26
30
private val bot : Bot ,
@@ -38,12 +42,8 @@ class TelegramStorage<K, V>(
38
42
* @param botToken Telegram bot token. Must be admin of the [channelName]
39
43
* @param channelName Telegram channel name. Do not change the channel description or files!
40
44
*/
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))
47
47
48
48
/* *
49
49
* Immutable NoSQL database in your Telegram channel..
@@ -53,26 +53,21 @@ class TelegramStorage<K, V>(
53
53
* @param botToken Telegram bot token. Must be admin of the [channelId]
54
54
* @param channelId Telegram channel ID. Do not change the channel description or files!
55
55
*/
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))
62
58
63
59
/* *
64
60
* Immutable NoSQL database in your Telegram channel.
65
61
* @param K key value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
66
62
* @param V storable value type. Should be [basic](https://kotlinlang.org/docs/basic-types.html) or annotated with [Serializable].
67
63
* 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].
69
65
* 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].
71
67
* Do not change the channel description or files!
72
68
*/
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 >())
76
71
}
77
72
78
73
private val keystoreSerializer = MapSerializer (keySerializer, serializer<String >())
0 commit comments