This commit is contained in:
InsanusMokrassar 2022-04-10 22:14:56 +06:00
parent 00cee9bcec
commit 60ace19f50
10 changed files with 120 additions and 77 deletions

View File

@ -2,6 +2,6 @@
## 0.0.2 ## 0.0.2
* `Kotlin`: `1.4.30` -> `1.4.32` * `Kotlin`: `1.4.30` -> `1.6.10`
* `tgbotapi`: `0.32.5` -> `0.34.0` * `tgbotapi`: `0.32.5` -> `0.38.12`
* `ktor`: `1.5.2` -> `1.5.3` * `ktor`: `1.5.2` -> `1.6.8`

View File

@ -1,4 +1,4 @@
FROM java:8 FROM adoptopenjdk/openjdk11
USER 1000 USER 1000

View File

@ -3,7 +3,6 @@ project.group = "com.insanusmokrassar"
buildscript { buildscript {
repositories { repositories {
mavenLocal() mavenLocal()
jcenter()
mavenCentral() mavenCentral()
} }
@ -28,7 +27,6 @@ project.group = "$library_group"
repositories { repositories {
mavenLocal() mavenLocal()
jcenter()
mavenCentral() mavenCentral()
maven { url "https://kotlin.bintray.com/kotlinx" } maven { url "https://kotlin.bintray.com/kotlinx" }
} }
@ -45,5 +43,5 @@ dependencies {
api "io.ktor:ktor-server-tomcat:$ktor_version" api "io.ktor:ktor-server-tomcat:$ktor_version"
// Use JUnit test framework // Use JUnit test framework
testImplementation 'junit:junit:4.13.1' testImplementation 'junit:junit:4.13.2'
} }

View File

@ -1,4 +1,5 @@
{ {
"botConfig": {
"botToken": "bot token from @BotFather", "botToken": "bot token from @BotFather",
"apiUrl": "(optional) can be used if you are using your bot server", "apiUrl": "(optional) can be used if you are using your bot server",
"clientConfig": { "clientConfig": {
@ -12,4 +13,26 @@
"writeTimeout": "(optional) number, milliseconds", "writeTimeout": "(optional) number, milliseconds",
"readTimeout": "(optional) number, milliseconds" "readTimeout": "(optional) number, milliseconds"
} }
},
"templates": [
{
"title": "Some example",
"formats": [
{
"template": "Some message which will be sent after clicking on option and opportunity to use format options from java with splitting of incoming query by splitBy option",
"regexTemplate": "Some regex, by default it is ^$ which means empty string",
"splitBy": "Optional splitter, by default is null but the most regular case is to use \" \" to split query by spaces",
"enableMarkdownSupport": false,
"enableMarkdownSupport_description": "THAT IS NOT A FIELD. enableMarkdownSupport is a flat to use markdown 2 markup with template"
}
],
"description": "It is optional description of some example format"
}
],
"restrictions": {
"allowedUsers": [
],
"description": "THAT IS NOT A FIELD. allowedUsers is an optional field which contains list of users which may use this bot to call its inline queries"
}
} }

View File

@ -1,7 +1,7 @@
kotlin.code.style=official kotlin.code.style=official
kotlin_version=1.6.10 kotlin_version=1.6.10
telegram_bot_api_version=0.38.10 telegram_bot_api_version=0.38.12
ktor_version=1.6.8 ktor_version=1.6.8
library_version=0.0.2 library_version=0.0.2

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip

View File

@ -1,15 +1,25 @@
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing'
task javadocsJar(type: Jar) { task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc' classifier = 'javadoc'
} }
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
publishing { publishing {
publications.all { publications {
artifact javadocsJar maven(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar
pom { pom {
resolveStrategy = Closure.DELEGATE_FIRST
description = "This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API" description = "This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API"
name = "${project.name}" name = "${project.name}"
url = "https://insanusmokrassar.github.io/${project.name}" url = "https://insanusmokrassar.github.io/${project.name}"
@ -62,8 +72,20 @@ publishing {
} }
} }
} }
}
if (project.hasProperty("signing.gnupg.keyName")) {
apply plugin: 'signing'
signing { signing {
useGpgCmd() useGpgCmd()
sign publishing.publications sign publishing.publications
} }
task signAll {
tasks.withType(Sign).forEach {
dependsOn(it)
}
}
}

View File

@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/InsanusMokrassar/${project.name}","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} {"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/InsanusMokrassar/${project.name}","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JVM"}

View File

@ -54,8 +54,8 @@ data class FormatterBot(
val bot = botConfig.createBot() val bot = botConfig.createBot()
val filter = FlowsUpdatesFilter() val filter = FlowsUpdatesFilter()
bot.buildBehaviour( bot.buildBehaviour(
filter,
scope, scope,
filter
) { ) {
enableFormatterBot(templates, restrictions) enableFormatterBot(templates, restrictions)
} }

View File

@ -1,7 +1,7 @@
package dev.inmo.configurable_inline_telegram_bot.config package dev.inmo.configurable_inline_telegram_bot.config
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable