Compare commits

...

22 Commits
0.2.2 ... 0.5.0

Author SHA1 Message Date
2fde3206e7 update changelog 2022-01-02 12:42:41 +06:00
4113fb2cc1 update dependencies 2022-01-02 12:41:15 +06:00
79ddfaf9bd start 0.5.0 2022-01-02 12:34:12 +06:00
8ae85ecc6e Merge pull request #23 from InsanusMokrassar/0.4.1
0.4.1
2021-11-12 17:38:41 +06:00
9d25b4b071 0.4.1 2021-11-12 17:38:18 +06:00
6d00bb6242 Merge pull request #22 from InsanusMokrassar/0.4.0
0.4.0
2021-11-12 15:33:37 +06:00
d7638d620f 0.4.0 2021-11-12 14:05:42 +06:00
8885047409 start 0.4.0 2021-11-12 13:38:19 +06:00
f09f13c13d Merge pull request #21 from InsanusMokrassar/0.3.2
0.3.2
2021-09-22 20:34:34 +06:00
8853af9a26 Update CHANGELOG.md 2021-09-22 20:34:03 +06:00
ab98b59633 Update dependencies 2021-09-22 20:30:52 +06:00
d88cf0c911 Update gradle.properties 2021-09-22 20:29:28 +06:00
5145b22dd5 Merge pull request #20 from InsanusMokrassar/0.3.1
0.3.1
2021-07-02 11:19:27 +06:00
90dd06db6d update dependencies 2021-07-01 22:44:01 +06:00
4e9b8349eb start 0.3.1 2021-07-01 22:38:54 +06:00
466e531faf Merge pull request #19 from InsanusMokrassar/0.3.0
0.3.0
2021-06-07 19:38:43 +06:00
8bf42e6fca Update CHANGELOG.md 2021-06-07 19:35:46 +06:00
a42bb91121 Update gradle.properties 2021-06-07 19:35:29 +06:00
fae2dca3d3 update changelog 2021-06-05 16:16:40 +06:00
a0d1bd2d54 update mircoutils and exposed 2021-06-05 15:25:17 +06:00
14e6c0c67d update versions 2021-06-04 12:12:58 +06:00
5a116d512a migration onto 0.3.0 2021-06-04 12:09:06 +06:00
9 changed files with 71 additions and 35 deletions

View File

@@ -1,7 +1,46 @@
# Changelog
## 0.2.2
## 0.5.0
* `Versions`
* `kotlin`: `1.6.10`
* `coroutines`: `1.6.0`
* `serialization`: `1.3.2`
* `exposed`: `0.37.2`
* `tgbotapi`: `0.38.0`
* `microutils`: `0.9.0`
## 0.4.1
Temporal update for compatibility with java 1.8
## 0.3.2
* `Versions`
* `kotlin`: `1.5.20` -> `1.5.31`
* `coroutines`: `1.5.0` -> `1.5.2`
* `serialization`: `1.2.1` -> `1.2.2`
* `exposed`: `0.32.1` -> `0.34.2`
* `tgbotapi`: `0.35.1` -> `0.35.9`
* `microutils`: `0.5.15` -> `0.5.28`
## 0.3.1
* `Versions`
* `kotlin`: `1.5.10` -> `1.5.20`
* `tgbotapi`: `0.35.0` -> `0.35.1`
* `microutils`: `0.5.7` -> `0.5.15`
## 0.3.0
* `Versions`
* `kotlin`: `1.4.32` -> `1.5.10`
* `coroutines`: `1.4.3` -> `1.5.0`
* `serialization`: `1.1.0` -> `1.2.1`
* `exposed`: `0.31.1` -> `0.32.1`
* `sdi`: `0.4.1` -> `0.5.0`
* `tgbotapi`: `0.34.1` -> `0.35.0`
* `microutils`: `0.4.36` -> `0.5.7`
* `Bot`
* Add plugin `PluginsHolder`
* Rewrite mechanism of `Config` working

View File

