mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-12-22 14:07:14 +00:00
commit
65f613fd97
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -12,8 +12,5 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- name: Fix android 32.0.0 dx
|
|
||||||
continue-on-error: true
|
|
||||||
run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
@ -7,8 +7,6 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath libs.android.tools.build
|
|
||||||
classpath libs.android.dexcount
|
|
||||||
classpath libs.kotlin.gradle.plugin
|
classpath libs.kotlin.gradle.plugin
|
||||||
classpath libs.kotlin.serialization.plugin
|
classpath libs.kotlin.serialization.plugin
|
||||||
classpath libs.kotlin.dokka.plugin
|
classpath libs.kotlin.dokka.plugin
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
apply plugin: 'com.getkeepsafe.dexcount'
|
|
||||||
|
|
||||||
android {
|
|
||||||
ext {
|
|
||||||
jvmKotlinFolderFile = {
|
|
||||||
String sep = File.separator
|
|
||||||
return new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin")
|
|
||||||
}
|
|
||||||
|
|
||||||
enableIncludingJvmCodeInAndroidPart = {
|
|
||||||
File jvmKotlinFolder = jvmKotlinFolderFile()
|
|
||||||
if (jvmKotlinFolder.exists()) {
|
|
||||||
android.sourceSets.main.java.srcDirs += jvmKotlinFolder.path
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
disableIncludingJvmCodeInAndroidPart = {
|
|
||||||
File jvmKotlinFolder = jvmKotlinFolderFile()
|
|
||||||
String[] oldDirs = android.sourceSets.main.java.srcDirs
|
|
||||||
android.sourceSets.main.java.srcDirs = []
|
|
||||||
for (oldDir in oldDirs) {
|
|
||||||
if (oldDir != jvmKotlinFolder.path) {
|
|
||||||
android.sourceSets.main.java.srcDirs += oldDir
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileSdkVersion libs.versions.android.compileSdk.get().toInteger()
|
|
||||||
buildToolsVersion libs.versions.android.buildTools.get()
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion libs.versions.android.minSdk.get().toInteger()
|
|
||||||
targetSdkVersion libs.versions.android.compileSdk.get().toInteger()
|
|
||||||
versionCode "${android_code_version}".toInteger()
|
|
||||||
versionName "$version"
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
}
|
|
||||||
debug {
|
|
||||||
debuggable true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
packagingOptions {
|
|
||||||
exclude 'META-INF/kotlinx-serialization-runtime.kotlin_module'
|
|
||||||
exclude 'META-INF/kotlinx-serialization-cbor.kotlin_module'
|
|
||||||
exclude 'META-INF/kotlinx-serialization-properties.kotlin_module'
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
String sep = File.separator
|
|
||||||
main.java.srcDirs += "src${sep}main${sep}kotlin"
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,5 +10,5 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.0.4
|
version=0.0.5
|
||||||
android_code_version=4
|
android_code_version=5
|
||||||
|
@ -1,27 +1,18 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.7.10"
|
kotlin = "1.7.20"
|
||||||
kotlin-serialization = "1.4.0"
|
kotlin-serialization = "1.4.1"
|
||||||
|
|
||||||
plagubot = "2.3.4"
|
plagubot = "2.4.0"
|
||||||
tgbotapi = "3.2.7"
|
tgbotapi = "3.3.0"
|
||||||
microutils = "0.12.16"
|
microutils = "0.13.1"
|
||||||
kslog = "0.5.2"
|
kslog = "0.5.2"
|
||||||
krontab = "0.8.1"
|
krontab = "0.8.1"
|
||||||
tgbotapi-libraries = "0.5.5"
|
tgbotapi-libraries = "0.5.6"
|
||||||
|
plagubot-plugins = "0.5.0"
|
||||||
|
|
||||||
psql = "42.5.0"
|
psql = "42.5.0"
|
||||||
|
|
||||||
dexcount = "3.1.0"
|
|
||||||
junit_version = "4.12"
|
|
||||||
test_ext_junit_version = "1.1.3"
|
|
||||||
espresso_core = "3.4.0"
|
|
||||||
|
|
||||||
android-gradle-plugin = "7.2.2"
|
|
||||||
android-minSdk = "21"
|
|
||||||
android-compileSdk = "33"
|
|
||||||
android-buildTools = "33.0.0"
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
|
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
|
||||||
@ -30,12 +21,11 @@ kotlin-test-common = { module = "org.jetbrains.kotlin:kotlin-test-common", versi
|
|||||||
kotlin-test-annotations-common = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" }
|
kotlin-test-annotations-common = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" }
|
||||||
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
|
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
|
||||||
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
|
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
|
||||||
android-test-junit = { module = "androidx.test.ext:junit", version.ref = "test_ext_junit_version" }
|
|
||||||
android-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso_core" }
|
|
||||||
|
|
||||||
tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" }
|
tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" }
|
||||||
plagubot-plugin = { module = "dev.inmo:plagubot.plugin", version.ref = "plagubot" }
|
plagubot-plugin = { module = "dev.inmo:plagubot.plugin", version.ref = "plagubot" }
|
||||||
plagubot-bot = { module = "dev.inmo:plagubot.bot", version.ref = "plagubot" }
|
plagubot-bot = { module = "dev.inmo:plagubot.bot", version.ref = "plagubot" }
|
||||||
|
plagubot-plugins-inline-queries = { module = "dev.inmo:plagubot.plugins.inline.queries", version.ref = "plagubot-plugins" }
|
||||||
microutils-repos-common = { module = "dev.inmo:micro_utils.repos.common", version.ref = "microutils" }
|
microutils-repos-common = { module = "dev.inmo:micro_utils.repos.common", version.ref = "microutils" }
|
||||||
microutils-repos-exposed = { module = "dev.inmo:micro_utils.repos.exposed", version.ref = "microutils" }
|
microutils-repos-exposed = { module = "dev.inmo:micro_utils.repos.exposed", version.ref = "microutils" }
|
||||||
microutils-repos-cache = { module = "dev.inmo:micro_utils.repos.cache", version.ref = "microutils" }
|
microutils-repos-cache = { module = "dev.inmo:micro_utils.repos.cache", version.ref = "microutils" }
|
||||||
@ -47,8 +37,6 @@ psql = { module = "org.postgresql:postgresql", version.ref = "psql" }
|
|||||||
|
|
||||||
# buildscript classpaths
|
# buildscript classpaths
|
||||||
|
|
||||||
android-tools-build = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" }
|
|
||||||
android-dexcount = { module = "com.getkeepsafe.dexcount:dexcount-gradle-plugin", version.ref = "dexcount" }
|
|
||||||
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||||
kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
||||||
kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "kotlin" }
|
kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "kotlin" }
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -15,6 +14,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
jvmMain {
|
jvmMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api libs.plagubot.plugins.inline.queries
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
package dev.inmo.plaguposter.inlines
|
package dev.inmo.plagubot.plugins.inline.queries
|
||||||
|
@ -1,81 +1,21 @@
|
|||||||
package dev.inmo.plaguposter.inlines
|
package dev.inmo.plaguposter.inlines
|
||||||
|
|
||||||
import dev.inmo.micro_utils.pagination.Pagination
|
import dev.inmo.kslog.common.TagLogger
|
||||||
import dev.inmo.micro_utils.pagination.utils.paginate
|
import dev.inmo.kslog.common.w
|
||||||
import dev.inmo.plagubot.Plugin
|
import dev.inmo.plagubot.Plugin
|
||||||
import dev.inmo.plaguposter.common.ChatConfig
|
|
||||||
import dev.inmo.plaguposter.inlines.models.Format
|
|
||||||
import dev.inmo.plaguposter.inlines.models.OfferTemplate
|
|
||||||
import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo
|
|
||||||
import dev.inmo.tgbotapi.bot.exceptions.RequestException
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.answers.answerInlineQuery
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.reply
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onBaseInlineQuery
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
|
||||||
import dev.inmo.tgbotapi.types.inlineQueryAnswerResultsLimit
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
import kotlinx.serialization.json.*
|
|
||||||
import org.jetbrains.exposed.sql.Database
|
|
||||||
import org.koin.core.Koin
|
import org.koin.core.Koin
|
||||||
import org.koin.core.module.Module
|
|
||||||
|
|
||||||
object Plugin : Plugin {
|
private val actualPlugin = dev.inmo.plagubot.plugins.inline.queries.Plugin
|
||||||
@Serializable
|
|
||||||
internal data class Config(
|
|
||||||
val preset: List<OfferTemplate>
|
|
||||||
)
|
|
||||||
override fun Module.setupDI(database: Database, params: JsonObject) {
|
|
||||||
single { get<Json>().decodeFromJsonElement(Config.serializer(), params["inlines"] ?: return@single Config(emptyList())) }
|
|
||||||
single { InlineTemplatesRepo(getOrNull<Config>() ?.preset ?.toMutableSet() ?: mutableSetOf()) }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
object Plugin : Plugin by actualPlugin {
|
||||||
|
private val log = TagLogger("InlinePlugin")
|
||||||
override suspend fun BehaviourContext.setupBotPlugin(koin: Koin) {
|
override suspend fun BehaviourContext.setupBotPlugin(koin: Koin) {
|
||||||
val templatesRepo = koin.get<InlineTemplatesRepo>()
|
log.w {
|
||||||
onBaseInlineQuery { query ->
|
"Built-in inline plugin has been deprecated. Use \"${actualPlugin::class.qualifiedName}\" instead"
|
||||||
val page = query.offset.toIntOrNull() ?: 0
|
|
||||||
val queryString = query.query.trim()
|
|
||||||
try {
|
|
||||||
answerInlineQuery(
|
|
||||||
query,
|
|
||||||
templatesRepo.templates.paginate(
|
|
||||||
Pagination(
|
|
||||||
page,
|
|
||||||
inlineQueryAnswerResultsLimit.last + 1
|
|
||||||
)
|
|
||||||
).results.mapIndexedNotNull { index, offerTemplate ->
|
|
||||||
offerTemplate.createArticleResult(
|
|
||||||
index.toString(),
|
|
||||||
queryString
|
|
||||||
)
|
|
||||||
},
|
|
||||||
nextOffset = (page + 1).toString(),
|
|
||||||
cachedTime = 0
|
|
||||||
)
|
|
||||||
} catch (e: RequestException) {
|
|
||||||
bot.answerInlineQuery(
|
|
||||||
query,
|
|
||||||
cachedTime = 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onCommand("help", requireOnlyCommandInMessage = true) {
|
with(actualPlugin) {
|
||||||
reply(
|
setupBotPlugin(koin)
|
||||||
it,
|
|
||||||
"Push the button above to see available commands",
|
|
||||||
replyMarkup = flatInlineKeyboard {
|
|
||||||
inlineQueryInCurrentChatButton("Toggle commands", "")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
koin.getOrNull<InlineTemplatesRepo>() ?.apply {
|
|
||||||
addTemplate(
|
|
||||||
OfferTemplate(
|
|
||||||
"Trigger help button",
|
|
||||||
listOf(Format("/help"))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
package dev.inmo.plaguposter.inlines.models
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputTextMessageContent
|
|
||||||
import dev.inmo.tgbotapi.types.message.MarkdownV2
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
import kotlinx.serialization.Transient
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class Format(
|
|
||||||
val template: String,
|
|
||||||
val regexTemplate: String = "^$",
|
|
||||||
val splitBy: String? = null,
|
|
||||||
val enableMarkdownSupport: Boolean = false
|
|
||||||
) {
|
|
||||||
@Transient
|
|
||||||
val queryRegex = Regex(regexTemplate, RegexOption.DOT_MATCHES_ALL)
|
|
||||||
|
|
||||||
init {
|
|
||||||
println(queryRegex)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun formatByRegex(with: String): String? {
|
|
||||||
return if (queryRegex.matches(with)) {
|
|
||||||
template.format(*(splitBy ?.let { with.split(it).toTypedArray() } ?: arrayOf(with)))
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createContent(with: String): InputTextMessageContent? {
|
|
||||||
return if (queryRegex.matches(with)) {
|
|
||||||
InputTextMessageContent(
|
|
||||||
template.format(*(splitBy ?.let { with.split(it).toTypedArray() } ?: arrayOf(with))),
|
|
||||||
if (enableMarkdownSupport) MarkdownV2 else null
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package dev.inmo.plaguposter.inlines.models
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class OfferTemplate(
|
|
||||||
val title: String,
|
|
||||||
val formats: List<Format> = emptyList(),
|
|
||||||
val description: String? = null
|
|
||||||
) {
|
|
||||||
fun createArticleResult(id: String, query: String): InlineQueryResultArticle? = formats.firstOrNull {
|
|
||||||
it.queryRegex.matches(query)
|
|
||||||
} ?.createContent(query) ?.let { content ->
|
|
||||||
InlineQueryResultArticle(
|
|
||||||
id,
|
|
||||||
title,
|
|
||||||
content,
|
|
||||||
description = description
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package dev.inmo.plaguposter.inlines.repos
|
|
||||||
|
|
||||||
import dev.inmo.plaguposter.inlines.models.OfferTemplate
|
|
||||||
|
|
||||||
class InlineTemplatesRepo(
|
|
||||||
private val _templates: MutableSet<OfferTemplate>
|
|
||||||
) {
|
|
||||||
internal val templates
|
|
||||||
get() = _templates.toList()
|
|
||||||
suspend fun addTemplate(offerTemplate: OfferTemplate): Boolean {
|
|
||||||
return _templates.add(offerTemplate)
|
|
||||||
}
|
|
||||||
suspend fun dropTemplate(offerTemplate: OfferTemplate): Boolean {
|
|
||||||
return _templates.remove(offerTemplate)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
<manifest package="dev.inmo.plaguposter.inlines"/>
|
<manifest package="dev.inmo.plagubot.plugins.inline.queries"/>
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
project.version = "$version"
|
|
||||||
project.group = "$group"
|
|
||||||
|
|
||||||
// apply from: "$publishGradlePath"
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
android {
|
|
||||||
publishAllLibraryVariants()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
commonMain {
|
|
||||||
dependencies {
|
|
||||||
implementation libs.kotlin
|
|
||||||
api libs.kotlin.serialization
|
|
||||||
}
|
|
||||||
}
|
|
||||||
commonTest {
|
|
||||||
dependencies {
|
|
||||||
implementation libs.kotlin.test.common
|
|
||||||
implementation libs.kotlin.test.annotations.common
|
|
||||||
}
|
|
||||||
}
|
|
||||||
androidTest {
|
|
||||||
dependencies {
|
|
||||||
implementation libs.kotlin.test.junit
|
|
||||||
implementation libs.android.test.junit
|
|
||||||
implementation libs.android.test.espresso.core
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "$defaultAndroidSettingsPresetPath"
|
|
@ -4,21 +4,12 @@ project.group = "$group"
|
|||||||
// apply from: "$publishGradlePath"
|
// apply from: "$publishGradlePath"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm {
|
jvm()
|
||||||
compilations.main {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
js (IR) {
|
js (IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
android {
|
|
||||||
publishAllLibraryVariants()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -43,19 +34,7 @@ kotlin {
|
|||||||
implementation libs.kotlin.test.junit
|
implementation libs.kotlin.test.junit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
androidTest {
|
|
||||||
dependencies {
|
|
||||||
implementation libs.kotlin.test.junit
|
|
||||||
implementation libs.android.test.junit
|
|
||||||
implementation libs.android.test.espresso.core
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "$defaultAndroidSettingsPresetPath"
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
|
@ -10,9 +10,9 @@ import dev.inmo.plaguposter.common.SuccessfulSymbol
|
|||||||
import dev.inmo.plaguposter.common.UnsuccessfulSymbol
|
import dev.inmo.plaguposter.common.UnsuccessfulSymbol
|
||||||
import dev.inmo.plaguposter.posts.exposed.ExposedPostsRepo
|
import dev.inmo.plaguposter.posts.exposed.ExposedPostsRepo
|
||||||
import dev.inmo.plaguposter.common.ChatConfig
|
import dev.inmo.plaguposter.common.ChatConfig
|
||||||
import dev.inmo.plaguposter.inlines.models.Format
|
import dev.inmo.plagubot.plugins.inline.queries.models.Format
|
||||||
import dev.inmo.plaguposter.inlines.models.OfferTemplate
|
import dev.inmo.plagubot.plugins.inline.queries.models.OfferTemplate
|
||||||
import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo
|
import dev.inmo.plagubot.plugins.inline.queries.repos.InlineTemplatesRepo
|
||||||
import dev.inmo.plaguposter.posts.repo.*
|
import dev.inmo.plaguposter.posts.repo.*
|
||||||
import dev.inmo.plaguposter.posts.sending.PostPublisher
|
import dev.inmo.plaguposter.posts.sending.PostPublisher
|
||||||
import dev.inmo.tgbotapi.extensions.api.delete
|
import dev.inmo.tgbotapi.extensions.api.delete
|
||||||
|
@ -12,8 +12,7 @@ import dev.inmo.tgbotapi.types.MessageIdentifier
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.statements.InsertStatement
|
import org.jetbrains.exposed.sql.statements.*
|
||||||
import org.jetbrains.exposed.sql.statements.UpdateStatement
|
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
class ExposedPostsRepo(
|
class ExposedPostsRepo(
|
||||||
@ -21,7 +20,7 @@ class ExposedPostsRepo(
|
|||||||
) : PostsRepo, AbstractExposedCRUDRepo<RegisteredPost, PostId, NewPost>(
|
) : PostsRepo, AbstractExposedCRUDRepo<RegisteredPost, PostId, NewPost>(
|
||||||
tableName = "posts"
|
tableName = "posts"
|
||||||
) {
|
) {
|
||||||
val idColumn = text("id").clientDefault { uuid4().toString() }
|
val idColumn = text("id")
|
||||||
val createdColumn = double("datetime").default(0.0)
|
val createdColumn = double("datetime").default(0.0)
|
||||||
|
|
||||||
private val contentRepo by lazy {
|
private val contentRepo by lazy {
|
||||||
@ -59,18 +58,6 @@ class ExposedPostsRepo(
|
|||||||
override fun InsertStatement<Number>.asObject(value: NewPost): RegisteredPost {
|
override fun InsertStatement<Number>.asObject(value: NewPost): RegisteredPost {
|
||||||
val id = PostId(get(idColumn))
|
val id = PostId(get(idColumn))
|
||||||
|
|
||||||
with(contentRepo) {
|
|
||||||
value.content.forEach { contentInfo ->
|
|
||||||
insert {
|
|
||||||
it[postIdColumn] = id.string
|
|
||||||
it[chatIdColumn] = contentInfo.chatId.chatId
|
|
||||||
it[messageIdColumn] = contentInfo.messageId
|
|
||||||
it[groupColumn] = contentInfo.group
|
|
||||||
it[orderColumn] = contentInfo.order
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return RegisteredPost(
|
return RegisteredPost(
|
||||||
id,
|
id,
|
||||||
DateTime(get(createdColumn)),
|
DateTime(get(createdColumn)),
|
||||||
@ -82,7 +69,14 @@ class ExposedPostsRepo(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun update(id: PostId, value: NewPost, it: UpdateStatement) {
|
override fun createAndInsertId(value: NewPost, it: InsertStatement<Number>): PostId {
|
||||||
|
val id = PostId(uuid4().toString())
|
||||||
|
it[idColumn] = id.string
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun update(id: PostId?, value: NewPost, it: UpdateBuilder<Int>) {
|
||||||
|
id ?: error("Unable to find post id in update")
|
||||||
with(contentRepo) {
|
with(contentRepo) {
|
||||||
deleteWhere { postIdColumn.eq(id.string) }
|
deleteWhere { postIdColumn.eq(id.string) }
|
||||||
value.content.forEach { contentInfo ->
|
value.content.forEach { contentInfo ->
|
||||||
@ -98,6 +92,7 @@ class ExposedPostsRepo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun insert(value: NewPost, it: InsertStatement<Number>) {
|
override fun insert(value: NewPost, it: InsertStatement<Number>) {
|
||||||
|
super.insert(value, it)
|
||||||
it[createdColumn] = DateTime.now().unixMillis
|
it[createdColumn] = DateTime.now().unixMillis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -13,9 +12,5 @@ kotlin {
|
|||||||
api project(":plaguposter.posts")
|
api project(":plaguposter.posts")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ import dev.inmo.micro_utils.fsm.common.State
|
|||||||
import dev.inmo.micro_utils.repos.create
|
import dev.inmo.micro_utils.repos.create
|
||||||
import dev.inmo.plagubot.Plugin
|
import dev.inmo.plagubot.Plugin
|
||||||
import dev.inmo.plaguposter.common.*
|
import dev.inmo.plaguposter.common.*
|
||||||
import dev.inmo.plaguposter.inlines.models.Format
|
import dev.inmo.plagubot.plugins.inline.queries.models.Format
|
||||||
import dev.inmo.plaguposter.inlines.models.OfferTemplate
|
import dev.inmo.plagubot.plugins.inline.queries.models.OfferTemplate
|
||||||
import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo
|
import dev.inmo.plagubot.plugins.inline.queries.repos.InlineTemplatesRepo
|
||||||
import dev.inmo.plaguposter.posts.models.*
|
import dev.inmo.plaguposter.posts.models.*
|
||||||
import dev.inmo.plaguposter.posts.registrar.state.RegistrationState
|
import dev.inmo.plaguposter.posts.registrar.state.RegistrationState
|
||||||
import dev.inmo.plaguposter.posts.repo.PostsRepo
|
import dev.inmo.plaguposter.posts.repo.PostsRepo
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -14,9 +13,5 @@ kotlin {
|
|||||||
api project(":plaguposter.posts")
|
api project(":plaguposter.posts")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -15,9 +14,5 @@ kotlin {
|
|||||||
api libs.krontab
|
api libs.krontab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -14,9 +13,5 @@ kotlin {
|
|||||||
api project(":plaguposter.ratings")
|
api project(":plaguposter.ratings")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -15,9 +14,5 @@ kotlin {
|
|||||||
api project(":plaguposter.posts.panel")
|
api project(":plaguposter.posts.panel")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ import dev.inmo.micro_utils.repos.pagination.getAll
|
|||||||
import dev.inmo.micro_utils.repos.set
|
import dev.inmo.micro_utils.repos.set
|
||||||
import dev.inmo.plagubot.Plugin
|
import dev.inmo.plagubot.Plugin
|
||||||
import dev.inmo.plaguposter.common.*
|
import dev.inmo.plaguposter.common.*
|
||||||
import dev.inmo.plaguposter.inlines.models.Format
|
import dev.inmo.plagubot.plugins.inline.queries.models.Format
|
||||||
import dev.inmo.plaguposter.inlines.models.OfferTemplate
|
import dev.inmo.plagubot.plugins.inline.queries.models.OfferTemplate
|
||||||
import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo
|
import dev.inmo.plagubot.plugins.inline.queries.repos.InlineTemplatesRepo
|
||||||
import dev.inmo.plaguposter.posts.models.PostId
|
import dev.inmo.plaguposter.posts.models.PostId
|
||||||
import dev.inmo.plaguposter.posts.panel.PanelButtonBuilder
|
import dev.inmo.plaguposter.posts.panel.PanelButtonBuilder
|
||||||
import dev.inmo.plaguposter.posts.panel.PanelButtonsAPI
|
import dev.inmo.plaguposter.posts.panel.PanelButtonsAPI
|
||||||
@ -38,6 +38,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineK
|
|||||||
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.utils.buildEntities
|
import dev.inmo.tgbotapi.utils.buildEntities
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.*
|
import kotlinx.serialization.json.*
|
||||||
@ -108,6 +109,9 @@ object Plugin : Plugin {
|
|||||||
pollsToPostsIdsRepo.set(sent.content.poll.id, postId)
|
pollsToPostsIdsRepo.set(sent.content.poll.id, postId)
|
||||||
pollsToMessageInfoRepo.set(sent.content.poll.id, sent.short())
|
pollsToMessageInfoRepo.set(sent.content.poll.id, sent.short())
|
||||||
}.getOrNull() ?: continue
|
}.getOrNull() ?: continue
|
||||||
|
|
||||||
|
delay(500L)
|
||||||
|
|
||||||
panelApi ?.forceRefresh(postId)
|
panelApi ?.forceRefresh(postId)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -139,6 +143,7 @@ object Plugin : Plugin {
|
|||||||
|
|
||||||
if (config.autoAttach) {
|
if (config.autoAttach) {
|
||||||
postsRepo.newObjectsFlow.subscribeSafelyWithoutExceptions(this) {
|
postsRepo.newObjectsFlow.subscribeSafelyWithoutExceptions(this) {
|
||||||
|
delay(500L)
|
||||||
attachPoll(it.id)
|
attachPoll(it.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@ import dev.inmo.plaguposter.common.ShortMessageInfo
|
|||||||
import dev.inmo.tgbotapi.types.ChatId
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
import dev.inmo.tgbotapi.types.PollIdentifier
|
import dev.inmo.tgbotapi.types.PollIdentifier
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.statements.InsertStatement
|
import org.jetbrains.exposed.sql.statements.*
|
||||||
import org.jetbrains.exposed.sql.statements.UpdateStatement
|
|
||||||
|
|
||||||
class ExposedPollsToMessagesInfoRepo(
|
class ExposedPollsToMessagesInfoRepo(
|
||||||
database: Database
|
database: Database
|
||||||
@ -36,14 +35,12 @@ class ExposedPollsToMessagesInfoRepo(
|
|||||||
initTable()
|
initTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun update(k: PollIdentifier, v: ShortMessageInfo, it: UpdateStatement) {
|
override fun update(k: PollIdentifier, v: ShortMessageInfo, it: UpdateBuilder<Int>) {
|
||||||
it[chatIdColumn] = v.chatId.chatId
|
it[chatIdColumn] = v.chatId.chatId
|
||||||
it[messageIdColumn] = v.messageId
|
it[messageIdColumn] = v.messageId
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun insert(k: PollIdentifier, v: ShortMessageInfo, it: InsertStatement<Number>) {
|
override fun insertKey(k: PollIdentifier, v: ShortMessageInfo, it: InsertStatement<Number>) {
|
||||||
it[keyColumn] = k
|
it[keyColumn] = k
|
||||||
it[chatIdColumn] = v.chatId.chatId
|
|
||||||
it[messageIdColumn] = v.messageId
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@ import dev.inmo.micro_utils.repos.exposed.keyvalue.AbstractExposedKeyValueRepo
|
|||||||
import dev.inmo.plaguposter.posts.models.PostId
|
import dev.inmo.plaguposter.posts.models.PostId
|
||||||
import dev.inmo.tgbotapi.types.PollIdentifier
|
import dev.inmo.tgbotapi.types.PollIdentifier
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.statements.InsertStatement
|
import org.jetbrains.exposed.sql.statements.*
|
||||||
import org.jetbrains.exposed.sql.statements.UpdateStatement
|
|
||||||
|
|
||||||
class ExposedPollsToPostsIdsRepo(
|
class ExposedPollsToPostsIdsRepo(
|
||||||
database: Database
|
database: Database
|
||||||
@ -24,12 +23,11 @@ class ExposedPollsToPostsIdsRepo(
|
|||||||
initTable()
|
initTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun update(k: PollIdentifier, v: PostId, it: UpdateStatement) {
|
override fun update(k: PollIdentifier, v: PostId, it: UpdateBuilder<Int>) {
|
||||||
it[postIdColumn] = v.string
|
it[postIdColumn] = v.string
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun insert(k: PollIdentifier, v: PostId, it: InsertStatement<Number>) {
|
override fun insertKey(k: PollIdentifier, v: PostId, it: InsertStatement<Number>) {
|
||||||
it[keyColumn] = k
|
it[keyColumn] = k
|
||||||
it[postIdColumn] = v.string
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@ import dev.inmo.plaguposter.posts.models.PostId
|
|||||||
import dev.inmo.plaguposter.ratings.models.Rating
|
import dev.inmo.plaguposter.ratings.models.Rating
|
||||||
import dev.inmo.plaguposter.ratings.repo.RatingsRepo
|
import dev.inmo.plaguposter.ratings.repo.RatingsRepo
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.statements.InsertStatement
|
import org.jetbrains.exposed.sql.statements.*
|
||||||
import org.jetbrains.exposed.sql.statements.UpdateStatement
|
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
class ExposedRatingsRepo (
|
class ExposedRatingsRepo (
|
||||||
@ -25,13 +24,12 @@ class ExposedRatingsRepo (
|
|||||||
override val ResultRow.asObject: Rating
|
override val ResultRow.asObject: Rating
|
||||||
get() = get(ratingsColumn).let(::Rating)
|
get() = get(ratingsColumn).let(::Rating)
|
||||||
|
|
||||||
override fun update(k: PostId, v: Rating, it: UpdateStatement) {
|
override fun update(k: PostId, v: Rating, it: UpdateBuilder<Int>) {
|
||||||
it[ratingsColumn] = v.double
|
it[ratingsColumn] = v.double
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun insert(k: PostId, v: Rating, it: InsertStatement<Number>) {
|
override fun insertKey(k: PostId, v: Rating, it: InsertStatement<Number>) {
|
||||||
it[keyColumn] = k.string
|
it[keyColumn] = k.string
|
||||||
it[ratingsColumn] = v.double
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Query.optionallyLimit(limit: Int?) = if (limit == null) {
|
private fun Query.optionallyLimit(limit: Int?) = if (limit == null) {
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
},
|
},
|
||||||
"botToken": "1234567890:ABCDEFGHIJKLMNOP_qrstuvwxyz12345678",
|
"botToken": "1234567890:ABCDEFGHIJKLMNOP_qrstuvwxyz12345678",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
"dev.inmo.plagubot.plugins.inline.queries.Plugin",
|
||||||
"dev.inmo.plaguposter.posts.Plugin",
|
"dev.inmo.plaguposter.posts.Plugin",
|
||||||
"dev.inmo.plaguposter.posts.registrar.Plugin",
|
"dev.inmo.plaguposter.posts.registrar.Plugin",
|
||||||
"dev.inmo.plaguposter.ratings.Plugin",
|
"dev.inmo.plaguposter.ratings.Plugin",
|
||||||
"dev.inmo.plaguposter.ratings.source.Plugin",
|
"dev.inmo.plaguposter.ratings.source.Plugin",
|
||||||
"dev.inmo.plaguposter.ratings.selector.Plugin",
|
"dev.inmo.plaguposter.ratings.selector.Plugin",
|
||||||
"dev.inmo.plaguposter.triggers.selector_with_timer.Plugin",
|
"dev.inmo.plaguposter.triggers.selector_with_timer.Plugin",
|
||||||
"dev.inmo.plaguposter.inlines.Plugin",
|
|
||||||
"dev.inmo.plaguposter.triggers.command.Plugin",
|
"dev.inmo.plaguposter.triggers.command.Plugin",
|
||||||
"dev.inmo.plaguposter.posts.panel.Plugin"
|
"dev.inmo.plaguposter.posts.panel.Plugin"
|
||||||
],
|
],
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
"dev.inmo.plaguposter.ratings.selector.Plugin",
|
"dev.inmo.plaguposter.ratings.selector.Plugin",
|
||||||
"dev.inmo.plaguposter.triggers.selector_with_timer.Plugin",
|
"dev.inmo.plaguposter.triggers.selector_with_timer.Plugin",
|
||||||
"dev.inmo.plaguposter.ratings.gc.Plugin",
|
"dev.inmo.plaguposter.ratings.gc.Plugin",
|
||||||
"dev.inmo.plaguposter.inlines.Plugin",
|
"dev.inmo.plagubot.plugins.inline.queries.Plugin",
|
||||||
"dev.inmo.plaguposter.triggers.command.Plugin"
|
"dev.inmo.plaguposter.triggers.command.Plugin"
|
||||||
],
|
],
|
||||||
"posts": {
|
"posts": {
|
||||||
|
@ -11,6 +11,7 @@ String[] includes = [
|
|||||||
":ratings:gc",
|
":ratings:gc",
|
||||||
":triggers:command",
|
":triggers:command",
|
||||||
":triggers:selector_with_timer",
|
":triggers:selector_with_timer",
|
||||||
|
":triggers:selector_with_scheduling",
|
||||||
":inlines",
|
":inlines",
|
||||||
// ":settings",
|
// ":settings",
|
||||||
":runner"
|
":runner"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -13,9 +12,5 @@ kotlin {
|
|||||||
api project(":plaguposter.common")
|
api project(":plaguposter.common")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -16,9 +15,5 @@ kotlin {
|
|||||||
api project(":plaguposter.posts.panel")
|
api project(":plaguposter.posts.panel")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@ import dev.inmo.micro_utils.pagination.firstPageWithOneElementPagination
|
|||||||
import dev.inmo.plagubot.Plugin
|
import dev.inmo.plagubot.Plugin
|
||||||
import dev.inmo.plaguposter.common.SuccessfulSymbol
|
import dev.inmo.plaguposter.common.SuccessfulSymbol
|
||||||
import dev.inmo.plaguposter.common.UnsuccessfulSymbol
|
import dev.inmo.plaguposter.common.UnsuccessfulSymbol
|
||||||
import dev.inmo.plaguposter.inlines.models.Format
|
import dev.inmo.plagubot.plugins.inline.queries.models.Format
|
||||||
import dev.inmo.plaguposter.inlines.models.OfferTemplate
|
import dev.inmo.plagubot.plugins.inline.queries.models.OfferTemplate
|
||||||
import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo
|
import dev.inmo.plagubot.plugins.inline.queries.repos.InlineTemplatesRepo
|
||||||
import dev.inmo.plaguposter.posts.models.PostId
|
import dev.inmo.plaguposter.posts.models.PostId
|
||||||
import dev.inmo.plaguposter.posts.panel.PanelButtonBuilder
|
import dev.inmo.plaguposter.posts.panel.PanelButtonBuilder
|
||||||
import dev.inmo.plaguposter.posts.panel.PanelButtonsAPI
|
import dev.inmo.plaguposter.posts.panel.PanelButtonsAPI
|
||||||
|
16
triggers/selector_with_scheduling/build.gradle
Normal file
16
triggers/selector_with_scheduling/build.gradle
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
plugins {
|
||||||
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
api project(":plaguposter.common")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
package dev.inmo.plaguposter.triggers.selector_with_scheduling
|
@ -0,0 +1,11 @@
|
|||||||
|
package dev.inmo.plaguposter.triggers.selector_with_scheduling
|
||||||
|
|
||||||
|
import dev.inmo.plagubot.Plugin
|
||||||
|
import kotlinx.serialization.json.*
|
||||||
|
import org.jetbrains.exposed.sql.Database
|
||||||
|
import org.koin.core.module.Module
|
||||||
|
|
||||||
|
object Plugin : Plugin {
|
||||||
|
override fun Module.setupDI(database: Database, params: JsonObject) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
<manifest package="dev.inmo.plaguposter.triggers.selector_with_scheduling"/>
|
@ -1,7 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "com.android.library"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
@ -16,9 +16,5 @@ kotlin {
|
|||||||
api libs.krontab
|
api libs.krontab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user