Compare commits

..

138 Commits
v0.5.2 ... main

Author SHA1 Message Date
dependabot[bot]
d160fa7ee5
build(deps): bump org.jetbrains.dokka:javadoc-plugin (#187)
Bumps [org.jetbrains.dokka:javadoc-plugin](https://github.com/Kotlin/dokka) from 1.9.10 to 2.0.0.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.9.10...v2.0.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka:javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-29 17:34:24 +08:00
dependabot[bot]
b053388f82
build(deps): bump com.google.code.gson:gson from 2.10.1 to 2.11.0 (#182)
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/gson/compare/gson-parent-2.10.1...gson-parent-2.11.0)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-29 15:58:06 +08:00
818cb21df7
release: 发布 0.8.0-1 版本.
这是 0.8.0 版本的重新发布版本, 由于 0.8.0 版本在构建并发布到 Maven 仓库中出现问题,
为确保本项目的“可重现构建”承诺能正常实施, 因此决定发布 0.8.0-1 版本.
该版本与 0.8.0 版本除了补充缺失的 Javadoc 外并无其他差别, 最终用户依然可以继续使用 0.8.0 版本.
2024-12-11 23:12:02 +08:00
c681ebc4c1
build: 不再使用 kuku-repo 作为发布仓库.
Some checks failed
Binary compatibility verification (for API) / apiCompatibilityCheck (push) Has been cancelled
Build and test project / build (push) Has been cancelled
Build development version container image / build (push) Has been cancelled
2024-12-11 09:47:22 +08:00
44b7b5122f
docs(extension): 补充部分缺失的 Javadoc 文档. 2024-12-11 09:46:15 +08:00
bf4adc8437
release: 发布 0.8.0 版本. 2024-12-11 09:34:32 +08:00
dependabot[bot]
47d34b0fd8
build(deps): bump docker/build-push-action from 5 to 6 (#163)
Some checks are pending
Binary compatibility verification (for API) / apiCompatibilityCheck (push) Waiting to run
Build and test project / build (push) Waiting to run
Build development version container image / build (push) Waiting to run
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-11 00:56:54 +08:00
dependabot[bot]
14098d285c
build(deps): bump io.mockk:mockk from 1.13.9 to 1.13.13 (#176)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.9 to 1.13.13.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/1.13.9...1.13.13)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-11 00:54:30 +08:00
dependabot[bot]
ad359935d6
build(deps): bump org.jetbrains.kotlinx:kotlinx-coroutines-core (#174)
Bumps [org.jetbrains.kotlinx:kotlinx-coroutines-core](https://github.com/Kotlin/kotlinx.coroutines) from 1.7.3 to 1.9.0.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.7.3...1.9.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-11 00:51:46 +08:00
3e1bf4991d
build(deps): 将 Kotlin 更新至 2.1.0 版本. 2024-12-11 00:47:57 +08:00
bd7f556c31
build(gradle): 将 Gradle 更新至 8.11.1 版本. 2024-12-11 00:14:18 +08:00
dependabot[bot]
9c069adc4b
build(deps): bump ch.qos.logback:logback-classic from 1.4.14 to 1.5.12 (#179)
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.14 to 1.5.12.
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.14...v_1.5.12)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-10 23:54:58 +08:00
dependabot[bot]
96a06c48ee
build(deps): bump org.jetbrains.kotlinx.kover from 0.7.5 to 0.8.3 (#167)
Bumps [org.jetbrains.kotlinx.kover](https://github.com/Kotlin/kotlinx-kover) from 0.7.5 to 0.8.3.
- [Release notes](https://github.com/Kotlin/kotlinx-kover/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-kover/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-kover/compare/v0.7.5...v0.8.3)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.kover
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-10 23:50:00 +08:00
ca4bfee03e
build(github-action): 将所有 Github Action 所使用的 Java 版本升级至 17. 2024-12-10 23:42:50 +08:00
16dc98fa85
Merge branch 'main' of github.com:LamGC/ScalaBot 2024-12-10 23:36:29 +08:00
8299316af8
refactor(extension): 使用 URI 而不是 URL 来排除重复项, 以避免潜在的 URL hashCode 问题. 2024-12-10 23:35:12 +08:00
e1c87aeae4
feat: 将 TelegramBots 升级至 8.0.0, 并适配 TelegramBots 的新改动.
将 TelegramBots 升级至新版本, 以支持新的 API.
由于 TelegramBots 发生无法兼容旧版本的重大变更, 因此 ScalaBot 将随着此次更新一同进行重大更改.

BREAKING CHANGE: ScalaBot 所依赖的 TelegramBots 发生重大更改, 所有扩展都需要进行适配.
  有关 TelegramBots 的重大变更说明请参考官方文档.
  ScalaBot 的最低 Java 版本已全部升级至 Java 17 (这是 TelegramBots 的最低兼容性要求), 所有扩展都应该至少迁移至 Java 17 版本.
  ScalaBot 的重大更改:
   - scalabot-extension
     - `net.lamgc.scalabot.extension.util.AbilityBots.getBotAccountId(BaseAbilityBot): long` 已被移除, 由于 BaseAbilityBot 不再允许获取 botToken, 因此该方法被移除. 作为代替, 请通过 `net.lamgc.scalabot.extension.BotExtensionFactory.createExtensionInstance` 所得到的 `BotExtensionCreateOptions` 中获取 botAccountId.

  另外, scalabot-extension 中的 `org.jetbrains.kotlinx.binary-compatibility-validator` 似乎不再对 Java 代码起作用, 因此移除该插件, 并在后续寻找替代品.
  TelegramBots 文档: https://rubenlagus.github.io/TelegramBotsDocumentation/how-to-update-7.html
2024-12-10 23:32:29 +08:00
dependabot[bot]
232e318522
build(deps): bump org.jetbrains.dokka from 1.9.10 to 1.9.20 (#147)
Some checks failed
Binary compatibility verification (for API) / apiCompatibilityCheck (push) Has been cancelled
Build and test project / build (push) Has been cancelled
Build development version container image / build (push) Has been cancelled
Bumps [org.jetbrains.dokka](https://github.com/Kotlin/dokka) from 1.9.10 to 1.9.20.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.9.10...v1.9.20)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-07 01:09:11 +08:00
bac7239513
build(action): 将 Gradle 相关 Action 迁移到官方推荐的新版本. 2024-08-30 09:00:48 +08:00
cc7ef37539
build(action): 移除 gradle/actions/wrapper-validation 并将 gradle/actions/setup-gradle 升级至 v4 版本. 2024-08-30 08:52:40 +08:00
4cf670a4d0
build(action): 将 gradle/gradle-build-action@v3.1.0 迁移至 gradle/actions/setup-gradle@v3 2024-08-30 08:45:35 +08:00
dependabot[bot]
d6781dbc71
build(deps): bump gradle/gradle-build-action from 3.1.0 to 3.4.2 (#164)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 3.1.0 to 3.4.2.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v3.1.0...v3.4.2)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-21 14:10:40 +08:00
63f68acccd
build(action): 将 gradle/wrapper-validation-action@v2 迁移至 gradle/actions/wrapper-validation@v3 2024-05-15 08:50:32 +08:00
506f073bf6
release: 发布 0.7.0 版本. 2024-05-15 08:32:34 +08:00
9dc4bfa28f
feat: 为 BotExtensionFactory 提供一些可用的信息. (#125)
为 BotExtensionFactory 的 createExtensionInstance 方法添加 BotExtensionCreateOptions 参数,
通过 BotExtensionCreateOptions 为扩展包 Factory 提供更多信息, 以避免扩展重复声明配置文件.

Issue #4
2024-03-25 23:22:26 +08:00
92a1deac50
build(deps): bump org.telegram:telegrambots-abilities from 6.8.0 to 6.9.7.1 2024-03-25 23:04:24 +08:00
0e2ce68a9c
feat(container): 将容器镜像的 Java 镜像由 OpenJDK:18 更改至 eclipse-temurin:21-jdk-alpine
这将有利于支持通过更高版本 Java 构建的扩展包, 且减少镜像体积.
2024-03-25 22:54:36 +08:00
d57e63f8de
build: 更新 Kotlin 版本由 1.9.22 到 1.9.23
更新 Kotlin 版本以更好的支持新特性.
2024-03-25 22:52:15 +08:00
dependabot[bot]
73653cabc6
build(deps): bump commons-codec:commons-codec from 1.16.0 to 1.16.1 (#144)
Bumps [commons-codec:commons-codec](https://github.com/apache/commons-codec) from 1.16.0 to 1.16.1.
- [Changelog](https://github.com/apache/commons-codec/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-codec/compare/rel/commons-codec-1.16.0...rel/commons-codec-1.16.1)

---
updated-dependencies:
- dependency-name: commons-codec:commons-codec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 22:11:04 +08:00
dependabot[bot]
9e87591671
build(deps): bump org.mockito:mockito-core from 5.9.0 to 5.11.0 (#141)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.9.0 to 5.11.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.9.0...v5.11.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:10:17 +08:00
dependabot[bot]
126092487d
build(deps): bump softprops/action-gh-release from 1 to 2 (#142)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 17:16:18 +08:00
dependabot[bot]
44bc52050c
build(deps): bump gradle/wrapper-validation-action from 1 to 2 (#135)
Bumps [gradle/wrapper-validation-action](https://github.com/gradle/wrapper-validation-action) from 1 to 2.
- [Release notes](https://github.com/gradle/wrapper-validation-action/releases)
- [Commits](https://github.com/gradle/wrapper-validation-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: gradle/wrapper-validation-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 16:26:35 +08:00
dependabot[bot]
f809076df0
build(deps): bump org.jetbrains.kotlinx.binary-compatibility-validator (#134)
Bumps [org.jetbrains.kotlinx.binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) from 0.13.2 to 0.14.0.
- [Release notes](https://github.com/Kotlin/binary-compatibility-validator/releases)
- [Commits](https://github.com/Kotlin/binary-compatibility-validator/compare/0.13.2...0.14.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.binary-compatibility-validator
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 16:21:33 +08:00
dependabot[bot]
b34f05a90b
build(deps): bump gradle/gradle-build-action from 2.11.1 to 3.1.0 (#140)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.11.1 to 3.1.0.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.11.1...v3.1.0)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 16:12:29 +08:00
dependabot[bot]
ddc4de1340
build(deps): bump io.mockk:mockk from 1.13.8 to 1.13.9 (#123)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.8 to 1.13.9.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/commits)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-21 23:28:07 +08:00
dependabot[bot]
a9134f378e
build(deps): bump org.slf4j:slf4j-api from 2.0.9 to 2.0.11 (#124)
Bumps org.slf4j:slf4j-api from 2.0.9 to 2.0.11.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-21 23:23:37 +08:00
dependabot[bot]
dbb2fcdee1
build(deps): bump org.mockito:mockito-core from 5.8.0 to 5.9.0 (#128)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.8.0 to 5.9.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.8.0...v5.9.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-21 23:17:55 +08:00
dependabot[bot]
ce00369a22
build(deps): bump org.jetbrains.kotlin:kotlin-reflect (#120)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.9.21 to 1.9.22.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.9.21...v1.9.22)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 19:31:51 +08:00
dependabot[bot]
65bac28303
build(deps): bump jvm from 1.9.10 to 1.9.22 (#119)
Bumps [jvm](https://github.com/JetBrains/kotlin) from 1.9.10 to 1.9.22.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.9.10...v1.9.22)

---
updated-dependencies:
- dependency-name: jvm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 18:47:23 +08:00
dependabot[bot]
8bd6d5ffe5
build(deps): bump ch.qos.logback:logback-classic from 1.4.11 to 1.4.14 (#118)
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.11 to 1.4.14.
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.11...v_1.4.14)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 17:42:06 +08:00
dependabot[bot]
1c4cc122c9
build(deps): bump org.jetbrains.kotlinx.kover from 0.7.4 to 0.7.5 (#117)
Bumps [org.jetbrains.kotlinx.kover](https://github.com/Kotlin/kotlinx-kover) from 0.7.4 to 0.7.5.
- [Release notes](https://github.com/Kotlin/kotlinx-kover/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-kover/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-kover/compare/0.7.4...v0.7.5)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.kover
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 17:41:57 +08:00
dependabot[bot]
6083f4fc68
build(deps): bump org.junit.jupiter:junit-jupiter-api (#115)
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.10.0 to 5.10.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.0...r5.10.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 17:41:41 +08:00
dependabot[bot]
b33de4d63a
build(deps): bump gradle/gradle-build-action from 2.11.0 to 2.11.1 (#121)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.11.0 to 2.11.1.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.11.0...v2.11.1)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 17:41:27 +08:00
fd67eb99eb
feat: 在启动机器人时调用 GetMe 接口, 以检查 Token 有效性.
通过这种方式, 可以帮助用户在启动阶段发现 Bot Token 无效的问题.
2023-12-18 22:21:58 +08:00
ba306e679f
build(deps): bump all telegrambots deps from 6.7.0 to 6.8.0 (#114)
Bumps [org.telegram:telegrambots](https://github.com/rubenlagus/TelegramBots) from 6.7.0 to 6.8.0.
- [Release notes](https://github.com/rubenlagus/TelegramBots/releases)
- [Commits](rubenlagus/TelegramBots@v6.7.0...v6.8.0)

---
updated-dependencies:
- dependency-name: org.telegram:telegrambots-abilities
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.telegram:telegrambots
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.telegram:telegrambots-meta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...
2023-12-17 23:10:52 +08:00
dependabot[bot]
f188d5bfa9
build(deps): bump org.mockito:mockito-core from 5.6.0 to 5.8.0 (#111)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.6.0 to 5.8.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.6.0...v5.8.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-17 22:49:24 +08:00
dependabot[bot]
376086daa1
build(deps): bump org.junit.jupiter:junit-jupiter-engine (#112)
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.10.0 to 5.10.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.0...r5.10.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-17 22:42:54 +08:00
dependabot[bot]
cee8797c40
build(deps): bump org.jetbrains.dokka:javadoc-plugin (#103)
Bumps [org.jetbrains.dokka:javadoc-plugin](https://github.com/Kotlin/dokka) from 1.9.0 to 1.9.10.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.9.0...v1.9.10)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka:javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 12:16:49 +08:00
dependabot[bot]
77b5867dd7
build(deps): bump org.jetbrains.kotlin:kotlin-reflect (#105)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.9.10 to 1.9.21.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.9.10...v1.9.21)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 12:16:37 +08:00
dependabot[bot]
33eefd9e60
build(deps): bump gradle/gradle-build-action from 2.9.0 to 2.11.0 (#110)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.9.0 to 2.11.0.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.9.0...v2.11.0)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 12:16:10 +08:00
dependabot[bot]
0c81ca6d5f
build(deps): bump actions/setup-python from 4 to 5 (#108)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 12:15:57 +08:00
dependabot[bot]
705150b961
build(deps): bump actions/setup-java from 3 to 4 (#106)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3 to 4.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 12:09:50 +08:00
dependabot[bot]
e6f0550985
build(deps): bump org.jetbrains.dokka from 1.9.0 to 1.9.10 (#102)
Bumps [org.jetbrains.dokka](https://github.com/Kotlin/dokka) from 1.9.0 to 1.9.10.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.9.0...v1.9.10)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-04 08:41:26 +08:00
dependabot[bot]
90c57ff9b1
build(deps): bump org.mockito:mockito-core from 5.5.0 to 5.6.0 (#100)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.5.0 to 5.6.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.5.0...v5.6.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-31 13:37:50 +08:00
dependabot[bot]
d773cba776
build(deps): bump org.jetbrains.kotlinx.kover from 0.7.3 to 0.7.4 (#101)
Bumps [org.jetbrains.kotlinx.kover](https://github.com/Kotlin/kotlinx-kover) from 0.7.3 to 0.7.4.
- [Release notes](https://github.com/Kotlin/kotlinx-kover/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-kover/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-kover/compare/v0.7.3...0.7.4)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.kover
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-31 13:37:30 +08:00
dependabot[bot]
f1c36aacdb
build(deps): bump io.mockk:mockk from 1.13.7 to 1.13.8 (#97)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.7 to 1.13.8.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/1.13.7...1.13.8)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 00:59:36 +08:00
dependabot[bot]
fe9e7059c8
build(deps): bump gradle/gradle-build-action from 2.8.0 to 2.9.0 (#99)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.8.0 to 2.9.0.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.8.0...v2.9.0)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 22:22:51 +08:00
dependabot[bot]
b42cc6bd2c
build(deps): bump docker/setup-qemu-action from 2 to 3 (#94)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 01:46:49 +08:00
dependabot[bot]
ebfc387505
build(deps): bump docker/build-push-action from 4 to 5 (#96)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 01:46:39 +08:00
dependabot[bot]
340f6ba3f3
build(deps): bump org.jetbrains.kotlin:kotlin-reflect (#91)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.9.0 to 1.9.10.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.9.10/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.9.0...v1.9.10)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 01:46:13 +08:00
dependabot[bot]
e8f9dbbb05
build(deps): bump org.jetbrains.dokka from 1.8.20 to 1.9.0 (#92)
Bumps [org.jetbrains.dokka](https://github.com/Kotlin/dokka) from 1.8.20 to 1.9.0.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.8.20...v1.9.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 01:02:31 +08:00
dependabot[bot]
cdbfa822b0
build(deps): bump docker/setup-buildx-action from 2 to 3 (#93)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 01:02:07 +08:00
dependabot[bot]
6d5ce324a5
build(deps): bump docker/login-action from 2 to 3 (#95)
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 01:01:47 +08:00
dependabot[bot]
734a871fdc
build(deps): bump org.slf4j:slf4j-api from 2.0.7 to 2.0.9 (#88)
Bumps org.slf4j:slf4j-api from 2.0.7 to 2.0.9.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 00:57:50 +08:00
dependabot[bot]
a9ee432dec
build(deps): bump io.mockk:mockk from 1.13.5 to 1.13.7 (#81)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.5 to 1.13.7.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/commits)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-15 10:33:55 +08:00
dependabot[bot]
1fc386a226
build(deps): bump org.mockito:mockito-core from 5.3.1 to 5.5.0 (#83)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.3.1 to 5.5.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.3.1...v5.5.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-15 10:30:14 +08:00
dependabot[bot]
40524e89c6
build(deps): bump org.jetbrains.dokka:javadoc-plugin (#86)
Bumps [org.jetbrains.dokka:javadoc-plugin](https://github.com/Kotlin/dokka) from 1.8.20 to 1.9.0.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.8.20...v1.9.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka:javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 23:12:21 +08:00
dependabot[bot]
c972759ffb
build(deps): bump org.junit.jupiter:junit-jupiter-engine (#76)
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.9.3 to 5.10.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.3...r5.10.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 17:50:02 +08:00
dependabot[bot]
9b169ac957
build(deps): bump ch.qos.logback:logback-classic from 1.4.8 to 1.4.11 (#80)
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.8 to 1.4.11.
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.8...v_1.4.11)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 17:42:21 +08:00
f93a41af96
chore(meta): 确认由 Kotlin 版本更新导致的 api 变动.
自 Kotlin 1.9.0 开始, `Enum.values` 将正式更改为 `Enum.getEntries`(对应 Kotlin 中的
`Enum.entries` 属性), 已确认该改动不会影响现版本的兼容性.
--------------------------
KEEP 文档:
https://github.com/Kotlin/KEEP/blob/master/proposals/enum-entries.md
Kotlin 问题跟踪器:
https://youtrack.jetbrains.com/issue/KT-48872
2023-09-14 13:33:04 +08:00
dependabot[bot]
8eb993da3e
build(deps): bump actions/checkout from 3 to 4 (#87)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 11:43:11 +08:00
dependabot[bot]
9065df0e04
build(deps): bump jvm from 1.8.21 to 1.9.10 (#84)
Bumps [jvm](https://github.com/JetBrains/kotlin) from 1.8.21 to 1.9.10.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.9.10/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.21...v1.9.10)

---
updated-dependencies:
- dependency-name: jvm
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-09 23:19:55 +08:00
dependabot[bot]
9514c7b57e
build(deps): bump gradle/gradle-build-action from 2.7.0 to 2.8.0 (#85)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.7.0...v2.8.0)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-09 23:10:11 +08:00
24219df63b
release: 发布 6.1.0 版本. 2023-08-03 09:11:28 +08:00
dependabot[bot]
14e9c4d686
build(deps): bump org.jetbrains.dokka from 1.8.10 to 1.8.20 (#72)
Bumps [org.jetbrains.dokka](https://github.com/Kotlin/dokka) from 1.8.10 to 1.8.20.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.8.10...v1.8.20)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 18:29:25 +08:00
dependabot[bot]
8e83f714a7
build(deps): bump org.jetbrains.kotlinx:kotlinx-coroutines-core (#74)
Bumps [org.jetbrains.kotlinx:kotlinx-coroutines-core](https://github.com/Kotlin/kotlinx.coroutines) from 1.7.1 to 1.7.3.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.7.1...1.7.3)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 18:12:12 +08:00
dependabot[bot]
939aed5850
build(deps): bump ch.qos.logback:logback-classic from 1.4.7 to 1.4.8 (#73)
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.7 to 1.4.8.
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.7...v_1.4.8)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 18:08:43 +08:00
dependabot[bot]
a839cc63e6
build(deps): bump org.junit.jupiter:junit-jupiter-api (#71)
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.9.3 to 5.10.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.3...r5.10.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 17:58:19 +08:00
dependabot[bot]
8be3f770bf
build(deps): bump commons-codec:commons-codec from 1.15 to 1.16.0 (#75)
Bumps [commons-codec:commons-codec](https://github.com/apache/commons-codec) from 1.15 to 1.16.0.
- [Changelog](https://github.com/apache/commons-codec/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-codec/compare/rel/commons-codec-1.15...rel/commons-codec-1.16.0)

---
updated-dependencies:
- dependency-name: commons-codec:commons-codec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 17:54:46 +08:00
b1e7643b09
build(deps): 将 telegrambots 从 6.5.0 更新至 6.7.0
更新 Api 版本以支持新的 Api 改动.
2023-08-02 17:45:35 +08:00
4537e08107
fix(config): 将 local 列为 Maven 仓库 Id 的保留字.
local 是 Aether 中代表 LocalRepository 的仓库 Id, 因此拒绝用户使用 local 作为远端仓库的 Id.
2023-08-02 17:45:31 +08:00
3ea1eec2dd
ci(github-action): 提高 dependabot 依赖项更新检查的频率
提高检查频率, 以加快新版本的响应.
2023-08-02 17:40:35 +08:00
dependabot[bot]
fe9978dbe8
build(deps): bump org.jetbrains.kotlinx.kover from 0.7.0 to 0.7.3 (#69)
Bumps [org.jetbrains.kotlinx.kover](https://github.com/Kotlin/kotlinx-kover) from 0.7.0 to 0.7.3.
- [Release notes](https://github.com/Kotlin/kotlinx-kover/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-kover/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-kover/compare/v0.7.0...v0.7.3)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.kover
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 17:12:57 +08:00
dependabot[bot]
aece8221f1
build(deps): bump org.jetbrains.kotlin:kotlin-reflect (#68)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.8.21 to 1.9.0.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.21...v1.9.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 17:08:50 +08:00
dependabot[bot]
4c9256f82f
build(deps): bump org.telegram:telegrambots-meta from 6.5.0 to 6.7.0 (#64)
Bumps [org.telegram:telegrambots-meta](https://github.com/rubenlagus/TelegramBots) from 6.5.0 to 6.7.0.
- [Release notes](https://github.com/rubenlagus/TelegramBots/releases)
- [Commits](https://github.com/rubenlagus/TelegramBots/compare/v6.5.0...v6.7.0)

---
updated-dependencies:
- dependency-name: org.telegram:telegrambots-meta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 17:04:47 +08:00
dependabot[bot]
3f2e4e2d1f
build(deps): bump org.jetbrains.dokka:javadoc-plugin (#63)
Bumps [org.jetbrains.dokka:javadoc-plugin](https://github.com/Kotlin/dokka) from 1.8.10 to 1.8.20.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/compare/v1.8.10...v1.8.20)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka:javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 16:59:18 +08:00
dependabot[bot]
3810224667
build(deps): bump org.jetbrains.kotlinx.binary-compatibility-validator (#61)
Bumps [org.jetbrains.kotlinx.binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) from 0.13.1 to 0.13.2.
- [Release notes](https://github.com/Kotlin/binary-compatibility-validator/releases)
- [Commits](https://github.com/Kotlin/binary-compatibility-validator/compare/0.13.1...0.13.2)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.binary-compatibility-validator
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 16:39:17 +08:00
dependabot[bot]
3241bd2da9
build(deps): bump younited/get-previous-tag-action from 1.0.0 to 1.1.0 (#60)
Bumps [younited/get-previous-tag-action](https://github.com/younited/get-previous-tag-action) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/younited/get-previous-tag-action/releases)
- [Commits](https://github.com/younited/get-previous-tag-action/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: younited/get-previous-tag-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 13:57:51 +08:00
dependabot[bot]
dcac53fe65
build(deps): bump gradle/gradle-build-action from 2.4.2 to 2.7.0 (#70)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.4.2 to 2.7.0.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.4.2...v2.7.0)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 19:01:48 +08:00
dependabot[bot]
0bc77ada5f
build(deps): bump org.jetbrains.kotlinx:kotlinx-coroutines-core (#58)
Bumps [org.jetbrains.kotlinx:kotlinx-coroutines-core](https://github.com/Kotlin/kotlinx.coroutines) from 1.6.4 to 1.7.1.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.4...1.7.1)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 10:44:16 +08:00
dependabot[bot]
f0b45568d1
build(deps): bump org.junit.jupiter:junit-jupiter-engine (#59)
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.9.2 to 5.9.3.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.2...r5.9.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 10:36:30 +08:00
dependabot[bot]
a3dd9d4114
build(deps): bump org.jetbrains.kotlinx.kover from 0.6.1 to 0.7.0 (#57)
Bumps [org.jetbrains.kotlinx.kover](https://github.com/Kotlin/kotlinx-kover) from 0.6.1 to 0.7.0.
- [Release notes](https://github.com/Kotlin/kotlinx-kover/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-kover/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-kover/compare/v0.6.1...v0.7.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.kover
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 10:31:55 +08:00
dependabot[bot]
3afe3b52ed
build(deps): bump org.jetbrains.kotlin:kotlin-reflect (#56)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.8.20 to 1.8.21.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.20...v1.8.21)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 10:14:34 +08:00
dependabot[bot]
bdf75f1046
build(deps): bump org.junit.jupiter:junit-jupiter-api (#54)
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.9.2 to 5.9.3.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.2...r5.9.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 09:46:58 +08:00
dependabot[bot]
e834d4c7c7
build(deps): bump jvm from 1.8.20 to 1.8.21 (#53)
Bumps [jvm](https://github.com/JetBrains/kotlin) from 1.8.20 to 1.8.21.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.20...v1.8.21)

---
updated-dependencies:
- dependency-name: jvm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 09:40:53 +08:00
dependabot[bot]
2e1fae87b3
build(deps): bump ch.qos.logback:logback-classic from 1.4.6 to 1.4.7 (#50)
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.6 to 1.4.7.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.6...v_1.4.7)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 09:33:17 +08:00
dependabot[bot]
191bef5d68
build(deps): bump org.jetbrains.kotlinx.binary-compatibility-validator (#49)
Bumps [org.jetbrains.kotlinx.binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/Kotlin/binary-compatibility-validator/releases)
- [Commits](https://github.com/Kotlin/binary-compatibility-validator/compare/0.13.0...0.13.1)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.binary-compatibility-validator
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 09:24:24 +08:00
dependabot[bot]
55c435c4c0
build(deps): bump gradle/gradle-build-action in /.github/workflows (#55)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.4.0 to 2.4.2.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.4.0...v2.4.2)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 09:14:13 +08:00
dependabot[bot]
758e0a9f16
build(deps): bump org.mockito:mockito-core from 5.3.0 to 5.3.1 (#51)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.3.0 to 5.3.1.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.3.0...v5.3.1)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 14:28:55 +08:00
dependabot[bot]
5814817f3a
build(deps): bump org.mockito:mockito-core from 5.2.0 to 5.3.0 (#47)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-23 23:40:48 +08:00
dependabot[bot]
2641901240
build(deps): bump io.mockk:mockk from 1.13.4 to 1.13.5 (#48)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.4 to 1.13.5.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/v1.13.4...1.13.5)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-20 17:54:51 +08:00
dependabot[bot]
0070b400bb
build(deps): bump org.jetbrains.dokka:javadoc-plugin (#40)
Bumps [org.jetbrains.dokka:javadoc-plugin](https://github.com/Kotlin/dokka) from 1.7.20 to 1.8.10.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/commits)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka:javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-12 18:57:09 +08:00
dependabot[bot]
73e20ab737
build(deps): bump ch.qos.logback:logback-classic from 1.4.5 to 1.4.6 (#44)
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.5...v_1.4.6)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-12 18:56:57 +08:00
dependabot[bot]
03d24fbfe3
build(deps): bump org.jetbrains.kotlin:kotlin-reflect (#45)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.8.10 to 1.8.20.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.8.20/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.10...v1.8.20)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-12 18:56:36 +08:00
dependabot[bot]
53e47353e8
build(deps): bump kotlin plugin from 1.8.10 to 1.8.20 (#46)
Bumps [jvm](https://github.com/JetBrains/kotlin) from 1.8.10 to 1.8.20.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.8.20/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.10...v1.8.20)

---
updated-dependencies:
- dependency-name: jvm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-12 18:56:23 +08:00
dependabot[bot]
81a97ee8e3
build(deps): bump org.jetbrains.dokka from 1.7.20 to 1.8.10 (#41)
Bumps [org.jetbrains.dokka](https://github.com/Kotlin/dokka) from 1.7.20 to 1.8.10.
- [Release notes](https://github.com/Kotlin/dokka/releases)
- [Commits](https://github.com/Kotlin/dokka/commits)

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-31 13:57:26 +08:00
dependabot[bot]
dbcbc88e1b
build(deps): bump io.mockk:mockk from 1.13.2 to 1.13.4 (#38)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.2 to 1.13.4.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/1.13.2...v1.13.4)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 21:29:01 +08:00
dependabot[bot]
f233a25323
build(deps): bump org.slf4j:slf4j-api from 2.0.6 to 2.0.7 (#43)
Bumps [org.slf4j:slf4j-api](https://github.com/qos-ch/slf4j) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/qos-ch/slf4j/releases)
- [Commits](https://github.com/qos-ch/slf4j/commits)

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 21:28:20 +08:00
dependabot[bot]
2c91884db8
build(deps): bump org.mockito:mockito-core from 5.1.1 to 5.2.0 (#42)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.1.1 to 5.2.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.1.1...v5.2.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 21:26:44 +08:00
6b92b7e377
build(publish): 增加 self-git Maven 仓库.
目前 Gitea 的构件仓库已经完善到基本可用的程度, 决定将 extension 和 meta 模块也一同发布到 self-git 中.
2023-02-25 17:14:03 +08:00
375b815659
build(deps): extension 模块不再引入 Slf4j-api 依赖.
考虑到发布的频率, 决定不再为 extension 引入 slf4j-api 依赖;
不过还是建议开发者使用 Slf4j-api 打印日志, 这样可以将日志整合在一起, 方便排查问题.
2023-02-25 17:11:27 +08:00
f26d642320
build(gradle): 将 extension 模块的构建插件改为 java-library
先前由于不了解 Gradle 的插件划分而使用了 kotlin-jvm 插件, 现在将其修正, 改用 java-library 插件.
2023-02-24 15:55:58 +08:00
2db0b78962
style(extension): 为 getBotToken 设置 SuppressWarnings 用于忽略无关的弃用警告.
根据文档说明, 弃用仅针对重写方法, 对方法的使用并无大碍.
2023-02-24 15:53:32 +08:00
8b76a9aa9b
release: 发布 0.6.0 版本. 2023-02-21 23:46:48 +08:00
bbc3288535
ci(github-action): 启用 API 二进制兼容性验证. (#37)
使用二进制兼容验证, 可以快速了解 API 是否出现修改, 这个功能有利于防止无意中修改 API.
引入该过程后, 需谨慎检查 api 列表,
以确保改动是必须的. 当 api 出现改动时, 需按照改动类型分配合适的版本号(遵循 SemVer 规范).
2023-02-21 23:22:40 +08:00
dependabot[bot]
45ad734c7b
build(deps): bump org.junit.jupiter:junit-jupiter-engine (#34)
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.9.0 to 5.9.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.2)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 18:52:21 +08:00
dependabot[bot]
1eaed8ce6f
build(deps): bump org.mockito:mockito-core from 4.8.0 to 5.1.1 (#35)
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 4.8.0 to 5.1.1.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v4.8.0...v5.1.1)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 18:42:42 +08:00
dependabot[bot]
a624fcd37d
build(deps): bump com.google.code.gson:gson from 2.9.0 to 2.10.1 (#36)
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.9.0 to 2.10.1.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/gson/compare/gson-parent-2.9.0...gson-parent-2.10.1)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 18:38:18 +08:00
dependabot[bot]
59aa83c93e
build(deps): bump org.junit.jupiter:junit-jupiter-api (#33)
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.9.0 to 5.9.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.2)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 18:36:02 +08:00
3ea0f4eacb
feat(metrics): 指标信息增加 bot_id label.
由于 bot_name 不能作为机器人的唯一标识, 因此增加 bot_id 为监控平台提供唯一标识.
2023-02-21 18:32:35 +08:00
d3e18d80ca
ci(github-action): 移除针对子模块的依赖项更新.
根据目前的效果来看, 即使不指定子模块的路径, dependabot 也会检查子模块的依赖项更新情况, 因此尝试移除子模块配置.
2023-02-21 16:00:08 +08:00
1e0eebbd7e
build(deps): 更新日志相关依赖(Slf4j 2.0.6, Logback-classic 1.4.5, Kotlin-logging 3.0.5).
Slf4j: 2.0.3 -> 2.0.6
Logback-classic: 1.4.4 -> 1.4.5
Kotlin-logging: 3.0.2 -> 3.0.5
2023-02-21 15:51:28 +08:00
dependabot[bot]
6f3c1ec592
build(deps): bump org.junit.jupiter:junit-jupiter-api (#19)
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.9.0 to 5.9.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.2)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 15:29:54 +08:00
dependabot[bot]
c013dafdd7
build(deps): bump io.mockk:mockk from 1.13.2 to 1.13.4 in /scalabot-app (#26)
Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.2 to 1.13.4.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/1.13.2...v1.13.4)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 15:08:06 +08:00
dependabot[bot]
e0bfd8796c
build(deps): bump org.jetbrains.kotlin:kotlin-reflect in /scalabot-app (#29)
Bumps [org.jetbrains.kotlin:kotlin-reflect](https://github.com/JetBrains/kotlin) from 1.6.20 to 1.8.10.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.8.10/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.6.20...v1.8.10)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 15:07:45 +08:00
dependabot[bot]
67d561c0ab
build(deps): bump org.jetbrains.kotlinx.kover from 0.5.1 to 0.6.1 (#32)
Bumps [org.jetbrains.kotlinx.kover](https://github.com/Kotlin/kotlinx-kover) from 0.5.1 to 0.6.1.
- [Release notes](https://github.com/Kotlin/kotlinx-kover/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-kover/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-kover/compare/v0.5.1...v0.6.1)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx.kover
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 12:53:54 +08:00
63687da0bb
build(dependencies): 更新 binary-compatibility-validator 插件(0.11.1 -> 0.13.0).
更新后插件将支持 Kotlin 1.8.10 版本.
2023-02-21 12:44:06 +08:00
dependabot[bot]
cd76249c33
build(deps): bump gradle/gradle-build-action from 2.2.1 to 2.4.0 (#23)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.2.1 to 2.4.0.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.2.1...v2.4.0)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 11:24:23 +08:00
dependabot[bot]
5a8afd1549
build(deps): bump docker/build-push-action from 3 to 4 (#18)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 4.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-21 11:21:09 +08:00
651569dc8f
ci(github-action): 增加 Dependabot 配置文件.
使用 Dependabot 来自动检查依赖新版本, 减轻工作量.
2023-02-21 10:51:30 +08:00
bf2ea9a367
refactor(launch): 在启动时输出 JVM 和 Kotlin 的版本号.
在日志中添加版本信息, 方便在反馈问题时可以了解出现问题所使用的环境.
2023-02-19 16:12:15 +08:00
540fe84f26
build(dependencies): 更新 Kotlin 版本(1.7.10 -> 1.8.10).
更新 Kotlin 版本, 支持新的平台优化.
2023-02-19 16:09:52 +08:00
712378b3ff
build(dependencies): 更新 telegrambots 依赖项.
将 telegrambots 依赖项更新至 6.5.0, 支持新版 Api;
已确认 telegrambots 6.5.0 版本升级了jackson-databind 版本,
因此移除 jackson-databind 的显性依赖声明.
2023-02-08 10:12:33 +08:00
961382fb56
build(dependencies): 更新 TelegramBots 依赖项的版本号.
将 TelegramBots 依赖版本升级至 6.3.0, 支持新的 Telegram Bot API.
2022-12-16 01:15:09 +08:00
34d9ece6d7
feat(logging): 支持通过参数控制日志输出级别.
通过添加新的 -D 参数 `scalabot.log.level`, 使得用户可以根据需要, 调整日志输出级别, 通过日志来自行(或协助开发者)排查问题,
对于与网络有关的 Debug 级别日志, 则由 `scalabot.log.network.verbose` 参数进行控制;
另外, 由于开发过程中可通过该参数修改日志级别, 因此移除 `logback-test.xml` 文件.
2022-11-11 18:17:05 +08:00
30a2cb34d5
refactor(launch): 将 AppPaths 从 Launcher 解耦.
解耦后有助于后续改进, 以及单元测试的编写.
2022-11-07 11:16:41 +08:00
c94e0476b5
refactor(metrics): 为指标增加 namespace 名称.
遵循 OpenMetrics 规范指南, 为运行指标添加 namespace 名称, 防止指标混乱.

BREAKING CHANGE: 运行指标名称变更,
如果用户启用了运行指标功能, 请注意修改使用指标的名称.
2022-10-28 01:33:03 +08:00
6e5cd07c51
build(dependencies): 更新依赖项版本.
更新与日志和测试有关的依赖项版本.
2022-10-25 17:18:24 +08:00
37 changed files with 977 additions and 350 deletions

33
.github/dependabot.yml vendored Normal file
View 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"

View File

@ -0,0 +1,33 @@
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@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt-hotspot'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and run binary compatibility verification
run: ./gradlew apiCheck

View File

@ -18,18 +18,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '17'
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
cache: 'gradle' - name: Set up Gradle
- uses: gradle/wrapper-validation-action@v1 uses: gradle/actions/setup-gradle@v4
- 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 run: ./gradlew clean test
with:
gradle-version: 'wrapper'
arguments: test

View File

@ -19,18 +19,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
# 创建更新日志. # 创建更新日志.
- 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
uses: actions/setup-python@v4 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.10'
- name: Install Commitizen - name: Install Commitizen
@ -39,24 +39,21 @@ jobs:
run: cz ch --start-rev ${{ steps.previous-tag.outputs.previous-tag }} --file-name ${{ github.workspace }}/CURRENT_CHANGELOG.md run: cz ch --start-rev ${{ steps.previous-tag.outputs.previous-tag }} --file-name ${{ github.workspace }}/CURRENT_CHANGELOG.md
# 开始构建项目. # 开始构建项目.
- name: Set up JDK 11 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '17'
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
cache: 'gradle' - name: Set up Gradle
- uses: gradle/wrapper-validation-action@v1 uses: gradle/actions/setup-gradle@v4
- 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 run: ./gradlew clean test assembleDist
with:
gradle-version: 'wrapper'
arguments: clean test assembleDist
# 创建新的发行版本 # 创建新的发行版本
- name: Create Release - name: Create Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
with: with:
draft: true draft: true
body_path: ${{ github.workspace }}/CURRENT_CHANGELOG.md body_path: ${{ github.workspace }}/CURRENT_CHANGELOG.md

View File

@ -14,32 +14,29 @@ jobs:
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '17'
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
cache: 'gradle' - name: Set up Gradle
- uses: gradle/wrapper-validation-action@v1 uses: gradle/actions/setup-gradle@v4
- 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 run: ./gradlew clean test installDist
with:
gradle-version: 'wrapper'
arguments: clean test installDist
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX - name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
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@v6
with: with:
context: . context: .
push: true push: true

View File

@ -14,32 +14,29 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '17'
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
cache: 'gradle' - name: Set up Gradle
- uses: gradle/wrapper-validation-action@v1 uses: gradle/actions/setup-gradle@v4
- 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 run: ./gradlew clean test installDist
with:
gradle-version: 'wrapper'
arguments: installDist
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX - name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
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@v6
with: with:
context: . context: .
push: true push: true

View File

@ -1,4 +1,4 @@
FROM openjdk:18 FROM eclipse-temurin:21-jdk-alpine
ENV BOT_DATA_PATH /scalabot/data/ ENV BOT_DATA_PATH /scalabot/data/
WORKDIR /scalabot/run/ WORKDIR /scalabot/run/

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") version "1.7.10" apply false kotlin("jvm") version "2.1.0" apply false
id("org.jetbrains.kotlinx.kover") version "0.5.1" apply false id("org.jetbrains.kotlinx.kover") version "0.8.3" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3" apply false
} }
allprojects { allprojects {
@ -12,5 +13,5 @@ allprojects {
} }
group = "net.lamgc" group = "net.lamgc"
version = "0.5.2" version = "0.8.0-1"
} }

Binary file not shown.

View File

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

10
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright ? 2015-2021 the original authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script # Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features: # requires all of these POSIX shell features:
# * functions; # * functions;
# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially ?case?; # * compound commands having a testable exit status, especially «case»;
# * various built-in commands including ?command?, ?set?, and ?ulimit?. # * various built-in commands including «command», «set», and «ulimit».
# #
# Important for patching: # Important for patching:
# #

View File

@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
@ -10,9 +11,9 @@ dependencies {
implementation(project(":scalabot-meta")) implementation(project(":scalabot-meta"))
implementation(project(":scalabot-extension")) implementation(project(":scalabot-extension"))
implementation("org.slf4j:slf4j-api:2.0.0") implementation("org.slf4j:slf4j-api:2.0.11")
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.4.0") implementation("ch.qos.logback:logback-classic:1.5.12")
val aetherVersion = "1.1.0" val aetherVersion = "1.1.0"
implementation("org.eclipse.aether:aether-api:$aetherVersion") implementation("org.eclipse.aether:aether-api:$aetherVersion")
@ -22,35 +23,35 @@ dependencies {
implementation("org.eclipse.aether:aether-transport-http:$aetherVersion") implementation("org.eclipse.aether:aether-transport-http:$aetherVersion")
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.codehaus.plexus:plexus-utils:3.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20") implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.0")
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.11.0")
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:8.0.0")
implementation("org.telegram:telegrambots:6.1.0") implementation("org.telegram:telegrambots-longpolling:8.0.0")
implementation("org.telegram:telegrambots-client:8.0.0")
// Added as a mitigation measure for vulnerabilities.
// When the relevant reference dependency updates it, it will be removed.
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.4.2")
implementation("io.prometheus:simpleclient:0.16.0") implementation("io.prometheus:simpleclient:0.16.0")
implementation("io.prometheus:simpleclient_httpserver:0.16.0") implementation("io.prometheus:simpleclient_httpserver:0.16.0")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
testImplementation("io.mockk:mockk:1.12.7") testImplementation("io.mockk:mockk:1.13.13")
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1") testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")
} }
tasks.test { tasks.test {
useJUnitPlatform() useJUnitPlatform()
jvmArgs("--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED")
} }
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11" compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
} }
application { application {

View File

@ -12,7 +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.telegram.telegrambots.bots.DefaultBotOptions import org.slf4j.event.Level
import java.io.File import java.io.File
import java.net.URL import java.net.URL
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
@ -23,13 +23,13 @@ import kotlin.reflect.KProperty
private val log = KotlinLogging.logger { } private val log = KotlinLogging.logger { }
internal fun ProxyType.toTelegramBotsType(): DefaultBotOptions.ProxyType { internal fun ProxyType.toJavaProxyType(): java.net.Proxy.Type? {
return when (this) { return when (this) {
ProxyType.NO_PROXY -> DefaultBotOptions.ProxyType.NO_PROXY ProxyType.NO_PROXY -> null
ProxyType.HTTP -> DefaultBotOptions.ProxyType.HTTP ProxyType.HTTP -> java.net.Proxy.Type.HTTP
ProxyType.HTTPS -> DefaultBotOptions.ProxyType.HTTP ProxyType.HTTPS -> java.net.Proxy.Type.HTTP
ProxyType.SOCKS4 -> DefaultBotOptions.ProxyType.SOCKS4 ProxyType.SOCKS4 -> java.net.Proxy.Type.SOCKS
ProxyType.SOCKS5 -> DefaultBotOptions.ProxyType.SOCKS5 ProxyType.SOCKS5 -> java.net.Proxy.Type.SOCKS
} }
} }
@ -47,6 +47,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 +252,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() {
@ -276,7 +309,7 @@ internal fun initialFiles(): Boolean {
val configFilesNotInitialized = !AppPaths.CONFIG_APPLICATION.file.exists() val configFilesNotInitialized = !AppPaths.CONFIG_APPLICATION.file.exists()
&& !AppPaths.CONFIG_BOT.file.exists() && !AppPaths.CONFIG_BOT.file.exists()
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
path.initial() path.initial()
} }

View File

@ -6,13 +6,17 @@ import kotlinx.coroutines.runBlocking
import mu.KotlinLogging import mu.KotlinLogging
import net.lamgc.scalabot.config.* import net.lamgc.scalabot.config.*
import net.lamgc.scalabot.util.registerShutdownHook import net.lamgc.scalabot.util.registerShutdownHook
import okhttp3.OkHttpClient
import org.eclipse.aether.repository.LocalRepository import org.eclipse.aether.repository.LocalRepository
import org.telegram.telegrambots.bots.DefaultBotOptions import org.telegram.telegrambots.client.okhttp.OkHttpTelegramClient
import org.telegram.telegrambots.meta.TelegramBotsApi import org.telegram.telegrambots.longpolling.BotSession
import org.telegram.telegrambots.meta.generics.BotSession import org.telegram.telegrambots.longpolling.TelegramBotsLongPollingApplication
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession import org.telegram.telegrambots.meta.api.methods.GetMe
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.net.InetSocketAddress
import java.net.Proxy
import java.nio.file.attribute.PosixFilePermission import java.nio.file.attribute.PosixFilePermission
import java.nio.file.attribute.PosixFilePermissions import java.nio.file.attribute.PosixFilePermissions
import kotlin.io.path.createDirectories import kotlin.io.path.createDirectories
@ -26,6 +30,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,23 +66,24 @@ 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
private val log = KotlinLogging.logger { } private val log = KotlinLogging.logger { }
} }
private val botApi = TelegramBotsApi(DefaultBotSession::class.java) private val botApi = TelegramBotsLongPollingApplication()
private val botSessionMap = mutableMapOf<ScalaBot, BotSession>() private val botSessionMap = mutableMapOf<ScalaBot, BotSession>()
private val mavenLocalRepository = getMavenLocalRepository() private val mavenLocalRepository = getMavenLocalRepository()
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!!)
.apply {
if (!exists()) { if (!exists()) {
if (!parent.isWritable() || !parent.isReadable()) { if (!parent.isWritable() || !parent.isReadable()) {
throw IOException("Unable to read and write the directory where Maven repository is located.") throw IOException("Unable to read and write the directory where Maven repository is located.")
@ -133,9 +139,17 @@ internal class Launcher(private val config: AppConfig = Const.config) : AutoClos
launchBot(botConfig) launchBot(botConfig)
launchedCounts++ launchedCounts++
} catch (e: Exception) { } catch (e: Exception) {
if (e is TelegramApiRequestException && e.errorCode == 401) {
log.error { "机器人 `${botConfig.account.name}` 的 Bot Token 无效, 请检查配置: [${e.errorCode}] ${e.apiResponse}" }
} else {
log.error(e) { "机器人 `${botConfig.account.name}` 启动时发生错误." } log.error(e) { "机器人 `${botConfig.account.name}` 启动时发生错误." }
} }
} }
}
botApi.start()
botApi.registerShutdownHook()
return if (launchedCounts != 0) { return if (launchedCounts != 0) {
log.info { "已启动 $launchedCounts 个机器人." } log.info { "已启动 $launchedCounts 个机器人." }
true true
@ -163,17 +177,17 @@ internal class Launcher(private val config: AppConfig = Const.config) : AutoClos
ProxyConfig(type = ProxyType.NO_PROXY) ProxyConfig(type = ProxyType.NO_PROXY)
} }
val botOption = DefaultBotOptions().apply { val okhttpClientBuilder = OkHttpClient.Builder()
if (proxyConfig.type != ProxyType.NO_PROXY) { if (proxyConfig.type != ProxyType.NO_PROXY) {
proxyType = proxyConfig.type.toTelegramBotsType() val proxyType = proxyConfig.type.toJavaProxyType()
proxyHost = config.proxy.host val proxyAddress = InetSocketAddress.createUnresolved(proxyConfig.host, proxyConfig.port)
proxyPort = config.proxy.port okhttpClientBuilder.proxy(Proxy(proxyType, proxyAddress))
log.debug { "机器人 `${botConfig.account.name}` 已启用代理配置: $proxyConfig" }
} }
baseUrl = botConfig.baseApiUrl
}
val account = botConfig.account val account = botConfig.account
val telegramClient =
OkHttpTelegramClient(okhttpClientBuilder.build(), account.token, botConfig.getBaseApiTelegramUrl())
val remoteRepositories = config.mavenRepositories val remoteRepositories = config.mavenRepositories
.map { it.toRemoteRepository(proxyConfig) } .map { it.toRemoteRepository(proxyConfig) }
@ -195,11 +209,15 @@ internal class Launcher(private val config: AppConfig = Const.config) : AutoClos
val bot = ScalaBot( val bot = ScalaBot(
BotDBMaker.getBotDbInstance(account), BotDBMaker.getBotDbInstance(account),
botOption, telegramClient,
extensionPackageFinders, extensionPackageFinders,
botConfig botConfig
) )
botSessionMap[bot] = botApi.registerBot(bot)
val botUser = bot.telegramClient.execute(GetMe())
log.debug { "已验证 Bot Token 有效性, Bot Username: ${botUser.userName}" }
botSessionMap[bot] = botApi.registerBot(botConfig.account.token, bot)
log.info { "机器人 `${bot.botUsername}` 已启动." } log.info { "机器人 `${bot.botUsername}` 已启动." }
if (botConfig.autoUpdateCommandList) { if (botConfig.autoUpdateCommandList) {

View File

@ -7,8 +7,8 @@ import net.lamgc.scalabot.util.toHexString
import org.mapdb.DB import org.mapdb.DB
import org.mapdb.DBException import org.mapdb.DBException
import org.mapdb.DBMaker import org.mapdb.DBMaker
import org.telegram.abilitybots.api.db.DBContext import org.telegram.telegrambots.abilitybots.api.db.DBContext
import org.telegram.abilitybots.api.db.MapDBContext import org.telegram.telegrambots.abilitybots.api.db.MapDBContext
import java.io.File import java.io.File
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.security.MessageDigest import java.security.MessageDigest
@ -157,7 +157,6 @@ private abstract class FileDbAdapter(
val oldFile = oldDbAdapter.getBotDbFile(botAccount) val oldFile = oldDbAdapter.getBotDbFile(botAccount)
val newFile = getBotDbFile(botAccount) val newFile = getBotDbFile(botAccount)
try { try {
@Suppress("UnstableApiUsage")
Files.copy(oldFile, newFile) Files.copy(oldFile, newFile)
} catch (e: Exception) { } catch (e: Exception) {
if (newFile.exists()) { if (newFile.exists()) {

View File

@ -1,10 +1,11 @@
package net.lamgc.scalabot package net.lamgc.scalabot
import mu.KotlinLogging import mu.KotlinLogging
import net.lamgc.scalabot.extension.BotExtensionCreateOptions
import net.lamgc.scalabot.extension.BotExtensionFactory import net.lamgc.scalabot.extension.BotExtensionFactory
import net.lamgc.scalabot.util.getPriority import net.lamgc.scalabot.util.getPriority
import org.eclipse.aether.artifact.Artifact import org.eclipse.aether.artifact.Artifact
import org.telegram.abilitybots.api.util.AbilityExtension import org.telegram.telegrambots.abilitybots.api.util.AbilityExtension
import java.io.File import java.io.File
import java.io.FileNotFoundException import java.io.FileNotFoundException
import java.net.URL import java.net.URL
@ -122,7 +123,13 @@ internal class ExtensionLoader(
for (factory in extClassLoader.serviceLoader) { for (factory in extClassLoader.serviceLoader) {
try { try {
val extension = val extension =
factory.createExtensionInstance(bot, getExtensionDataFolder(extensionArtifact)) factory.createExtensionInstance(
bot, getExtensionDataFolder(extensionArtifact),
BotExtensionCreateOptions(
bot.accountId,
bot.botConfig.proxy.copy()
)
)
if (extension == null) { if (extension == null) {
log.debug { "Factory ${factory::class.java} 创建插件时返回了 null, 已跳过. (BotName: ${bot.botUsername})" } log.debug { "Factory ${factory::class.java} 创建插件时返回了 null, 已跳过. (BotName: ${bot.botUsername})" }
continue continue
@ -152,7 +159,7 @@ internal class ExtensionLoader(
* 搜索指定构件坐标的依赖包. * 搜索指定构件坐标的依赖包.
* *
* 搜索扩展包将根据搜索器优先级从高到低依次搜索, 当某一个优先级的搜索器搜到扩展包后将停止搜索. * 搜索扩展包将根据搜索器优先级从高到低依次搜索, 当某一个优先级的搜索器搜到扩展包后将停止搜索.
* 可以根据不同优先级的搜索器, 配置扩展包的主用备用文件. * 可以根据不同优先级的搜索器, 配置扩展包的主用备用文件.
* *
* @return 返回各个搜索器返回的搜索结果. * @return 返回各个搜索器返回的搜索结果.
*/ */

View File

@ -26,6 +26,7 @@ import org.jdom2.input.SAXBuilder
import org.jdom2.xpath.XPathFactory import org.jdom2.xpath.XPathFactory
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream
import java.net.URI
import java.net.URL import java.net.URL
import java.net.URLClassLoader import java.net.URLClassLoader
import java.util.* import java.util.*
@ -396,7 +397,6 @@ internal class MavenRepositoryExtensionFinder(
/** /**
* Maven 中央仓库 Url. * Maven 中央仓库 Url.
*/ */
@Suppress("MemberVisibilityCanBePrivate")
const val MAVEN_CENTRAL_URL = "https://repo1.maven.org/maven2/" const val MAVEN_CENTRAL_URL = "https://repo1.maven.org/maven2/"
/** /**
@ -466,17 +466,19 @@ internal class MavenRepositoryExtensionFinder(
throw IllegalArgumentException("Unsupported FoundExtensionPackage type: $foundExtensionPackage") throw IllegalArgumentException("Unsupported FoundExtensionPackage type: $foundExtensionPackage")
} }
val urls = mutableSetOf<URL>() val urls = mutableSetOf<URI>()
for (dependency in foundExtensionPackage.dependencies) { for (dependency in foundExtensionPackage.dependencies) {
val dependencyFile = dependency.file ?: continue val dependencyFile = dependency.file ?: continue
urls.add(dependencyFile.toURI().toURL()) urls.add(dependencyFile.toURI())
} }
// 将依赖的 ClassLoader 与 ExtensionPackage 的 ClassLoader 分开 // 将依赖的 ClassLoader 与 ExtensionPackage 的 ClassLoader 分开
// 这么做可以防范依赖中隐藏的 SPI 注册, 避免安全隐患. // 这么做可以防范依赖中隐藏的 SPI 注册, 避免安全隐患.
val dependenciesUrlArray = urls.toTypedArray() val dependenciesUrlArray = urls.toTypedArray()
val dependenciesClassLoader = URLClassLoader(dependenciesUrlArray) val dependenciesClassLoader = URLClassLoader(
dependenciesUrlArray.map { it.toURL() }.toTypedArray()
)
return ExtensionClassLoader( return ExtensionClassLoader(
arrayOf(foundExtensionPackage.getPackageFile().toURI().toURL()), arrayOf(foundExtensionPackage.getPackageFile().toURI().toURL()),

View File

@ -6,43 +6,42 @@ import io.prometheus.client.Summary
import mu.KotlinLogging import mu.KotlinLogging
import net.lamgc.scalabot.config.BotConfig import net.lamgc.scalabot.config.BotConfig
import org.eclipse.aether.artifact.Artifact import org.eclipse.aether.artifact.Artifact
import org.telegram.abilitybots.api.bot.AbilityBot import org.telegram.telegrambots.abilitybots.api.bot.AbilityBot
import org.telegram.abilitybots.api.db.DBContext import org.telegram.telegrambots.abilitybots.api.db.DBContext
import org.telegram.abilitybots.api.objects.Ability import org.telegram.telegrambots.abilitybots.api.objects.Ability
import org.telegram.abilitybots.api.toggle.BareboneToggle import org.telegram.telegrambots.abilitybots.api.toggle.BareboneToggle
import org.telegram.abilitybots.api.toggle.DefaultToggle import org.telegram.telegrambots.abilitybots.api.toggle.DefaultToggle
import org.telegram.telegrambots.bots.DefaultBotOptions
import org.telegram.telegrambots.meta.api.methods.commands.DeleteMyCommands import org.telegram.telegrambots.meta.api.methods.commands.DeleteMyCommands
import org.telegram.telegrambots.meta.api.methods.commands.SetMyCommands import org.telegram.telegrambots.meta.api.methods.commands.SetMyCommands
import org.telegram.telegrambots.meta.api.objects.Update import org.telegram.telegrambots.meta.api.objects.Update
import org.telegram.telegrambots.meta.api.objects.commands.BotCommand import org.telegram.telegrambots.meta.api.objects.commands.BotCommand
import org.telegram.telegrambots.meta.generics.TelegramClient
/** /**
* 可扩展 Bot. * 可扩展 Bot.
* @property creatorId 机器人所有人的 Telegram 用户 Id. 可通过联系部分机器人来获取该信息. * @property creatorId 机器人所有人的 Telegram 用户 ID. 可通过联系部分机器人来获取该信息.
* (e.g. [@userinfobot](http://t.me/userinfobot)) * (e.g. [@userinfobot](http://t.me/userinfobot))
* @param db 机器人数据库对象. 用于状态机等用途. * @param db 机器人数据库对象. 用于状态机等用途.
* @param options AbilityBot 设置对象.
* @property extensions 扩展坐标集合. * @property extensions 扩展坐标集合.
*/ */
@Suppress("CanBeParameter", "MemberVisibilityCanBePrivate")
internal class ScalaBot( internal class ScalaBot(
db: DBContext, db: DBContext,
options: DefaultBotOptions, client: TelegramClient,
extensionFinders: Set<ExtensionPackageFinder>, extensionFinders: Set<ExtensionPackageFinder>,
botConfig: BotConfig, val botConfig: BotConfig,
private val creatorId: Long = botConfig.account.creatorId,
val accountId: Long = botConfig.account.id, val accountId: Long = botConfig.account.id,
private val creatorId: Long = botConfig.account.creatorId,
val extensions: Set<Artifact> = botConfig.extensions val extensions: Set<Artifact> = botConfig.extensions
) : ) :
AbilityBot( AbilityBot(
botConfig.account.token, client,
botConfig.account.name, botConfig.account.name,
db, db,
if (botConfig.disableBuiltInAbility) if (botConfig.disableBuiltInAbility)
BareboneToggle() BareboneToggle()
else else
DefaultToggle(), DefaultToggle()
options
) { ) {
private val extensionLoader = ExtensionLoader( private val extensionLoader = ExtensionLoader(
@ -50,6 +49,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()
@ -65,19 +66,19 @@ internal class ScalaBot(
override fun creatorId(): Long = creatorId override fun creatorId(): Long = creatorId
override fun onUpdateReceived(update: Update?) { override fun consume(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.consume(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()
} }
} }
@ -90,11 +91,11 @@ internal class ScalaBot(
* @return 更新成功返回 `true`. * @return 更新成功返回 `true`.
*/ */
fun updateCommandList(): Boolean { fun updateCommandList(): Boolean {
if (abilities() == null) { if (abilities == null) {
throw IllegalStateException("Abilities has not been initialized.") throw IllegalStateException("Abilities has not been initialized.")
} }
val botCommands = abilities().values.map { val botCommands = abilities.values.map {
val abilityInfo = if (it.info() == null || it.info().trim().isEmpty()) { val abilityInfo = if (it.info() == null || it.info().trim().isEmpty()) {
log.warn { "[Bot $botUsername] Ability `${it.name()}` 没有说明信息." } log.warn { "[Bot $botUsername] Ability `${it.name()}` 没有说明信息." }
"(The command has no description)" "(The command has no description)"
@ -110,9 +111,10 @@ internal class ScalaBot(
return true return true
} }
val setMyCommands = SetMyCommands() val setMyCommands = SetMyCommands.builder()
setMyCommands.commands = botCommands .commands(botCommands)
return execute(DeleteMyCommands()) && execute(setMyCommands) .build()
return telegramClient.execute(DeleteMyCommands()) && telegramClient.execute(setMyCommands)
} }
override fun onRegister() { override fun onRegister() {
@ -120,10 +122,6 @@ internal class ScalaBot(
onlineBotGauge.inc() onlineBotGauge.inc()
} }
override fun onClosing() {
onlineBotGauge.dec()
}
companion object { companion object {
@JvmStatic @JvmStatic
private val log = KotlinLogging.logger { } private val log = KotlinLogging.logger { }
@ -134,7 +132,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 +141,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 +150,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 +162,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 +171,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()
} }

View File

@ -0,0 +1,29 @@
package net.lamgc.scalabot.util
import java.util.regex.Matcher
import java.util.regex.Pattern
object TelegramBotAccounts {
private val botTokenPattern: Pattern = Pattern.compile("([1-9]\\d+):([A-Za-z\\d_-]{35,})")
/**
* 获取 AbilityBot 的账户 Id.
*
*
* 账户 Id 来自于 botToken , token 的格式为 "{AccountId}:{Secret}".
*
* 账户 Id 的真实性与 botToken 的有效性有关, 本方法并不会确保 botToken 的有效性, 一般情况下也无需考虑 Id 的有效性,
* 如果有需要, 可尝试通过调用 [org.telegram.telegrambots.meta.api.methods.GetMe] 来确保 botToken 的有效性.
*
* @param botToken 要获取账户 Id botToken 字符串.
* @return 返回 AbilityBot 的账户 Id.
* @throws IllegalArgumentException AbilityBot botToken 格式错误时抛出该异常.
*/
fun getBotAccountId(botToken: String): Long {
val matcher: Matcher = botTokenPattern.matcher(botToken)
require(matcher.matches()) { "Invalid token format." }
return matcher.group(1).toLong()
}
}

View File

@ -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>

View File

@ -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>

View File

@ -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"/>

View File

@ -10,9 +10,9 @@ import net.lamgc.scalabot.config.ProxyConfig
import net.lamgc.scalabot.config.ProxyType import net.lamgc.scalabot.config.ProxyType
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.io.TempDir import org.junit.jupiter.api.io.TempDir
import org.telegram.telegrambots.bots.DefaultBotOptions
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.net.Proxy
import java.net.URL import java.net.URL
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
@ -23,7 +23,7 @@ internal class AppPathsTest {
@Test @Test
fun `Consistency check`() { fun `Consistency check`() {
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
assertEquals( assertEquals(
File(path.path).canonicalPath, File(path.path).canonicalPath,
path.file.canonicalPath, path.file.canonicalPath,
@ -226,17 +226,17 @@ internal class AppPathsTest {
@Test @Test
fun `ProxyType_toTelegramBotsType test`() { fun `ProxyType_toTelegramBotsType test`() {
val expectTypeMapping = mapOf( val expectTypeMapping = mapOf(
ProxyType.NO_PROXY to DefaultBotOptions.ProxyType.NO_PROXY, ProxyType.NO_PROXY to null,
ProxyType.SOCKS5 to DefaultBotOptions.ProxyType.SOCKS5, ProxyType.SOCKS5 to Proxy.Type.SOCKS,
ProxyType.SOCKS4 to DefaultBotOptions.ProxyType.SOCKS4, ProxyType.SOCKS4 to Proxy.Type.SOCKS,
ProxyType.HTTP to DefaultBotOptions.ProxyType.HTTP, ProxyType.HTTP to Proxy.Type.HTTP,
ProxyType.HTTPS to DefaultBotOptions.ProxyType.HTTP ProxyType.HTTPS to Proxy.Type.HTTP
) )
for (proxyType in ProxyType.values()) { for (proxyType in ProxyType.entries) {
assertEquals( assertEquals(
expectTypeMapping[proxyType], expectTypeMapping[proxyType],
proxyType.toTelegramBotsType(), proxyType.toJavaProxyType(),
"ProxyType 转换失败." "ProxyType 转换失败."
) )
} }
@ -251,7 +251,7 @@ internal class AppPathsTest {
ProxyType.HTTP, ProxyType.HTTP,
ProxyType.HTTPS ProxyType.HTTPS
) )
for (proxyType in ProxyType.values()) { for (proxyType in ProxyType.entries) {
val proxyConfig = ProxyConfig(proxyType, host, port) val proxyConfig = ProxyConfig(proxyType, host, port)
val aetherProxy = proxyConfig.toAetherProxy() val aetherProxy = proxyConfig.toAetherProxy()
if (expectNotNullProxyType.contains(proxyType)) { if (expectNotNullProxyType.contains(proxyType)) {
@ -337,7 +337,7 @@ internal class AppPathsTest {
assertTrue(initialFiles(), "方法未能提醒用户编辑初始配置文件.") assertTrue(initialFiles(), "方法未能提醒用户编辑初始配置文件.")
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}") assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}")
if (path.file.isFile) { if (path.file.isFile) {
assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}") assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}")
@ -347,7 +347,7 @@ internal class AppPathsTest {
assertFalse(initialFiles(), "方法试图在配置已初始化的情况下提醒用户编辑初始配置文件.") assertFalse(initialFiles(), "方法试图在配置已初始化的情况下提醒用户编辑初始配置文件.")
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}") assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}")
if (path.file.isFile) { if (path.file.isFile) {
assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}") assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}")
@ -358,7 +358,7 @@ internal class AppPathsTest {
assertTrue(AppPaths.CONFIG_APPLICATION.file.delete(), "config.json 删除失败.") assertTrue(AppPaths.CONFIG_APPLICATION.file.delete(), "config.json 删除失败.")
assertFalse(initialFiles(), "方法试图在部分配置已初始化的情况下提醒用户编辑初始配置文件.") assertFalse(initialFiles(), "方法试图在部分配置已初始化的情况下提醒用户编辑初始配置文件.")
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}") assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}")
if (path.file.isFile) { if (path.file.isFile) {
assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}") assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}")
@ -369,7 +369,7 @@ internal class AppPathsTest {
assertTrue(AppPaths.CONFIG_BOT.file.delete(), "bot.json 删除失败.") assertTrue(AppPaths.CONFIG_BOT.file.delete(), "bot.json 删除失败.")
assertFalse(initialFiles(), "方法试图在部分配置已初始化的情况下提醒用户编辑初始配置文件.") assertFalse(initialFiles(), "方法试图在部分配置已初始化的情况下提醒用户编辑初始配置文件.")
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}") assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}")
if (path.file.isFile) { if (path.file.isFile) {
assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}") assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}")
@ -384,7 +384,7 @@ internal class AppPathsTest {
"在主要配置文件(config.json 和 bot.json)不存在的情况下初始化文件后, 方法未能提醒用户编辑初始配置文件." "在主要配置文件(config.json 和 bot.json)不存在的情况下初始化文件后, 方法未能提醒用户编辑初始配置文件."
) )
for (path in AppPaths.values()) { for (path in AppPaths.entries) {
assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}") assertTrue(path.file.exists(), "文件未初始化成功: ${path.path}")
if (path.file.isFile) { if (path.file.isFile) {
assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}") assertNotEquals(0, path.file.length(), "文件未初始化成功(大小为 0): ${path.path}")

View File

@ -0,0 +1,27 @@
package util
import net.lamgc.scalabot.util.TelegramBotAccounts
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.Test
class TelegramBotAccountsTest {
@Test
fun getBotAccountIdTest() {
val expectToken = "1234567890:AAHXcNDBRZTKfyPED5Gi3PZDIKPOM6xhxwo"
val actual: Long = TelegramBotAccounts.getBotAccountId(expectToken)
assertEquals(1234567890, actual)
val badTokenA = "12c34d56a7890:AAHXcNDBRZTKfyPED5Gi3PZDIKPOM6xhxwo"
assertThrows(
IllegalArgumentException::class.java
) { TelegramBotAccounts.getBotAccountId(badTokenA) }
val badTokenB = "12c34d56a7890AAHXcNDBRZTKfyPED5Gi3PZDIKPOM6xhxwo"
assertThrows(
IllegalArgumentException::class.java
) { TelegramBotAccounts.getBotAccountId(badTokenB) }
}
}

View File

@ -5,7 +5,7 @@ plugins {
dependencies { dependencies {
compileOnly(project(":scalabot-extension")) compileOnly(project(":scalabot-extension"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
} }

View File

@ -1,8 +1,8 @@
package net.lamgc.scalabot.simple; package net.lamgc.scalabot.simple;
import org.telegram.abilitybots.api.bot.BaseAbilityBot; import org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot;
import org.telegram.abilitybots.api.objects.*; import org.telegram.telegrambots.abilitybots.api.objects.*;
import org.telegram.abilitybots.api.util.AbilityExtension; import org.telegram.telegrambots.abilitybots.api.util.AbilityExtension;
public class SayHelloExtension implements AbilityExtension { public class SayHelloExtension implements AbilityExtension {
@ -27,7 +27,7 @@ public class SayHelloExtension implements AbilityExtension {
String msg = "Hello! " + ctx.user().getUserName() + String msg = "Hello! " + ctx.user().getUserName() +
" ( " + ctx.user().getId() + " ) [ " + ctx.user().getLanguageCode() + " ]" + "\n" + " ( " + ctx.user().getId() + " ) [ " + ctx.user().getLanguageCode() + " ]" + "\n" +
"Current Chat ID: " + ctx.chatId(); "Current Chat ID: " + ctx.chatId();
ctx.bot().silent().send(msg, ctx.chatId()); ctx.bot().getSilent().send(msg, ctx.chatId());
}) })
.build(); .build();
} }
@ -36,13 +36,13 @@ public class SayHelloExtension implements AbilityExtension {
* 更具特色的 `Say hello`. * 更具特色的 `Say hello`.
*/ */
public Ability test() { public Ability test() {
ReplyFlow botHello = ReplyFlow.builder(bot.db()) ReplyFlow botHello = ReplyFlow.builder(bot.getDb())
.enableStats("say_hello") .enableStats("say_hello")
.action((bot, upd) -> bot.silent().send("What is u name?", upd.getMessage().getChatId())) .action((bot, upd) -> bot.getSilent().send("What is u name?", upd.getMessage().getChatId()))
.onlyIf(update -> update.hasMessage() .onlyIf(update -> update.hasMessage()
&& update.getMessage().hasText() && update.getMessage().hasText()
&& "hello".equalsIgnoreCase(update.getMessage().getText())) && "hello".equalsIgnoreCase(update.getMessage().getText()))
.next(Reply.of((bot, upd) -> bot.silent() .next(Reply.of((bot, upd) -> bot.getSilent()
.send("OK! You name is " + upd.getMessage().getText().substring("my name is ".length()), upd.getMessage().getChatId()), .send("OK! You name is " + upd.getMessage().getText().substring("my name is ".length()), upd.getMessage().getChatId()),
upd -> upd.hasMessage() upd -> upd.hasMessage()
&& upd.getMessage().hasText() && upd.getMessage().hasText()
@ -55,7 +55,7 @@ public class SayHelloExtension implements AbilityExtension {
.locality(Locality.ALL) .locality(Locality.ALL)
.privacy(Privacy.PUBLIC) .privacy(Privacy.PUBLIC)
.enableStats() .enableStats()
.action(ctx -> ctx.bot().silent().send("Hello!", ctx.chatId())) .action(ctx -> ctx.bot().getSilent().send("Hello!", ctx.chatId()))
.reply(botHello) .reply(botHello)
.build(); .build();
} }

View File

@ -1,15 +1,16 @@
package net.lamgc.scalabot.simple; package net.lamgc.scalabot.simple;
import net.lamgc.scalabot.extension.BotExtensionCreateOptions;
import net.lamgc.scalabot.extension.BotExtensionFactory; import net.lamgc.scalabot.extension.BotExtensionFactory;
import org.telegram.abilitybots.api.bot.BaseAbilityBot; import org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot;
import org.telegram.abilitybots.api.util.AbilityExtension; import org.telegram.telegrambots.abilitybots.api.util.AbilityExtension;
import java.io.File; import java.io.File;
public class SimpleExtensionFactory implements BotExtensionFactory { public class SimpleExtensionFactory implements BotExtensionFactory {
@Override @Override
public AbilityExtension createExtensionInstance(BaseAbilityBot bot, File shareDataFolder) { public AbilityExtension createExtensionInstance(BaseAbilityBot bot, File shareDataFolder, BotExtensionCreateOptions options) {
return new SayHelloExtension(bot); return new SayHelloExtension(bot);
} }

View File

@ -1,23 +1,18 @@
plugins { plugins {
kotlin("jvm") `java-library`
java
jacoco jacoco
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.1"
} }
dependencies { dependencies {
implementation("commons-codec:commons-codec:1.15") implementation("commons-codec:commons-codec:1.16.1")
api("org.telegram:telegrambots-abilities:6.1.0") api("org.telegram:telegrambots-abilities:8.0.0")
api("org.slf4j:slf4j-api:2.0.0") api(project(":scalabot-meta"))
// Added as a mitigation measure for vulnerabilities. testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
// When the relevant reference dependency updates it, it will be removed. testImplementation("org.mockito:mockito-core:5.11.0")
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.4.2") testImplementation("org.telegram:telegrambots-client:8.0.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testImplementation("org.mockito:mockito-core:4.7.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
} }
@ -30,8 +25,8 @@ tasks.withType<Javadoc> {
java { java {
withJavadocJar() withJavadocJar()
withSourcesJar() withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
tasks.test { tasks.test {
@ -50,19 +45,10 @@ 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.private.username"].toString() username = project.properties["repo.credentials.self-git.username"].toString()
password = project.properties["repo.credentials.private.password"].toString() password = project.properties["repo.credentials.self-git.password"].toString()
}
}
} else {
maven("https://nexus.kuku.me/repository/maven-releases/") {
credentials {
username = project.properties["repo.credentials.private.username"].toString()
password = project.properties["repo.credentials.private.password"].toString()
}
} }
} }
} }

View File

@ -0,0 +1,44 @@
package net.lamgc.scalabot.extension;
import net.lamgc.scalabot.config.ProxyConfig;
/**
* BotExtension 创建参数.
* <p>
* 通过该类可向 {@link BotExtensionFactory} 提供更多创建 BotExtension 时可用的参数.
*/
@SuppressWarnings("unused")
public class BotExtensionCreateOptions {
private final long botAccountId;
private final ProxyConfig proxy;
/**
* 构造新的 BotExtensionCreateOptions.
*
* @param botAccountId 创建扩展的 Bot 账户 Id.
* @param proxy Bot 所使用的代理配置.
*/
public BotExtensionCreateOptions(long botAccountId, ProxyConfig proxy) {
this.botAccountId = botAccountId;
this.proxy = proxy;
}
/**
* 获取 Bot 使用的代理信息.
*
* @return 返回 Bot TelegramClient 所使用的代理配置.
*/
public ProxyConfig getProxy() {
return proxy;
}
/**
* 获取 Bot 的账户 Id.
*
* @return 返回 Bot 的账户 Id.
*/
public long getBotAccountId() {
return botAccountId;
}
}

View File

@ -1,7 +1,8 @@
package net.lamgc.scalabot.extension; package net.lamgc.scalabot.extension;
import org.telegram.abilitybots.api.bot.BaseAbilityBot; import org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot;
import org.telegram.abilitybots.api.util.AbilityExtension; import org.telegram.telegrambots.abilitybots.api.db.DBContext;
import org.telegram.telegrambots.abilitybots.api.util.AbilityExtension;
import java.io.File; import java.io.File;
@ -9,7 +10,7 @@ import java.io.File;
* 该接口用于为指定的 {@link BaseAbilityBot} 创建扩展. * 该接口用于为指定的 {@link BaseAbilityBot} 创建扩展.
* *
* <p> 由于 AbilityExtension 无法直接获取 {@link BaseAbilityBot} * <p> 由于 AbilityExtension 无法直接获取 {@link BaseAbilityBot}
* 数据库对象 {@link org.telegram.abilitybots.api.db.DBContext}, * 数据库对象 {@link DBContext},
* 所以将通过该接口工厂来创建扩展对象. * 所以将通过该接口工厂来创建扩展对象.
* *
* @author LamGC * @author LamGC
@ -20,7 +21,7 @@ public interface BotExtensionFactory {
/** /**
* 为给定的 {@link BaseAbilityBot} 对象创建扩展. * 为给定的 {@link BaseAbilityBot} 对象创建扩展.
* *
* <p> 如扩展无使用 {@link org.telegram.abilitybots.api.db.DBContext} 的话, * <p> 如扩展无使用 {@link DBContext} 的话,
* 也可以返回扩展单例, 因为 AbilityBot 本身并不禁止多个机器人共用一个扩展对象 * 也可以返回扩展单例, 因为 AbilityBot 本身并不禁止多个机器人共用一个扩展对象
* (AbilityBot 只是调用了扩展中的方法来创建 Ability 对象). * (AbilityBot 只是调用了扩展中的方法来创建 Ability 对象).
* *
@ -30,8 +31,10 @@ public interface BotExtensionFactory {
* <pre> $DATA_ROOT/data/extensions/{GroupId}/{ArtifactId}</pre> * <pre> $DATA_ROOT/data/extensions/{GroupId}/{ArtifactId}</pre>
* <b>同一个扩展包的 Factory</b> 接收到的共享数据目录<b>都是一样的</b>, * <b>同一个扩展包的 Factory</b> 接收到的共享数据目录<b>都是一样的</b>,
* 建议将数据存储在数据目录中, 便于数据的存储管理. * 建议将数据存储在数据目录中, 便于数据的存储管理.
* @param options 创建扩展时可用的参数.
* @return 返回为该 Bot 对象创建的扩展对象, 如果不希望为该机器人提供扩展, 可返回 {@code null}. * @return 返回为该 Bot 对象创建的扩展对象, 如果不希望为该机器人提供扩展, 可返回 {@code null}.
* @since 0.7.0
*/ */
AbilityExtension createExtensionInstance(BaseAbilityBot bot, File shareDataFolder); AbilityExtension createExtensionInstance(BaseAbilityBot bot, File shareDataFolder, BotExtensionCreateOptions options);
} }

View File

@ -1,36 +1,15 @@
package net.lamgc.scalabot.extension.util; package net.lamgc.scalabot.extension.util;
import org.telegram.abilitybots.api.bot.BaseAbilityBot; import org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class AbilityBots {
private final static Pattern botTokenPattern = Pattern.compile("([1-9]\\d+):([A-Za-z\\d_-]{35,})");
private AbilityBots() {
}
/** /**
* 获取 AbilityBot 的账户 Id. * 一些开发扩展中可以用到的工具类.
*
* <p> 账户 Id 来自于 botToken , token 的格式为 "[AccountId]:[Secret]".
* <p> 账户 Id 的真实性与 botToken 的有效性有关, 本方法并不会确保 botToken 的有效性, 一般情况下也无需考虑 Id 的有效性,
* 如果有需要, 可尝试通过调用 {@link org.telegram.telegrambots.meta.api.methods.GetMe} 来确保 botToken 的有效性.
*
* @param bot 要获取账户 Id AbilityBot 对象.
* @return 返回 AbilityBot 的账户 Id.
* @throws IllegalArgumentException AbilityBot botToken 格式错误时抛出该异常.
*/ */
public static long getBotAccountId(BaseAbilityBot bot) { public final class AbilityBots {
String botToken = bot.getBotToken();
Matcher matcher = botTokenPattern.matcher(botToken); private AbilityBots() {
if (!matcher.matches()) {
throw new IllegalArgumentException("Invalid token format.");
}
return Long.parseLong(matcher.group(1));
} }
/** /**
@ -41,7 +20,7 @@ public class AbilityBots {
* @return 如果状态机存在, 则删除后返回 true, 不存在(未开启任何状态机, 即没有触发任何 Reply)则返回 false. * @return 如果状态机存在, 则删除后返回 true, 不存在(未开启任何状态机, 即没有触发任何 Reply)则返回 false.
*/ */
public static boolean cancelReplyState(BaseAbilityBot bot, long chatId) { public static boolean cancelReplyState(BaseAbilityBot bot, long chatId) {
Map<Long, Integer> stateMap = bot.db().getMap("user_state_replies"); Map<Long, Integer> stateMap = bot.getDb().getMap("user_state_replies");
if (!stateMap.containsKey(chatId)) { if (!stateMap.containsKey(chatId)) {
return false; return false;
} }

View File

@ -2,22 +2,35 @@ package net.lamgc.scalabot.extension.util;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mapdb.DBMaker; import org.mapdb.DBMaker;
import org.telegram.abilitybots.api.bot.AbilityBot; import org.telegram.telegrambots.abilitybots.api.bot.AbilityBot;
import org.telegram.abilitybots.api.bot.BaseAbilityBot; import org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot;
import org.telegram.abilitybots.api.db.MapDBContext; import org.telegram.telegrambots.abilitybots.api.db.MapDBContext;
import org.telegram.abilitybots.api.objects.*; import org.telegram.telegrambots.abilitybots.api.objects.*;
import org.telegram.abilitybots.api.sender.SilentSender; import org.telegram.telegrambots.abilitybots.api.sender.SilentSender;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.api.objects.User; import org.telegram.telegrambots.meta.api.objects.User;
import org.telegram.telegrambots.meta.api.objects.message.Message;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
public class AbilityBotsTest { public class AbilityBotsTest {
public static final User USER = new User(1L, "first", false, "last", "username", null, false, false, false, false, false); public static final User USER = User.builder()
public static final User CREATOR = new User(1337L, "creatorFirst", false, "creatorLast", "creatorUsername", null, false, false, false, false, false); .userName("username")
.id(1L)
.firstName("first")
.lastName("last")
.isBot(false)
.build();
public static final User CREATOR = User.builder()
.userName("creatorUsername")
.id(1337L)
.firstName("creatorFirst")
.lastName("creatorLast")
.isBot(false)
.build();
static Update mockFullUpdate(BaseAbilityBot bot, User user, String args) { static Update mockFullUpdate(BaseAbilityBot bot, User user, String args) {
bot.users().put(USER.getId(), USER); bot.users().put(USER.getId(), USER);
@ -39,58 +52,51 @@ public class AbilityBotsTest {
return update; return update;
} }
@Test
void getBotAccountIdTest() {
String expectToken = "1234567890:AAHXcNDBRZTKfyPED5Gi3PZDIKPOM6xhxwo";
long actual = AbilityBots.getBotAccountId(new TestingAbilityBot(expectToken, "test"));
assertEquals(1234567890, actual);
String badTokenA = "12c34d56a7890:AAHXcNDBRZTKfyPED5Gi3PZDIKPOM6xhxwo";
assertThrows(IllegalArgumentException.class, () ->
AbilityBots.getBotAccountId(new TestingAbilityBot(badTokenA, "test")));
String badTokenB = "12c34d56a7890AAHXcNDBRZTKfyPED5Gi3PZDIKPOM6xhxwo";
assertThrows(IllegalArgumentException.class, () ->
AbilityBots.getBotAccountId(new TestingAbilityBot(badTokenB, "test")));
}
@Test @Test
void cancelReplyStateTest() { void cancelReplyStateTest() {
User userA = new User(10001L, "first", false, "last", "username", null, false, false, false, false, false); User userA = User.builder()
User userB = new User(10101L, "first", false, "last", "username", null, false, false, false, false, false); .id(10001L)
.firstName("first")
.lastName("last")
.userName("username")
.isBot(false)
.build();
User userB = User.builder()
.id(10101L)
.firstName("first")
.lastName("last")
.userName("username")
.isBot(false)
.build();
SilentSender silent = mock(SilentSender.class); SilentSender silent = mock(SilentSender.class);
BaseAbilityBot bot = new TestingAbilityBot("", "", silent); BaseAbilityBot bot = new TestingAbilityBot("", silent);
bot.onRegister(); bot.onRegister();
bot.onUpdateReceived(mockFullUpdate(bot, userA, "/set_reply")); bot.consume(mockFullUpdate(bot, userA, "/set_reply"));
verify(silent, times(1)).send("Reply set!", userA.getId()); verify(silent, times(1)).send("Reply set!", userA.getId());
bot.onUpdateReceived(mockFullUpdate(bot, userA, "reply_01")); bot.consume(mockFullUpdate(bot, userA, "reply_01"));
verify(silent, times(1)).send("Reply 01", userA.getId()); verify(silent, times(1)).send("Reply 01", userA.getId());
assertTrue(AbilityBots.cancelReplyState(bot, userA.getId())); assertTrue(AbilityBots.cancelReplyState(bot, userA.getId()));
bot.onUpdateReceived(mockFullUpdate(bot, userA, "reply_02")); bot.consume(mockFullUpdate(bot, userA, "reply_02"));
verify(silent, never()).send("Reply 02", userA.getId()); verify(silent, never()).send("Reply 02", userA.getId());
assertFalse(AbilityBots.cancelReplyState(bot, userB.getId())); assertFalse(AbilityBots.cancelReplyState(bot, userB.getId()));
silent = mock(SilentSender.class); silent = mock(SilentSender.class);
bot = new TestingAbilityBot("", "", silent); bot = new TestingAbilityBot("", silent);
bot.onRegister(); bot.onRegister();
bot.onUpdateReceived(mockFullUpdate(bot, userA, "/set_reply")); bot.consume(mockFullUpdate(bot, userA, "/set_reply"));
verify(silent, times(1)).send("Reply set!", userA.getId()); verify(silent, times(1)).send("Reply set!", userA.getId());
bot.onUpdateReceived(mockFullUpdate(bot, userA, "reply_01")); bot.consume(mockFullUpdate(bot, userA, "reply_01"));
verify(silent, times(1)).send("Reply 01", userA.getId()); verify(silent, times(1)).send("Reply 01", userA.getId());
bot.onUpdateReceived(mockFullUpdate(bot, userA, "reply_02")); bot.consume(mockFullUpdate(bot, userA, "reply_02"));
verify(silent, times(1)).send("Reply 02", userA.getId()); verify(silent, times(1)).send("Reply 02", userA.getId());
} }
public static class TestingAbilityBot extends AbilityBot { public static class TestingAbilityBot extends AbilityBot {
public TestingAbilityBot(String botToken, String botUsername) { public TestingAbilityBot(String botUsername, SilentSender silentSender) {
super(botToken, botUsername, new MapDBContext(DBMaker.heapDB().make())); super(new NoOpTelegramClient(), botUsername, new MapDBContext(DBMaker.heapDB().make()));
}
public TestingAbilityBot(String botToken, String botUsername, SilentSender silentSender) {
super(botToken, botUsername, new MapDBContext(DBMaker.heapDB().make()));
this.silent = silentSender; this.silent = silentSender;
} }
@ -101,12 +107,12 @@ public class AbilityBotsTest {
.enableStats() .enableStats()
.locality(Locality.ALL) .locality(Locality.ALL)
.privacy(Privacy.PUBLIC) .privacy(Privacy.PUBLIC)
.action(ctx -> ctx.bot().silent().send("Reply set!", ctx.chatId())) .action(ctx -> ctx.bot().getSilent().send("Reply set!", ctx.chatId()))
.reply(ReplyFlow.builder(db()) .reply(ReplyFlow.builder(getDb())
.action((bot, upd) -> bot.silent().send("Reply 01", upd.getMessage().getChatId())) .action((bot, upd) -> bot.getSilent().send("Reply 01", upd.getMessage().getChatId()))
.onlyIf(upd -> upd.hasMessage() && upd.getMessage().getText().equals("reply_01")) .onlyIf(upd -> upd.hasMessage() && upd.getMessage().getText().equals("reply_01"))
.next(Reply.of((bot, upd) -> .next(Reply.of((bot, upd) ->
bot.silent().send("Reply 02", upd.getMessage().getChatId()), bot.getSilent().send("Reply 02", upd.getMessage().getChatId()),
upd -> upd.hasMessage() && upd.getMessage().getText().equals("reply_02"))) upd -> upd.hasMessage() && upd.getMessage().getText().equals("reply_02")))
.build() .build()
) )

View File

@ -0,0 +1,229 @@
package net.lamgc.scalabot.extension.util;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.groupadministration.SetChatPhoto;
import org.telegram.telegrambots.meta.api.methods.send.*;
import org.telegram.telegrambots.meta.api.methods.stickers.*;
import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook;
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageMedia;
import org.telegram.telegrambots.meta.api.objects.File;
import org.telegram.telegrambots.meta.api.objects.message.Message;
import org.telegram.telegrambots.meta.generics.TelegramClient;
import java.io.InputStream;
import java.io.Serializable;
import java.util.List;
import java.util.concurrent.CompletableFuture;
class NoOpTelegramClient implements TelegramClient {
@Override
public <T extends Serializable, Method extends BotApiMethod<T>> CompletableFuture<T> executeAsync(Method method) {
return null;
}
@Override
public <T extends Serializable, Method extends BotApiMethod<T>> T execute(Method method) {
return null;
}
@Override
public Message execute(SendDocument sendDocument) {
return null;
}
@Override
public Message execute(SendPhoto sendPhoto) {
return null;
}
@Override
public Boolean execute(SetWebhook setWebhook) {
return null;
}
@Override
public Message execute(SendVideo sendVideo) {
return null;
}
@Override
public Message execute(SendVideoNote sendVideoNote) {
return null;
}
@Override
public Message execute(SendSticker sendSticker) {
return null;
}
@Override
public Message execute(SendAudio sendAudio) {
return null;
}
@Override
public Message execute(SendVoice sendVoice) {
return null;
}
@Override
public List<Message> execute(SendMediaGroup sendMediaGroup) {
return List.of();
}
@Override
public List<Message> execute(SendPaidMedia sendPaidMedia) {
return List.of();
}
@Override
public Boolean execute(SetChatPhoto setChatPhoto) {
return null;
}
@Override
public Boolean execute(AddStickerToSet addStickerToSet) {
return null;
}
@Override
public Boolean execute(ReplaceStickerInSet replaceStickerInSet) {
return null;
}
@Override
public Boolean execute(SetStickerSetThumbnail setStickerSetThumbnail) {
return null;
}
@Override
public Boolean execute(CreateNewStickerSet createNewStickerSet) {
return null;
}
@Override
public File execute(UploadStickerFile uploadStickerFile) {
return null;
}
@Override
public Serializable execute(EditMessageMedia editMessageMedia) {
return null;
}
@Override
public java.io.File downloadFile(File file) {
return null;
}
@Override
public InputStream downloadFileAsStream(File file) {
return null;
}
@Override
public Message execute(SendAnimation sendAnimation) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendDocument sendDocument) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendPhoto sendPhoto) {
return null;
}
@Override
public CompletableFuture<Boolean> executeAsync(SetWebhook setWebhook) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendVideo sendVideo) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendVideoNote sendVideoNote) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendSticker sendSticker) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendAudio sendAudio) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendVoice sendVoice) {
return null;
}
@Override
public CompletableFuture<List<Message>> executeAsync(SendMediaGroup sendMediaGroup) {
return null;
}
@Override
public CompletableFuture<List<Message>> executeAsync(SendPaidMedia sendPaidMedia) {
return null;
}
@Override
public CompletableFuture<Boolean> executeAsync(SetChatPhoto setChatPhoto) {
return null;
}
@Override
public CompletableFuture<Boolean> executeAsync(AddStickerToSet addStickerToSet) {
return null;
}
@Override
public CompletableFuture<Boolean> executeAsync(ReplaceStickerInSet replaceStickerInSet) {
return null;
}
@Override
public CompletableFuture<Boolean> executeAsync(SetStickerSetThumbnail setStickerSetThumbnail) {
return null;
}
@Override
public CompletableFuture<Boolean> executeAsync(CreateNewStickerSet createNewStickerSet) {
return null;
}
@Override
public CompletableFuture<File> executeAsync(UploadStickerFile uploadStickerFile) {
return null;
}
@Override
public CompletableFuture<Serializable> executeAsync(EditMessageMedia editMessageMedia) {
return null;
}
@Override
public CompletableFuture<Message> executeAsync(SendAnimation sendAnimation) {
return null;
}
@Override
public CompletableFuture<java.io.File> downloadFileAsync(File file) {
return null;
}
@Override
public CompletableFuture<InputStream> downloadFileAsStreamAsync(File file) {
return null;
}
}

View File

@ -0,0 +1,201 @@
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 getBaseApiTelegramUrl ()Lorg/telegram/telegrambots/meta/TelegramUrl;
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/ConfigsKt {
public static final fun getDefaultTelegramApiUrl ()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 getEntries ()Lkotlin/enums/EnumEntries;
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;
}

View File

@ -1,10 +1,12 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
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.9.20"
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.1" id("org.jetbrains.kotlinx.binary-compatibility-validator")
} }
dependencies { dependencies {
@ -12,33 +14,29 @@ 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:8.0.0")
// Added as a mitigation measure for vulnerabilities. api("com.google.code.gson:gson:2.11.0")
// When the relevant reference dependency updates it, it will be removed.
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.4.2")
api("com.google.code.gson:gson:2.9.0")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
testImplementation("io.mockk:mockk:1.12.7") testImplementation("io.mockk:mockk:1.13.13")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.1")
dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.7.10") dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:2.0.0")
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions { compilerOptions {
jvmTarget = "11" jvmTarget = JvmTarget.JVM_17
} }
} }
java { java {
withJavadocJar() withJavadocJar()
withSourcesJar() withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
tasks.withType<AbstractArchiveTask>().configureEach { tasks.withType<AbstractArchiveTask>().configureEach {
@ -56,19 +54,10 @@ 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.private.username"].toString() username = project.properties["repo.credentials.self-git.username"].toString()
password = project.properties["repo.credentials.private.password"].toString() password = project.properties["repo.credentials.self-git.password"].toString()
}
}
} else {
maven("https://nexus.kuku.me/repository/maven-releases/") {
credentials {
username = project.properties["repo.credentials.private.username"].toString()
password = project.properties["repo.credentials.private.password"].toString()
}
} }
} }
} }

View File

@ -3,7 +3,8 @@ package net.lamgc.scalabot.config
import org.eclipse.aether.artifact.Artifact import org.eclipse.aether.artifact.Artifact
import org.eclipse.aether.repository.Authentication import org.eclipse.aether.repository.Authentication
import org.eclipse.aether.repository.Proxy import org.eclipse.aether.repository.Proxy
import org.telegram.telegrambots.meta.ApiConstants import org.telegram.telegrambots.meta.TelegramUrl
import java.net.URI
import java.net.URL import java.net.URL
/** /**
@ -26,6 +27,13 @@ data class BotAccount(
get() = token.substringBefore(":").toLong() get() = token.substringBefore(":").toLong()
} }
val defaultTelegramApiUrl: String = URL(
TelegramUrl.DEFAULT_URL.schema,
TelegramUrl.DEFAULT_URL.host,
TelegramUrl.DEFAULT_URL.port,
"/"
).toExternalForm()
/** /**
* 机器人配置. * 机器人配置.
* *
@ -56,8 +64,22 @@ data class BotConfig(
*/ */
val extensions: Set<Artifact> = emptySet(), val extensions: Set<Artifact> = emptySet(),
val proxy: ProxyConfig = ProxyConfig(type = ProxyType.NO_PROXY), val proxy: ProxyConfig = ProxyConfig(type = ProxyType.NO_PROXY),
val baseApiUrl: String = ApiConstants.BASE_URL val baseApiUrl: String = defaultTelegramApiUrl
) ) {
fun getBaseApiTelegramUrl(): TelegramUrl {
if (this.baseApiUrl == defaultTelegramApiUrl) {
return TelegramUrl.DEFAULT_URL
} else {
URI.create(baseApiUrl).let {
return TelegramUrl.builder()
.host(it.host)
.port(it.port)
.schema(it.scheme)
.build()
}
}
}
}
/** /**
* 代理类型. * 代理类型.

View File

@ -53,7 +53,7 @@ internal class ProxyTypeSerializerTest {
@Test @Test
fun `serialize test`() { fun `serialize test`() {
for (type in ProxyType.values()) { for (type in ProxyType.entries) {
assertEquals( assertEquals(
JsonPrimitive(type.name), ProxyTypeSerializer.serialize(type, null, null), JsonPrimitive(type.name), ProxyTypeSerializer.serialize(type, null, null),
"ProxyType 序列化结果与预期不符." "ProxyType 序列化结果与预期不符."
@ -79,7 +79,7 @@ internal class ProxyTypeSerializerTest {
ProxyTypeSerializer.deserialize(JsonNull.INSTANCE, null, null) ProxyTypeSerializer.deserialize(JsonNull.INSTANCE, null, null)
) )
for (type in ProxyType.values()) { for (type in ProxyType.entries) {
assertEquals( assertEquals(
type, ProxyTypeSerializer.deserialize(JsonPrimitive(type.name), null, null), type, ProxyTypeSerializer.deserialize(JsonPrimitive(type.name), null, null),
"ProxyType 反序列化结果与预期不符." "ProxyType 反序列化结果与预期不符."