update dependencies

This commit is contained in:
InsanusMokrassar 2024-06-28 13:24:13 +06:00
parent ae6993efba
commit e3958aff3f
6 changed files with 20 additions and 13 deletions

View File

@ -2,6 +2,8 @@
## 0.6.0
* Dependencies update
## 0.5.6
* `Ratings`:

View File

@ -1,5 +1,4 @@
kotlin.code.style=official
org.gradle.jvmargs=-Xmx1024m
org.gradle.parallel=true
kotlin.js.generate.externals=true
kotlin.incremental=true

View File

@ -3,12 +3,12 @@
kotlin = "1.9.23"
kotlin-serialization = "1.6.3"
plagubot = "8.3.0"
tgbotapi = "12.0.1"
microutils = "0.20.45"
kslog = "1.3.3"
krontab = "2.2.9"
plagubot-plugins = "0.18.3"
plagubot = "8.4.0"
tgbotapi = "15.0.0"
microutils = "0.21.1"
kslog = "1.3.4"
krontab = "2.3.0"
plagubot-plugins = "0.19.0"
dokka = "1.9.20"

View File

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

View File

@ -122,7 +122,7 @@ suspend fun BehaviourContext.includeRootNavigationButtonsHandler(
edit(
it.message,
onPageUpdate(SimplePagination(page, size), args.drop(3).toTypedArray()) ?: return@runCatchingSafely
replyMarkup = onPageUpdate(SimplePagination(page, size), args.drop(3).toTypedArray()) ?: return@runCatchingSafely
)
}
@ -155,7 +155,7 @@ suspend fun BehaviourContext.includeRootNavigationButtonsHandler(
if (prefix == RootButtonsShowRatingData) {
runCatchingSafely {
val rating = ratingRaw.toDoubleOrNull() ?: return@runCatchingSafely
edit(it.message, ratingsRepo.buildRatingButtons(postsRepo, Rating(rating)))
edit(it.message, replyMarkup = ratingsRepo.buildRatingButtons(postsRepo, Rating(rating)))
}
answer(it)

View File

@ -28,6 +28,7 @@ import dev.inmo.plaguposter.ratings.utils.postsByRatings
import dev.inmo.tgbotapi.extensions.api.answers.answer
import dev.inmo.tgbotapi.extensions.api.delete
import dev.inmo.tgbotapi.extensions.api.edit.edit
import dev.inmo.tgbotapi.extensions.api.send.polls.sendRegularPoll
import dev.inmo.tgbotapi.extensions.api.send.reply
import dev.inmo.tgbotapi.extensions.api.send.send
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
@ -41,7 +42,10 @@ import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton
import dev.inmo.tgbotapi.types.message.textsources.bold
import dev.inmo.tgbotapi.types.message.textsources.regular
import dev.inmo.tgbotapi.types.polls.InputPollOption
import dev.inmo.tgbotapi.types.polls.PollOption
import dev.inmo.tgbotapi.utils.buildEntities
import dev.inmo.tgbotapi.utils.extensions.makeSourceString
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
import kotlinx.serialization.Serializable
@ -112,7 +116,7 @@ object Plugin : Plugin {
onPollUpdates (markerFactory = { it.id }) { poll ->
val postId = pollsToPostsIdsRepo.get(poll.id) ?: return@onPollUpdates
val newRating = poll.options.sumOf {
(variantsTransformer(it.text) ?.double ?.times(it.votes)) ?: 0.0
(variantsTransformer(it.textSources.makeSourceString()) ?.double ?.times(it.votes)) ?: 0.0
}
ratingsRepo.set(postId, Rating(newRating))
}
@ -129,7 +133,9 @@ object Plugin : Plugin {
val sent = send(
content.chatId,
config.ratingOfferText,
config.variants.keys.toList(),
options = config.variants.map {
InputPollOption(it.key)
},
replyParameters = ReplyParameters(content.chatId, content.messageId)
)
pollsToPostsIdsRepo.set(sent.content.poll.id, postId)
@ -265,7 +271,7 @@ object Plugin : Plugin {
onMessageDataCallbackQuery("ratings_interactive", initialFilter = { it.message.chat.id in chatConfig.allSourceChatIds }) {
edit(
it.message,
ratingsRepo.buildRootButtons()
replyMarkup = ratingsRepo.buildRootButtons()
)
}