@@ -41,3 +41,8 @@ kapt {
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -5,18 +5,6 @@ import kotlinx.coroutines.*
import kotlinx.serialization.InternalSerializationApi
import java.io.File
@Deprecated(
"This method is redundant due to new class PlaguBot",
ReplaceWith(
"PlaguBot(config).start(scope)",
"dev.inmo.plagubot.PlaguBot"
)
)
suspend inline fun initPlaguBot(
config: Config,
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
): Job = PlaguBot(config).start(scope)
/**
* This method by default expects one argument in [args] field: path to config
*/

View File

@@ -4,8 +4,7 @@ import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
import dev.inmo.plagubot.config.*
import dev.inmo.tgbotapi.bot.Ktor.telegramBot
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviour
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
import dev.inmo.tgbotapi.types.BotCommand
import dev.inmo.tgbotapi.types.botCommandsLimit
import kotlinx.coroutines.*
@@ -50,7 +49,7 @@ data class PlaguBot(
*/
suspend fun start(
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
): Job = bot.buildBehaviour(scope) {
): Job = bot.buildBehaviourWithLongPolling(scope) {
invoke(database, paramsMap)
}
}

View File

@@ -63,7 +63,7 @@ internal class InternalPluginSerializer(
) : KSerializer<Plugin> {
override val descriptor: SerialDescriptor = PluginSerializer.descriptor
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun deserialize(decoder: Decoder): Plugin {
val asJson = JsonElement.serializer().deserialize(decoder)
@@ -75,7 +75,7 @@ internal class InternalPluginSerializer(
}
}
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun serialize(encoder: Encoder, value: Plugin) {
params.keys.firstOrNull { params[it] === value } ?.also {
encoder.encodeString(it)
@@ -90,7 +90,7 @@ internal class InternalModuleSerializer(
) : KSerializer<Module> {
override val descriptor: SerialDescriptor = PluginSerializer.descriptor
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun deserialize(decoder: Decoder): Module {
val asJson = JsonElement.serializer().deserialize(decoder)
@@ -101,7 +101,7 @@ internal class InternalModuleSerializer(
}
}
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun serialize(encoder: Encoder, value: Module) = DefaultModuleSerializer.serialize(encoder, value)
}
@@ -119,7 +119,7 @@ internal object PluginsConfigurationSerializer : KSerializer<PluginsConfiguratio
private val moduleSerializer = ModuleSerializer()
override val descriptor: SerialDescriptor = jsonSerializer.descriptor
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun deserialize(decoder: Decoder): PluginsConfiguration {
val json = jsonSerializer.deserialize(decoder)
val jsonFormat = (decoder as? JsonDecoder) ?.json ?: configAndPluginsConfigJsonFormat
@@ -154,7 +154,7 @@ internal object PluginsConfigurationSerializer : KSerializer<PluginsConfiguratio
}
}
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun serialize(encoder: Encoder, value: PluginsConfiguration) {
val params = value.params
val serializer = when (value) {

View File

@@ -4,19 +4,19 @@ org.gradle.parallel=true
kotlin.js.generate.externals=true
kotlin.incremental=true
kotlin_version=1.4.32
kotlin_coroutines_version=1.4.3
kotlin_serialisation_runtime_version=1.1.0
kotlin_exposed_version=0.31.1
kotlin_version=1.6.10
kotlin_coroutines_version=1.6.0
kotlin_serialisation_runtime_version=1.3.2
kotlin_exposed_version=0.37.2
sdi_version=0.4.1
tgbotapi_version=0.34.1
microutils_version=0.4.36
sdi_version=0.6.0
tgbotapi_version=0.38.0
microutils_version=0.9.0
klassindex_version=4.1.0-rc.1
sqlite_version=3.34.0
sqlite_version=3.36.0.3
github_release_plugin_version=2.2.12
group=dev.inmo
version=0.2.2
version=0.5.0

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -15,3 +15,8 @@ dependencies {
api "dev.inmo:tgbotapi:$tgbotapi_version"
api "dev.inmo:micro_utils.repos.exposed:$microutils_version"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -15,7 +15,7 @@ object PluginSerializer : KSerializer<Plugin> {
private val polymorphic = PolymorphicSerializer(Plugin::class)
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun deserialize(decoder: Decoder): Plugin {
val format = (decoder as? JsonDecoder) ?.json ?: defaultJson
val asJson = JsonElement.serializer().deserialize(decoder)
@@ -45,9 +45,9 @@ object PluginSerializer : KSerializer<Plugin> {
}
}
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override fun serialize(encoder: Encoder, value: Plugin) {
val serializer = (value::class.serializerOrNull() ?: polymorphic) as KSerializer<Plugin>
serializer.serialize(encoder, value)
}
}
}