mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-07-01 04:47:24 +00:00
Compare commits
71 Commits
Author | SHA1 | Date | |
---|---|---|---|
24219df63b
|
|||
14e9c4d686 | |||
8e83f714a7 | |||
939aed5850 | |||
a839cc63e6 | |||
8be3f770bf | |||
b1e7643b09
|
|||
4537e08107
|
|||
3ea1eec2dd
|
|||
fe9978dbe8 | |||
aece8221f1 | |||
4c9256f82f | |||
3f2e4e2d1f | |||
3810224667 | |||
3241bd2da9 | |||
dcac53fe65 | |||
0bc77ada5f | |||
f0b45568d1 | |||
a3dd9d4114 | |||
3afe3b52ed | |||
bdf75f1046 | |||
e834d4c7c7 | |||
2e1fae87b3 | |||
191bef5d68 | |||
55c435c4c0 | |||
758e0a9f16 | |||
5814817f3a | |||
2641901240 | |||
0070b400bb | |||
73e20ab737 | |||
03d24fbfe3 | |||
53e47353e8 | |||
81a97ee8e3 | |||
dbcbc88e1b | |||
f233a25323 | |||
2c91884db8 | |||
6b92b7e377
|
|||
375b815659
|
|||
f26d642320
|
|||
2db0b78962
|
|||
8b76a9aa9b
|
|||
bbc3288535 | |||
45ad734c7b | |||
1eaed8ce6f | |||
a624fcd37d | |||
59aa83c93e | |||
3ea0f4eacb
|
|||
d3e18d80ca
|
|||
1e0eebbd7e
|
|||
6f3c1ec592 | |||
c013dafdd7 | |||
e0bfd8796c | |||
67d561c0ab | |||
63687da0bb
|
|||
cd76249c33 | |||
5a8afd1549 | |||
651569dc8f | |||
bf2ea9a367
|
|||
540fe84f26
|
|||
712378b3ff
|
|||
961382fb56
|
|||
34d9ece6d7
|
|||
30a2cb34d5
|
|||
c94e0476b5
|
|||
6e5cd07c51
|
|||
d4b1438b0b
|
|||
90110335f5
|
|||
9c32d26c0d
|
|||
dfab6b14bd
|
|||
437cee499a
|
|||
4c30a1ac68
|
33
.github/dependabot.yml
vendored
Normal file
33
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
|
||||||
|
- package-ecosystem: "gradle"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# - package-ecosystem: "gradle"
|
||||||
|
# directory: "/scalabot-app"
|
||||||
|
# schedule:
|
||||||
|
# interval: "weekly"
|
||||||
|
# - package-ecosystem: "gradle"
|
||||||
|
# directory: "/scalabot-meta"
|
||||||
|
# schedule:
|
||||||
|
# interval: "weekly"
|
||||||
|
# - package-ecosystem: "gradle"
|
||||||
|
# directory: "/scalabot-extension"
|
||||||
|
# schedule:
|
||||||
|
# interval: "weekly"
|
||||||
|
# - package-ecosystem: "gradle"
|
||||||
|
# directory: "/scalabot-ext-example"
|
||||||
|
# schedule:
|
||||||
|
# interval: "weekly"
|
36
.github/workflows/binary-compatibility-verification.yml
vendored
Normal file
36
.github/workflows/binary-compatibility-verification.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Binary compatibility verification (for API)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'scalabot-meta/**'
|
||||||
|
- 'scalabot-extension/**'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'scalabot-meta/**'
|
||||||
|
- 'scalabot-extension/**'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
apiCompatibilityCheck:
|
||||||
|
timeout-minutes: 8
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'adopt-hotspot'
|
||||||
|
cache: 'gradle'
|
||||||
|
- uses: gradle/wrapper-validation-action@v1
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Build and run binary compatibility verification
|
||||||
|
uses: gradle/gradle-build-action@v2.7.0
|
||||||
|
with:
|
||||||
|
gradle-version: 'wrapper'
|
||||||
|
arguments: apiCheck
|
2
.github/workflows/build-and-test.yml
vendored
2
.github/workflows/build-and-test.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
uses: gradle/gradle-build-action@v2.7.0
|
||||||
with:
|
with:
|
||||||
gradle-version: 'wrapper'
|
gradle-version: 'wrapper'
|
||||||
arguments: test
|
arguments: test
|
||||||
|
6
.github/workflows/create-release.yml
vendored
6
.github/workflows/create-release.yml
vendored
@ -14,7 +14,7 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
create-release:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ jobs:
|
|||||||
# 创建更新日志.
|
# 创建更新日志.
|
||||||
- name: 'Get Previous tag'
|
- name: 'Get Previous tag'
|
||||||
id: previous-tag
|
id: previous-tag
|
||||||
uses: younited/get-previous-tag-action@v1.0.0
|
uses: younited/get-previous-tag-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
match: "v*.*.*"
|
match: "v*.*.*"
|
||||||
- name: Set up Python 3
|
- name: Set up Python 3
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
uses: gradle/gradle-build-action@v2.7.0
|
||||||
with:
|
with:
|
||||||
gradle-version: 'wrapper'
|
gradle-version: 'wrapper'
|
||||||
arguments: clean test assembleDist
|
arguments: clean test assembleDist
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: Release container image
|
name: Publish artifacts
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@ -9,7 +9,7 @@ env:
|
|||||||
IMAGE_NAME: lamgc/scalabot
|
IMAGE_NAME: lamgc/scalabot
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-image:
|
publish-container-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ jobs:
|
|||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
uses: gradle/gradle-build-action@v2.7.0
|
||||||
with:
|
with:
|
||||||
gradle-version: 'wrapper'
|
gradle-version: 'wrapper'
|
||||||
arguments: clean test installDist
|
arguments: clean test installDist
|
||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Build and push container image
|
- name: Build and push container image
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
@ -25,7 +25,7 @@ jobs:
|
|||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
- name: Build project and install Distribution package
|
- name: Build project and install Distribution package
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
uses: gradle/gradle-build-action@v2.7.0
|
||||||
with:
|
with:
|
||||||
gradle-version: 'wrapper'
|
gradle-version: 'wrapper'
|
||||||
arguments: installDist
|
arguments: installDist
|
||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Build and push container image
|
- name: Build and push container image
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.7.10" apply false
|
kotlin("jvm") version "1.8.21" apply false
|
||||||
id("org.jetbrains.kotlinx.kover") version "0.5.1" apply false
|
id("org.jetbrains.kotlinx.kover") version "0.7.3" apply false
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@ -12,5 +13,5 @@ allprojects {
|
|||||||
|
|
||||||
}
|
}
|
||||||
group = "net.lamgc"
|
group = "net.lamgc"
|
||||||
version = "0.5.1"
|
version = "0.6.1"
|
||||||
}
|
}
|
@ -10,9 +10,9 @@ dependencies {
|
|||||||
implementation(project(":scalabot-meta"))
|
implementation(project(":scalabot-meta"))
|
||||||
implementation(project(":scalabot-extension"))
|
implementation(project(":scalabot-extension"))
|
||||||
|
|
||||||
implementation("org.slf4j:slf4j-api:1.7.36")
|
implementation("org.slf4j:slf4j-api:2.0.7")
|
||||||
implementation("io.github.microutils:kotlin-logging:2.1.23")
|
implementation("io.github.microutils:kotlin-logging:3.0.5")
|
||||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
implementation("ch.qos.logback:logback-classic:1.4.8")
|
||||||
|
|
||||||
val aetherVersion = "1.1.0"
|
val aetherVersion = "1.1.0"
|
||||||
implementation("org.eclipse.aether:aether-api:$aetherVersion")
|
implementation("org.eclipse.aether:aether-api:$aetherVersion")
|
||||||
@ -23,20 +23,20 @@ dependencies {
|
|||||||
implementation("org.eclipse.aether:aether-connector-basic:$aetherVersion")
|
implementation("org.eclipse.aether:aether-connector-basic:$aetherVersion")
|
||||||
implementation("org.apache.maven:maven-aether-provider:3.3.9")
|
implementation("org.apache.maven:maven-aether-provider:3.3.9")
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.0")
|
||||||
implementation("com.google.code.gson:gson:2.9.0")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
|
||||||
implementation("org.jdom:jdom2:2.0.6.1")
|
implementation("org.jdom:jdom2:2.0.6.1")
|
||||||
|
|
||||||
implementation("org.telegram:telegrambots-abilities:6.1.0")
|
implementation("org.telegram:telegrambots-abilities:6.7.0")
|
||||||
implementation("org.telegram:telegrambots:6.1.0")
|
implementation("org.telegram:telegrambots:6.7.0")
|
||||||
|
|
||||||
implementation("io.prometheus:simpleclient:0.15.0")
|
implementation("io.prometheus:simpleclient:0.16.0")
|
||||||
implementation("io.prometheus:simpleclient_httpserver:0.15.0")
|
implementation("io.prometheus:simpleclient_httpserver:0.16.0")
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
testImplementation("io.mockk:mockk:1.12.4")
|
testImplementation("io.mockk:mockk:1.13.5")
|
||||||
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")
|
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import org.eclipse.aether.repository.Authentication
|
|||||||
import org.eclipse.aether.repository.Proxy
|
import org.eclipse.aether.repository.Proxy
|
||||||
import org.eclipse.aether.repository.RemoteRepository
|
import org.eclipse.aether.repository.RemoteRepository
|
||||||
import org.eclipse.aether.repository.RepositoryPolicy
|
import org.eclipse.aether.repository.RepositoryPolicy
|
||||||
|
import org.slf4j.event.Level
|
||||||
import org.telegram.telegrambots.bots.DefaultBotOptions
|
import org.telegram.telegrambots.bots.DefaultBotOptions
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
@ -47,6 +48,10 @@ internal fun MavenRepositoryConfig.toRemoteRepository(proxyConfig: ProxyConfig?
|
|||||||
val generatedRepoId = createDefaultRepositoryId()
|
val generatedRepoId = createDefaultRepositoryId()
|
||||||
log.debug { "仓库 Url `$url` 未设置仓库 Id, 已分配缺省 Id: $generatedRepoId" }
|
log.debug { "仓库 Url `$url` 未设置仓库 Id, 已分配缺省 Id: $generatedRepoId" }
|
||||||
generatedRepoId
|
generatedRepoId
|
||||||
|
} else if ("local".contentEquals(id, ignoreCase = true)) {
|
||||||
|
val generatedRepoId = createDefaultRepositoryId()
|
||||||
|
log.debug { "仓库 Url `$url` 不允许使用 `local` 作为仓库 Id, 已分配缺省 Id: $generatedRepoId" }
|
||||||
|
generatedRepoId
|
||||||
} else {
|
} else {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
@ -248,8 +253,37 @@ internal class LogDirectorySupplier : PropertyDefinerBase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class LogLevelSupplier : PropertyDefinerBase() {
|
||||||
|
override fun getPropertyValue(): String {
|
||||||
|
val property = System.getProperty("scalabot.log.level", System.getenv("BOT_LOG_LEVEL"))
|
||||||
|
val level = if (property != null) {
|
||||||
|
try {
|
||||||
|
Level.valueOf(property.uppercase())
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
addWarn("Invalid log level: `$property`, the log will be output using the Info log level.")
|
||||||
|
Level.INFO
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Level.INFO
|
||||||
|
}
|
||||||
|
return level.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class NetworkVerboseLogSupplier : PropertyDefinerBase() {
|
||||||
|
override fun getPropertyValue(): String {
|
||||||
|
val propertyValue = System.getProperty("scalabot.log.network.verbose", "false")
|
||||||
|
return if (propertyValue.toBoolean()) {
|
||||||
|
"DEBUG"
|
||||||
|
} else {
|
||||||
|
"INFO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal object Const {
|
internal object Const {
|
||||||
val config = loadAppConfig()
|
val config = loadAppConfig()
|
||||||
|
const val METRICS_NAMESPACE = "scalabot"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun AppPaths.defaultInitializer() {
|
private fun AppPaths.defaultInitializer() {
|
||||||
|
@ -26,6 +26,7 @@ private val log = KotlinLogging.logger { }
|
|||||||
fun main(args: Array<String>): Unit = runBlocking {
|
fun main(args: Array<String>): Unit = runBlocking {
|
||||||
log.info { "ScalaBot 正在启动中..." }
|
log.info { "ScalaBot 正在启动中..." }
|
||||||
log.info { "数据目录: ${AppPaths.DATA_ROOT}" }
|
log.info { "数据目录: ${AppPaths.DATA_ROOT}" }
|
||||||
|
log.debug { "Kotlin: ${KotlinVersion.CURRENT}, JVM: ${Runtime.version()}" }
|
||||||
log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" }
|
log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" }
|
||||||
if (initialFiles()) {
|
if (initialFiles()) {
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
@ -61,7 +62,10 @@ internal fun startMetricsServer(config: MetricsConfig = Const.config.metrics): H
|
|||||||
return httpServer
|
return httpServer
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Launcher(private val config: AppConfig = Const.config) : AutoCloseable {
|
internal class Launcher(
|
||||||
|
private val config: AppConfig = Const.config,
|
||||||
|
private val configFile: File = AppPaths.CONFIG_APPLICATION.file,
|
||||||
|
) : AutoCloseable {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -75,27 +79,25 @@ internal class Launcher(private val config: AppConfig = Const.config) : AutoClos
|
|||||||
private fun getMavenLocalRepository(): LocalRepository {
|
private fun getMavenLocalRepository(): LocalRepository {
|
||||||
val localPath =
|
val localPath =
|
||||||
if (config.mavenLocalRepository != null && config.mavenLocalRepository!!.isNotEmpty()) {
|
if (config.mavenLocalRepository != null && config.mavenLocalRepository!!.isNotEmpty()) {
|
||||||
val repoPath = AppPaths.DATA_ROOT.file.toPath()
|
val repoPath = configFile.toPath().resolve(config.mavenLocalRepository!!).apply {
|
||||||
.resolve(config.mavenLocalRepository!!)
|
if (!exists()) {
|
||||||
.apply {
|
if (!parent.isWritable() || !parent.isReadable()) {
|
||||||
if (!exists()) {
|
throw IOException("Unable to read and write the directory where Maven repository is located.")
|
||||||
if (!parent.isWritable() || !parent.isReadable()) {
|
}
|
||||||
throw IOException("Unable to read and write the directory where Maven repository is located.")
|
if (System.getProperty("os.name").lowercase().startsWith("windows")) {
|
||||||
}
|
createDirectories()
|
||||||
if (System.getProperty("os.name").lowercase().startsWith("windows")) {
|
} else {
|
||||||
createDirectories()
|
val fileAttributes = setOf(
|
||||||
} else {
|
PosixFilePermission.OWNER_READ,
|
||||||
val fileAttributes = setOf(
|
PosixFilePermission.OWNER_WRITE,
|
||||||
PosixFilePermission.OWNER_READ,
|
PosixFilePermission.GROUP_READ,
|
||||||
PosixFilePermission.OWNER_WRITE,
|
PosixFilePermission.GROUP_WRITE,
|
||||||
PosixFilePermission.GROUP_READ,
|
PosixFilePermission.OTHERS_READ,
|
||||||
PosixFilePermission.GROUP_WRITE,
|
)
|
||||||
PosixFilePermission.OTHERS_READ,
|
createDirectories(PosixFilePermissions.asFileAttribute(fileAttributes))
|
||||||
)
|
|
||||||
createDirectories(PosixFilePermissions.asFileAttribute(fileAttributes))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.toRealPath()
|
.toRealPath()
|
||||||
.toFile()
|
.toFile()
|
||||||
repoPath
|
repoPath
|
||||||
|
@ -50,6 +50,8 @@ internal class ScalaBot(
|
|||||||
extensionFinders = extensionFinders
|
extensionFinders = extensionFinders
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val accountIdString = accountId.toString()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
log.info { "[Bot $botUsername] 正在加载扩展..." }
|
log.info { "[Bot $botUsername] 正在加载扩展..." }
|
||||||
val extensionEntries = extensionLoader.getExtensions()
|
val extensionEntries = extensionLoader.getExtensions()
|
||||||
@ -66,18 +68,18 @@ internal class ScalaBot(
|
|||||||
override fun creatorId(): Long = creatorId
|
override fun creatorId(): Long = creatorId
|
||||||
|
|
||||||
override fun onUpdateReceived(update: Update?) {
|
override fun onUpdateReceived(update: Update?) {
|
||||||
botUpdateCounter.labels(botUsername).inc()
|
botUpdateCounter.labels(botUsername, accountIdString).inc()
|
||||||
botUpdateGauge.labels(botUsername).inc()
|
botUpdateGauge.labels(botUsername, accountIdString).inc()
|
||||||
|
|
||||||
val timer = updateProcessTime.labels(botUsername).startTimer()
|
val timer = updateProcessTime.labels(botUsername, accountIdString).startTimer()
|
||||||
try {
|
try {
|
||||||
super.onUpdateReceived(update)
|
super.onUpdateReceived(update)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
exceptionHandlingCounter.labels(botUsername).inc()
|
exceptionHandlingCounter.labels(botUsername, accountIdString).inc()
|
||||||
throw e
|
throw e
|
||||||
} finally {
|
} finally {
|
||||||
timer.observeDuration()
|
timer.observeDuration()
|
||||||
botUpdateGauge.labels(botUsername).dec()
|
botUpdateGauge.labels(botUsername, accountIdString).dec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +136,8 @@ internal class ScalaBot(
|
|||||||
private val botUpdateCounter = Counter.build()
|
private val botUpdateCounter = Counter.build()
|
||||||
.name("updates_total")
|
.name("updates_total")
|
||||||
.help("Total number of updates received by all bots.")
|
.help("Total number of updates received by all bots.")
|
||||||
.labelNames("bot_name")
|
.labelNames("bot_name", "bot_id")
|
||||||
|
.namespace(Const.METRICS_NAMESPACE)
|
||||||
.subsystem("telegrambots")
|
.subsystem("telegrambots")
|
||||||
.register()
|
.register()
|
||||||
|
|
||||||
@ -142,7 +145,8 @@ internal class ScalaBot(
|
|||||||
private val botUpdateGauge = Gauge.build()
|
private val botUpdateGauge = Gauge.build()
|
||||||
.name("updates_in_progress")
|
.name("updates_in_progress")
|
||||||
.help("Number of updates in process by all bots.")
|
.help("Number of updates in process by all bots.")
|
||||||
.labelNames("bot_name")
|
.labelNames("bot_name", "bot_id")
|
||||||
|
.namespace(Const.METRICS_NAMESPACE)
|
||||||
.subsystem("telegrambots")
|
.subsystem("telegrambots")
|
||||||
.register()
|
.register()
|
||||||
|
|
||||||
@ -150,6 +154,7 @@ internal class ScalaBot(
|
|||||||
private val onlineBotGauge = Gauge.build()
|
private val onlineBotGauge = Gauge.build()
|
||||||
.name("bots_online")
|
.name("bots_online")
|
||||||
.help("Number of bots Online.")
|
.help("Number of bots Online.")
|
||||||
|
.namespace(Const.METRICS_NAMESPACE)
|
||||||
.subsystem("telegrambots")
|
.subsystem("telegrambots")
|
||||||
.register()
|
.register()
|
||||||
|
|
||||||
@ -161,7 +166,8 @@ internal class ScalaBot(
|
|||||||
"so it may be different from the actual execution time of ability. " +
|
"so it may be different from the actual execution time of ability. " +
|
||||||
"It is not recommended to use it as the accurate execution time of ability)"
|
"It is not recommended to use it as the accurate execution time of ability)"
|
||||||
)
|
)
|
||||||
.labelNames("bot_name")
|
.labelNames("bot_name", "bot_id")
|
||||||
|
.namespace(Const.METRICS_NAMESPACE)
|
||||||
.subsystem("telegrambots")
|
.subsystem("telegrambots")
|
||||||
.register()
|
.register()
|
||||||
|
|
||||||
@ -169,7 +175,8 @@ internal class ScalaBot(
|
|||||||
private val exceptionHandlingCounter = Counter.build()
|
private val exceptionHandlingCounter = Counter.build()
|
||||||
.name("updates_exception_handling")
|
.name("updates_exception_handling")
|
||||||
.help("Number of exceptions during processing.")
|
.help("Number of exceptions during processing.")
|
||||||
.labelNames("bot_name")
|
.labelNames("bot_name", "bot_id")
|
||||||
|
.namespace(Const.METRICS_NAMESPACE)
|
||||||
.subsystem("telegrambots")
|
.subsystem("telegrambots")
|
||||||
.register()
|
.register()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<included>
|
<included>
|
||||||
<define name="DATA_LOGS" class="net.lamgc.scalabot.LogDirectorySupplier"/>
|
<define name="DATA_LOGS" class="net.lamgc.scalabot.LogDirectorySupplier"/>
|
||||||
|
<define name="LOG_LEVEL" class="net.lamgc.scalabot.LogLevelSupplier"/>
|
||||||
|
<define name="NETWORK_LOG_LEVEL" class="net.lamgc.scalabot.NetworkVerboseLogSupplier"/>
|
||||||
|
|
||||||
<appender name="STD_OUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STD_OUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<configuration scan="false" debug="false">
|
|
||||||
<include resource="base-logback.xml"/>
|
|
||||||
|
|
||||||
<logger name="org.apache.http" level="INFO"/>
|
|
||||||
<logger name="org.eclipse.aether.internal.impl.DefaultTransporterProvider" level="INFO"/>
|
|
||||||
<logger name="org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider" level="INFO"/>
|
|
||||||
<logger name="org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager" level="INFO"/>
|
|
||||||
<logger name="org.telegram.telegrambots.facilities.proxysocketfactorys" level="INFO"/>
|
|
||||||
<logger name="org.eclipse.aether.internal.impl.DefaultUpdateCheckManager" level="INFO"/>
|
|
||||||
|
|
||||||
<root level="DEBUG">
|
|
||||||
<appender-ref ref="FILE_OUT"/>
|
|
||||||
<appender-ref ref="STD_ERR"/>
|
|
||||||
<appender-ref ref="STD_OUT"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
@ -1,7 +1,14 @@
|
|||||||
<configuration scan="false" debug="false">
|
<configuration scan="false" debug="false">
|
||||||
<include resource="base-logback.xml"/>
|
<include resource="base-logback.xml"/>
|
||||||
|
|
||||||
<root level="INFO">
|
<logger name="org.apache.http" level="${NETWORK_LOG_LEVEL}"/>
|
||||||
|
<logger name="org.eclipse.aether.internal.impl.DefaultTransporterProvider" level="${NETWORK_LOG_LEVEL}"/>
|
||||||
|
<logger name="org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider" level="${NETWORK_LOG_LEVEL}"/>
|
||||||
|
<logger name="org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager" level="${NETWORK_LOG_LEVEL}"/>
|
||||||
|
<logger name="org.telegram.telegrambots.facilities.proxysocketfactorys" level="${NETWORK_LOG_LEVEL}"/>
|
||||||
|
<logger name="org.eclipse.aether.internal.impl.DefaultUpdateCheckManager" level="${NETWORK_LOG_LEVEL}"/>
|
||||||
|
|
||||||
|
<root level="${LOG_LEVEL}">
|
||||||
<appender-ref ref="FILE_OUT"/>
|
<appender-ref ref="FILE_OUT"/>
|
||||||
<appender-ref ref="STD_ERR"/>
|
<appender-ref ref="STD_ERR"/>
|
||||||
<appender-ref ref="STD_OUT"/>
|
<appender-ref ref="STD_OUT"/>
|
||||||
|
@ -5,7 +5,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":scalabot-extension"))
|
compileOnly(project(":scalabot-extension"))
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
scalabot-extension/api/scalabot-extension.api
Normal file
9
scalabot-extension/api/scalabot-extension.api
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
public abstract interface class net/lamgc/scalabot/extension/BotExtensionFactory {
|
||||||
|
public abstract fun createExtensionInstance (Lorg/telegram/abilitybots/api/bot/BaseAbilityBot;Ljava/io/File;)Lorg/telegram/abilitybots/api/util/AbilityExtension;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class net/lamgc/scalabot/extension/util/AbilityBots {
|
||||||
|
public static fun cancelReplyState (Lorg/telegram/abilitybots/api/bot/BaseAbilityBot;J)Z
|
||||||
|
public static fun getBotAccountId (Lorg/telegram/abilitybots/api/bot/BaseAbilityBot;)J
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,17 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
`java-library`
|
||||||
java
|
|
||||||
jacoco
|
jacoco
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.telegram:telegrambots-abilities:6.1.0")
|
implementation("commons-codec:commons-codec:1.16.0")
|
||||||
api("org.slf4j:slf4j-api:1.7.36")
|
api("org.telegram:telegrambots-abilities:6.7.0")
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||||
testImplementation("org.mockito:mockito-core:4.6.1")
|
testImplementation("org.mockito:mockito-core:5.3.1")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,19 +44,21 @@ tasks.withType<AbstractArchiveTask>().configureEach {
|
|||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
if (project.version.toString().endsWith("-SNAPSHOT")) {
|
maven("https://git.lamgc.me/api/packages/LamGC/maven") {
|
||||||
maven("https://nexus.kuku.me/repository/maven-snapshots/") {
|
credentials {
|
||||||
credentials {
|
username = project.properties["repo.credentials.self-git.username"].toString()
|
||||||
username = project.properties["repo.credentials.private.username"].toString()
|
password = project.properties["repo.credentials.self-git.password"].toString()
|
||||||
password = project.properties["repo.credentials.private.password"].toString()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
val kukuRepoUrl = if (project.version.toString().endsWith("-SNAPSHOT", ignoreCase = true)) {
|
||||||
|
"https://nexus.kuku.me/repository/maven-snapshots/"
|
||||||
} else {
|
} else {
|
||||||
maven("https://nexus.kuku.me/repository/maven-releases/") {
|
"https://nexus.kuku.me/repository/maven-releases/"
|
||||||
credentials {
|
}
|
||||||
username = project.properties["repo.credentials.private.username"].toString()
|
maven(kukuRepoUrl) {
|
||||||
password = project.properties["repo.credentials.private.password"].toString()
|
credentials {
|
||||||
}
|
username = project.properties["repo.credentials.kuku-repo.username"].toString()
|
||||||
|
password = project.properties["repo.credentials.kuku-repo.password"].toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,9 @@ public class AbilityBots {
|
|||||||
* @return 返回 AbilityBot 的账户 Id.
|
* @return 返回 AbilityBot 的账户 Id.
|
||||||
* @throws IllegalArgumentException 当 AbilityBot 的 botToken 格式错误时抛出该异常.
|
* @throws IllegalArgumentException 当 AbilityBot 的 botToken 格式错误时抛出该异常.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static long getBotAccountId(BaseAbilityBot bot) {
|
public static long getBotAccountId(BaseAbilityBot bot) {
|
||||||
|
// 根据文档说明, 弃用仅针对重写方法, 使用该方法并无大碍.
|
||||||
String botToken = bot.getBotToken();
|
String botToken = bot.getBotToken();
|
||||||
Matcher matcher = botTokenPattern.matcher(botToken);
|
Matcher matcher = botTokenPattern.matcher(botToken);
|
||||||
if (!matcher.matches()) {
|
if (!matcher.matches()) {
|
||||||
|
195
scalabot-meta/api/scalabot-meta.api
Normal file
195
scalabot-meta/api/scalabot-meta.api
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
public final class net/lamgc/scalabot/config/AppConfig {
|
||||||
|
public fun <init> ()V
|
||||||
|
public fun <init> (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;)V
|
||||||
|
public synthetic fun <init> (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public final fun component1 ()Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public final fun component2 ()Lnet/lamgc/scalabot/config/MetricsConfig;
|
||||||
|
public final fun component3 ()Ljava/util/List;
|
||||||
|
public final fun component4 ()Ljava/lang/String;
|
||||||
|
public final fun copy (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;)Lnet/lamgc/scalabot/config/AppConfig;
|
||||||
|
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/AppConfig;Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/AppConfig;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public final fun getMavenLocalRepository ()Ljava/lang/String;
|
||||||
|
public final fun getMavenRepositories ()Ljava/util/List;
|
||||||
|
public final fun getMetrics ()Lnet/lamgc/scalabot/config/MetricsConfig;
|
||||||
|
public final fun getProxy ()Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public fun hashCode ()I
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/BotAccount {
|
||||||
|
public fun <init> (Ljava/lang/String;Ljava/lang/String;J)V
|
||||||
|
public final fun component1 ()Ljava/lang/String;
|
||||||
|
public final fun component2 ()Ljava/lang/String;
|
||||||
|
public final fun component3 ()J
|
||||||
|
public final fun copy (Ljava/lang/String;Ljava/lang/String;J)Lnet/lamgc/scalabot/config/BotAccount;
|
||||||
|
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/BotAccount;Ljava/lang/String;Ljava/lang/String;JILjava/lang/Object;)Lnet/lamgc/scalabot/config/BotAccount;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public final fun getCreatorId ()J
|
||||||
|
public final fun getId ()J
|
||||||
|
public final fun getName ()Ljava/lang/String;
|
||||||
|
public final fun getToken ()Ljava/lang/String;
|
||||||
|
public fun hashCode ()I
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/BotConfig {
|
||||||
|
public fun <init> (ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;)V
|
||||||
|
public synthetic fun <init> (ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public final fun component1 ()Z
|
||||||
|
public final fun component2 ()Lnet/lamgc/scalabot/config/BotAccount;
|
||||||
|
public final fun component3 ()Z
|
||||||
|
public final fun component4 ()Z
|
||||||
|
public final fun component5 ()Ljava/util/Set;
|
||||||
|
public final fun component6 ()Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public final fun component7 ()Ljava/lang/String;
|
||||||
|
public final fun copy (ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;)Lnet/lamgc/scalabot/config/BotConfig;
|
||||||
|
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/BotConfig;ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/BotConfig;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public final fun getAccount ()Lnet/lamgc/scalabot/config/BotAccount;
|
||||||
|
public final fun getAutoUpdateCommandList ()Z
|
||||||
|
public final fun getBaseApiUrl ()Ljava/lang/String;
|
||||||
|
public final fun getDisableBuiltInAbility ()Z
|
||||||
|
public final fun getEnabled ()Z
|
||||||
|
public final fun getExtensions ()Ljava/util/Set;
|
||||||
|
public final fun getProxy ()Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public fun hashCode ()I
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/MavenRepositoryConfig {
|
||||||
|
public fun <init> (Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;)V
|
||||||
|
public synthetic fun <init> (Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public final fun component1 ()Ljava/lang/String;
|
||||||
|
public final fun component2 ()Ljava/net/URL;
|
||||||
|
public final fun component3 ()Lorg/eclipse/aether/repository/Proxy;
|
||||||
|
public final fun component4 ()Ljava/lang/String;
|
||||||
|
public final fun component5 ()Z
|
||||||
|
public final fun component6 ()Z
|
||||||
|
public final fun component7 ()Lorg/eclipse/aether/repository/Authentication;
|
||||||
|
public final fun copy (Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;)Lnet/lamgc/scalabot/config/MavenRepositoryConfig;
|
||||||
|
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/MavenRepositoryConfig;Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/MavenRepositoryConfig;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public final fun getAuthentication ()Lorg/eclipse/aether/repository/Authentication;
|
||||||
|
public final fun getEnableReleases ()Z
|
||||||
|
public final fun getEnableSnapshots ()Z
|
||||||
|
public final fun getId ()Ljava/lang/String;
|
||||||
|
public final fun getLayout ()Ljava/lang/String;
|
||||||
|
public final fun getProxy ()Lorg/eclipse/aether/repository/Proxy;
|
||||||
|
public final fun getUrl ()Ljava/net/URL;
|
||||||
|
public fun hashCode ()I
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/MetricsConfig {
|
||||||
|
public fun <init> ()V
|
||||||
|
public fun <init> (ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;)V
|
||||||
|
public synthetic fun <init> (ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public final fun component1 ()Z
|
||||||
|
public final fun component2 ()I
|
||||||
|
public final fun component3 ()Ljava/lang/String;
|
||||||
|
public final fun component4 ()Lnet/lamgc/scalabot/config/UsernameAuthenticator;
|
||||||
|
public final fun copy (ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;)Lnet/lamgc/scalabot/config/MetricsConfig;
|
||||||
|
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/MetricsConfig;ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/MetricsConfig;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public final fun getAuthenticator ()Lnet/lamgc/scalabot/config/UsernameAuthenticator;
|
||||||
|
public final fun getBindAddress ()Ljava/lang/String;
|
||||||
|
public final fun getEnable ()Z
|
||||||
|
public final fun getPort ()I
|
||||||
|
public fun hashCode ()I
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/ProxyConfig {
|
||||||
|
public fun <init> ()V
|
||||||
|
public fun <init> (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;I)V
|
||||||
|
public synthetic fun <init> (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public final fun component1 ()Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public final fun component2 ()Ljava/lang/String;
|
||||||
|
public final fun component3 ()I
|
||||||
|
public final fun copy (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;I)Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;IILjava/lang/Object;)Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public final fun getHost ()Ljava/lang/String;
|
||||||
|
public final fun getPort ()I
|
||||||
|
public final fun getType ()Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public fun hashCode ()I
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/ProxyType : java/lang/Enum {
|
||||||
|
public static final field HTTP Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public static final field HTTPS Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public static final field NO_PROXY Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public static final field SOCKS4 Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public static final field SOCKS5 Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public static fun valueOf (Ljava/lang/String;)Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public static fun values ()[Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/UsernameAuthenticator : com/sun/net/httpserver/BasicAuthenticator {
|
||||||
|
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
|
||||||
|
public fun checkCredentials (Ljava/lang/String;Ljava/lang/String;)Z
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public fun hashCode ()I
|
||||||
|
public final fun toJsonObject ()Lcom/google/gson/JsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/ArtifactSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/ArtifactSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lorg/eclipse/aether/artifact/Artifact;
|
||||||
|
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
public fun serialize (Lorg/eclipse/aether/artifact/Artifact;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/AuthenticationSerializer : com/google/gson/JsonDeserializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/AuthenticationSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lorg/eclipse/aether/repository/Authentication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/BotAccountSerializer : com/google/gson/JsonDeserializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/BotAccountSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/BotAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/BotConfigSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/BotConfigSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/BotConfig;
|
||||||
|
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
public fun serialize (Lnet/lamgc/scalabot/config/BotConfig;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/MavenRepositoryConfigSerializer : com/google/gson/JsonDeserializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/MavenRepositoryConfigSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/MavenRepositoryConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/ProxyConfigSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/ProxyConfigSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/ProxyConfig;
|
||||||
|
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
public fun serialize (Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/ProxyTypeSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/ProxyTypeSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/ProxyType;
|
||||||
|
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
public fun serialize (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class net/lamgc/scalabot/config/serializer/UsernameAuthenticatorSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
|
||||||
|
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/UsernameAuthenticatorSerializer;
|
||||||
|
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
|
||||||
|
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/UsernameAuthenticator;
|
||||||
|
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
public fun serialize (Lnet/lamgc/scalabot/config/UsernameAuthenticator;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,10 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("org.jetbrains.kotlinx.kover")
|
id("org.jetbrains.kotlinx.kover")
|
||||||
id("org.jetbrains.dokka") version "1.7.0"
|
id("org.jetbrains.dokka") version "1.8.20"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -11,16 +12,16 @@ dependencies {
|
|||||||
api("org.eclipse.aether:aether-api:$aetherVersion")
|
api("org.eclipse.aether:aether-api:$aetherVersion")
|
||||||
implementation("org.eclipse.aether:aether-util:$aetherVersion")
|
implementation("org.eclipse.aether:aether-util:$aetherVersion")
|
||||||
|
|
||||||
implementation("org.telegram:telegrambots-meta:6.1.0")
|
implementation("org.telegram:telegrambots-meta:6.7.0")
|
||||||
|
|
||||||
api("com.google.code.gson:gson:2.9.0")
|
api("com.google.code.gson:gson:2.10.1")
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
testImplementation("io.mockk:mockk:1.12.4")
|
testImplementation("io.mockk:mockk:1.13.5")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.3")
|
||||||
|
|
||||||
dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.7.0")
|
dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.8.20")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
@ -51,19 +52,21 @@ val javadocJar = tasks.named<Jar>("javadocJar") {
|
|||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
if (project.version.toString().endsWith("-SNAPSHOT", ignoreCase = true)) {
|
maven("https://git.lamgc.me/api/packages/LamGC/maven") {
|
||||||
maven("https://nexus.kuku.me/repository/maven-snapshots/") {
|
credentials {
|
||||||
credentials {
|
username = project.properties["repo.credentials.self-git.username"].toString()
|
||||||
username = project.properties["repo.credentials.private.username"].toString()
|
password = project.properties["repo.credentials.self-git.password"].toString()
|
||||||
password = project.properties["repo.credentials.private.password"].toString()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
val kukuRepoUrl = if (project.version.toString().endsWith("-SNAPSHOT", ignoreCase = true)) {
|
||||||
|
"https://nexus.kuku.me/repository/maven-snapshots/"
|
||||||
} else {
|
} else {
|
||||||
maven("https://nexus.kuku.me/repository/maven-releases/") {
|
"https://nexus.kuku.me/repository/maven-releases/"
|
||||||
credentials {
|
}
|
||||||
username = project.properties["repo.credentials.private.username"].toString()
|
maven(kukuRepoUrl) {
|
||||||
password = project.properties["repo.credentials.private.password"].toString()
|
credentials {
|
||||||
}
|
username = project.properties["repo.credentials.kuku-repo.username"].toString()
|
||||||
|
password = project.properties["repo.credentials.kuku-repo.password"].toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user