Extensible robot server based on rubenlagus/TelegramBots (Using Java or kotlin)
Go to file
LamGC 1f48bbae8e
build(vcs): 补充对日志归档包的排除项.
补充日志归档包(.log.gz)的排除项, 排除了测试过程中产生的日志归档包.
2022-02-28 08:34:07 +08:00
gradle/wrapper build: 更新 Gradle Wrapper 所使用的 Gradle 版本(7.3.3 -> 7.4). 2022-02-15 13:27:50 +08:00
scalabot-app fix(extension): 移除默认的 MavenRepositoryExtensionFinder. 2022-02-28 08:26:26 +08:00
scalabot-ext-example build: 更新 Slf4j 和 Junit, 屏蔽扩展包的测试依赖. 2022-02-15 13:37:40 +08:00
scalabot-extension build: 设置了发布小仓库的配置. 2022-02-21 15:42:07 +08:00
.gitignore build(vcs): 补充对日志归档包的排除项. 2022-02-28 08:34:07 +08:00
build.gradle.kts release: 发布 0.0.1 版本. 2022-02-22 01:48:11 +08:00
gradle.properties initial: 基本完成的首个版本, 还需要调整一下. 2022-01-16 20:21:18 +08:00
gradlew initial: 基本完成的首个版本, 还需要调整一下. 2022-01-16 20:21:18 +08:00
gradlew.bat initial: 基本完成的首个版本, 还需要调整一下. 2022-01-16 20:21:18 +08:00
LICENSE Initial commit 2022-01-16 14:44:52 +08:00
README.md docs: 更新 Readme 内容(未完成). 2022-02-22 01:44:55 +08:00
settings.gradle.kts refactor: 将扩展示例的名称更改为 scalabot-ext-example. 2022-01-16 21:18:48 +08:00

ScalaBot

基于 rubenlagus/TelegramBots 的可扩展机器人服务器。 Extensible robot server based on rubenlagus/TelegramBots.

背景

当初开发 Telegram 机器人的时候,发现 rubenlagus/TelegramBots 是按 Bot 融入应用的方式设计的, 且 AbilityExtension 对 ReplyFlow 不太支持(因为无法获取所属 AbilityBot 的 StateDB 所以我尝试提供了一个 Factory 接口,在创建 AbilityExtension 对象时提供扩展将要服务的 AbilityBot 对象,这样 AbilityExtension 就可以不受限的实现功能了。

使用

  1. 首先,在 Telegram 中联系 BotFather ,申请机器人账号。
  2. 下载 最新版本 的 ScalaBot 将发行包解压到某个目录中,然后准备一个用于存储 ScalaBot 运行数据的目录。
  3. 在作为数据存储位置的目录中,执行从分发包中解压出来的 bin/ScalaBot 脚本以打开 ScalaBot。 由于首次启动缺少配置文件ScalaBot 将会初始化配置文件(config.jsonbot.json
  4. 将配置文件配置好后,如已下载好需要使用的扩展包,将扩展包移至 extensions 文件夹即可。(无需下载的扩展包将由 ScalaBot 自动下载)
  5. 如果一切正常ScalaBot 正常运行,绑定好的 Telegram Bot 账号将会对消息有所反应。

开发扩展包

ScalaBot 基于 TelegramBots 开发,所以开发 ScalaBot 的扩展与开发 TelegramBots 的扩展大致相同,
唯一的差别就是 TelegramBots 要求 AbilityBot 手动添加 AbilityExtension,而 ScalaBot 通过 SPI 从扩展包中寻找 BotExtensionFactory,并通过 BotExtensionFactory 创建 AbilityExtension 对象,然后添加到 ScalaBot本质上是一个 AbilityBot)。

只需要按照 TelegramBots 的文档开发出 AbilityExtension,然后实现 BotExtensionFactory 并注册到对应的 SPI 文件中就可以在 ScalaBot 中使用了。

详细文件见项目 Wiki。

许可证

ScalaBot 遵循 MIT 许可证开源。

Copyright 2022 LamGC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.