mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2025-12-18 12:16:11 +00:00
Compare commits
14 Commits
0.3.2
...
e0ebbfa7ec
| Author | SHA1 | Date | |
|---|---|---|---|
| e0ebbfa7ec | |||
| 4df6eafe6a | |||
| 3876262a7b | |||
| b10a00ca0d | |||
| e6765b6c25 | |||
| 2fde3206e7 | |||
| 4113fb2cc1 | |||
| 79ddfaf9bd | |||
| 8ae85ecc6e | |||
| 9d25b4b071 | |||
| 6d00bb6242 | |||
| d7638d620f | |||
| 8885047409 | |||
| f09f13c13d |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -1,5 +1,25 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.5.1
|
||||||
|
|
||||||
|
* `Versions`
|
||||||
|
* `tgbotapi`: `0.38.4`
|
||||||
|
* `microutils`: `0.9.5`
|
||||||
|
|
||||||
|
## 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
|
## 0.3.2
|
||||||
|
|
||||||
* `Versions`
|
* `Versions`
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ You can create your bot using
|
|||||||
|
|
||||||
| Template: | [](https://github.com/InsanusMokrassar/PlaguBotPluginTemplate/generate) |
|
| Template: | [](https://github.com/InsanusMokrassar/PlaguBotPluginTemplate/generate) |
|
||||||
|-----------|-----------------------------------------------------------------------------------------------------------------|
|
|-----------|-----------------------------------------------------------------------------------------------------------------|
|
||||||
| Bot version: | [](https://bintray.com/insanusmokrassar/PlaguBot/plagubot.bot/_latestVersion) |
|
| Bot version: | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/plagubot.bot) |
|
||||||
| Plugin version: | [](https://bintray.com/insanusmokrassar/PlaguBot/plagubot.plugin/_latestVersion) |
|
| Plugin version: | [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/plagubot.plugin) |
|
||||||
|
|
||||||
That is a set of libraries for plagubots. Look at the
|
That is a set of libraries for plagubots. Look at the
|
||||||
[PlaguBot Plugin template](https://insanusmokrassar.github.io/PlaguBotPluginTemplate/) to find how to create your bot.
|
[PlaguBot Plugin template](https://insanusmokrassar.github.io/PlaguBotPluginTemplate/) to find how to create your bot.
|
||||||
|
|||||||
@@ -41,3 +41,8 @@ kapt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,18 +5,6 @@ import kotlinx.coroutines.*
|
|||||||
import kotlinx.serialization.InternalSerializationApi
|
import kotlinx.serialization.InternalSerializationApi
|
||||||
import java.io.File
|
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
|
* This method by default expects one argument in [args] field: path to config
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
|
|||||||
import dev.inmo.plagubot.config.*
|
import dev.inmo.plagubot.config.*
|
||||||
import dev.inmo.tgbotapi.bot.Ktor.telegramBot
|
import dev.inmo.tgbotapi.bot.Ktor.telegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
|
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviour
|
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
import dev.inmo.tgbotapi.types.botCommandsLimit
|
import dev.inmo.tgbotapi.types.botCommandsLimit
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
@@ -50,7 +49,7 @@ data class PlaguBot(
|
|||||||
*/
|
*/
|
||||||
suspend fun start(
|
suspend fun start(
|
||||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
|
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
|
||||||
): Job = bot.buildBehaviour(scope) {
|
): Job = bot.buildBehaviourWithLongPolling(scope) {
|
||||||
invoke(database, paramsMap)
|
invoke(database, paramsMap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ internal class InternalPluginSerializer(
|
|||||||
) : KSerializer<Plugin> {
|
) : KSerializer<Plugin> {
|
||||||
override val descriptor: SerialDescriptor = PluginSerializer.descriptor
|
override val descriptor: SerialDescriptor = PluginSerializer.descriptor
|
||||||
|
|
||||||
@InternalSerializationApi
|
@OptIn(InternalSerializationApi::class)
|
||||||
override fun deserialize(decoder: Decoder): Plugin {
|
override fun deserialize(decoder: Decoder): Plugin {
|
||||||
val asJson = JsonElement.serializer().deserialize(decoder)
|
val asJson = JsonElement.serializer().deserialize(decoder)
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ internal class InternalPluginSerializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@InternalSerializationApi
|
@OptIn(InternalSerializationApi::class)
|
||||||
override fun serialize(encoder: Encoder, value: Plugin) {
|
override fun serialize(encoder: Encoder, value: Plugin) {
|
||||||
params.keys.firstOrNull { params[it] === value } ?.also {
|
params.keys.firstOrNull { params[it] === value } ?.also {
|
||||||
encoder.encodeString(it)
|
encoder.encodeString(it)
|
||||||
@@ -90,7 +90,7 @@ internal class InternalModuleSerializer(
|
|||||||
) : KSerializer<Module> {
|
) : KSerializer<Module> {
|
||||||
override val descriptor: SerialDescriptor = PluginSerializer.descriptor
|
override val descriptor: SerialDescriptor = PluginSerializer.descriptor
|
||||||
|
|
||||||
@InternalSerializationApi
|
@OptIn(InternalSerializationApi::class)
|
||||||
override fun deserialize(decoder: Decoder): Module {
|
override fun deserialize(decoder: Decoder): Module {
|
||||||
val asJson = JsonElement.serializer().deserialize(decoder)
|
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)
|
override fun serialize(encoder: Encoder, value: Module) = DefaultModuleSerializer.serialize(encoder, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ internal object PluginsConfigurationSerializer : KSerializer<PluginsConfiguratio
|
|||||||
private val moduleSerializer = ModuleSerializer()
|
private val moduleSerializer = ModuleSerializer()
|
||||||
override val descriptor: SerialDescriptor = jsonSerializer.descriptor
|
override val descriptor: SerialDescriptor = jsonSerializer.descriptor
|
||||||
|
|
||||||
@InternalSerializationApi
|
@OptIn(InternalSerializationApi::class)
|
||||||
override fun deserialize(decoder: Decoder): PluginsConfiguration {
|
override fun deserialize(decoder: Decoder): PluginsConfiguration {
|
||||||
val json = jsonSerializer.deserialize(decoder)
|
val json = jsonSerializer.deserialize(decoder)
|
||||||
val jsonFormat = (decoder as? JsonDecoder) ?.json ?: configAndPluginsConfigJsonFormat
|
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) {
|
override fun serialize(encoder: Encoder, value: PluginsConfiguration) {
|
||||||
val params = value.params
|
val params = value.params
|
||||||
val serializer = when (value) {
|
val serializer = when (value) {
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ org.gradle.parallel=true
|
|||||||
kotlin.js.generate.externals=true
|
kotlin.js.generate.externals=true
|
||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
|
|
||||||
kotlin_version=1.5.31
|
kotlin_version=1.6.10
|
||||||
kotlin_coroutines_version=1.5.2
|
kotlin_coroutines_version=1.6.0
|
||||||
kotlin_serialisation_runtime_version=1.2.2
|
kotlin_serialisation_runtime_version=1.3.2
|
||||||
kotlin_exposed_version=0.34.2
|
kotlin_exposed_version=0.37.2
|
||||||
|
|
||||||
sdi_version=0.5.0
|
sdi_version=0.6.0
|
||||||
tgbotapi_version=0.35.9
|
tgbotapi_version=0.38.4
|
||||||
microutils_version=0.5.28
|
microutils_version=0.9.5
|
||||||
klassindex_version=4.1.0-rc.1
|
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
|
github_release_plugin_version=2.2.12
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.3.2
|
version=0.5.1
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -15,3 +15,8 @@ dependencies {
|
|||||||
api "dev.inmo:tgbotapi:$tgbotapi_version"
|
api "dev.inmo:tgbotapi:$tgbotapi_version"
|
||||||
api "dev.inmo:micro_utils.repos.exposed:$microutils_version"
|
api "dev.inmo:micro_utils.repos.exposed:$microutils_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ object PluginSerializer : KSerializer<Plugin> {
|
|||||||
private val polymorphic = PolymorphicSerializer(Plugin::class)
|
private val polymorphic = PolymorphicSerializer(Plugin::class)
|
||||||
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
|
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
|
||||||
|
|
||||||
@InternalSerializationApi
|
@OptIn(InternalSerializationApi::class)
|
||||||
override fun deserialize(decoder: Decoder): Plugin {
|
override fun deserialize(decoder: Decoder): Plugin {
|
||||||
val format = (decoder as? JsonDecoder) ?.json ?: defaultJson
|
val format = (decoder as? JsonDecoder) ?.json ?: defaultJson
|
||||||
val asJson = JsonElement.serializer().deserialize(decoder)
|
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) {
|
override fun serialize(encoder: Encoder, value: Plugin) {
|
||||||
val serializer = (value::class.serializerOrNull() ?: polymorphic) as KSerializer<Plugin>
|
val serializer = (value::class.serializerOrNull() ?: polymorphic) as KSerializer<Plugin>
|
||||||
serializer.serialize(encoder, value)
|
serializer.serialize(encoder, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user