mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-12-22 05:57:13 +00:00
commit
0bdd965a4a
1
.github/workflows/build_and_publish.yml
vendored
1
.github/workflows/build_and_publish.yml
vendored
@ -14,6 +14,7 @@ jobs:
|
|||||||
java-version: 17
|
java-version: 17
|
||||||
- name: Rewrite version
|
- name: Rewrite version
|
||||||
run: |
|
run: |
|
||||||
|
printf "\norg.gradle.jvmargs=-Xmx1g -Xms500m\nkotlin.daemon.jvmargs=-Xmx1g -Xms500m\norg.gradle.daemon=false" >> gradle.properties
|
||||||
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
||||||
cat gradle.properties | sed -e "s/^version=\([0-9\.]*\)/version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
cat gradle.properties | sed -e "s/^version=\([0-9\.]*\)/version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||||
rm gradle.properties
|
rm gradle.properties
|
||||||
|
1
.github/workflows/docker-publish.yml
vendored
1
.github/workflows/docker-publish.yml
vendored
@ -16,6 +16,7 @@ jobs:
|
|||||||
java-version: 17
|
java-version: 17
|
||||||
- name: Rewrite version
|
- name: Rewrite version
|
||||||
run: |
|
run: |
|
||||||
|
printf "\norg.gradle.jvmargs=-Xmx1g -Xms500m\nkotlin.daemon.jvmargs=-Xmx1g -Xms500m\norg.gradle.daemon=false" >> gradle.properties
|
||||||
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
||||||
if [[ "$branch" != "master" ]]; then
|
if [[ "$branch" != "master" ]]; then
|
||||||
cat gradle.properties | sed -e "s/^version=\([0-9\.]*\)/version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
cat gradle.properties | sed -e "s/^version=\([0-9\.]*\)/version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# PlaguPoster
|
# PlaguPoster
|
||||||
|
|
||||||
|
## 0.6.0
|
||||||
|
|
||||||
|
* Dependencies update
|
||||||
|
|
||||||
## 0.5.6
|
## 0.5.6
|
||||||
|
|
||||||
* `Ratings`:
|
* `Ratings`:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
org.gradle.jvmargs=-Xmx1024m
|
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
kotlin.js.generate.externals=true
|
kotlin.js.generate.externals=true
|
||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
@ -10,4 +9,4 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.5.6
|
version=0.6.0
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
kotlin = "1.9.23"
|
kotlin = "1.9.23"
|
||||||
kotlin-serialization = "1.6.3"
|
kotlin-serialization = "1.6.3"
|
||||||
|
|
||||||
plagubot = "8.3.0"
|
plagubot = "8.4.0"
|
||||||
tgbotapi = "12.0.1"
|
tgbotapi = "15.0.0"
|
||||||
microutils = "0.20.45"
|
microutils = "0.21.1"
|
||||||
kslog = "1.3.3"
|
kslog = "1.3.4"
|
||||||
krontab = "2.2.9"
|
krontab = "2.3.0"
|
||||||
plagubot-plugins = "0.18.3"
|
plagubot-plugins = "0.19.0"
|
||||||
|
|
||||||
dokka = "1.9.20"
|
dokka = "1.9.20"
|
||||||
|
|
||||||
|
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-8.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -122,7 +122,7 @@ suspend fun BehaviourContext.includeRootNavigationButtonsHandler(
|
|||||||
|
|
||||||
edit(
|
edit(
|
||||||
it.message,
|
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) {
|
if (prefix == RootButtonsShowRatingData) {
|
||||||
runCatchingSafely {
|
runCatchingSafely {
|
||||||
val rating = ratingRaw.toDoubleOrNull() ?: return@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)
|
answer(it)
|
||||||
|
@ -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.answers.answer
|
||||||
import dev.inmo.tgbotapi.extensions.api.delete
|
import dev.inmo.tgbotapi.extensions.api.delete
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
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.reply
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
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.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.bold
|
import dev.inmo.tgbotapi.types.message.textsources.bold
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.regular
|
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.buildEntities
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeSourceString
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -112,7 +116,7 @@ object Plugin : Plugin {
|
|||||||
onPollUpdates (markerFactory = { it.id }) { poll ->
|
onPollUpdates (markerFactory = { it.id }) { poll ->
|
||||||
val postId = pollsToPostsIdsRepo.get(poll.id) ?: return@onPollUpdates
|
val postId = pollsToPostsIdsRepo.get(poll.id) ?: return@onPollUpdates
|
||||||
val newRating = poll.options.sumOf {
|
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))
|
ratingsRepo.set(postId, Rating(newRating))
|
||||||
}
|
}
|
||||||
@ -129,7 +133,9 @@ object Plugin : Plugin {
|
|||||||
val sent = send(
|
val sent = send(
|
||||||
content.chatId,
|
content.chatId,
|
||||||
config.ratingOfferText,
|
config.ratingOfferText,
|
||||||
config.variants.keys.toList(),
|
options = config.variants.map {
|
||||||
|
InputPollOption(it.key)
|
||||||
|
},
|
||||||
replyParameters = ReplyParameters(content.chatId, content.messageId)
|
replyParameters = ReplyParameters(content.chatId, content.messageId)
|
||||||
)
|
)
|
||||||
pollsToPostsIdsRepo.set(sent.content.poll.id, postId)
|
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 }) {
|
onMessageDataCallbackQuery("ratings_interactive", initialFilter = { it.message.chat.id in chatConfig.allSourceChatIds }) {
|
||||||
edit(
|
edit(
|
||||||
it.message,
|
it.message,
|
||||||
ratingsRepo.buildRootButtons()
|
replyMarkup = ratingsRepo.buildRootButtons()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user