mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-07-05 06:47:24 +00:00
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
This commit is contained in:
@ -10,13 +10,29 @@ import net.lamgc.scalabot.config.ProxyConfig;
|
||||
@SuppressWarnings("unused")
|
||||
public class BotExtensionCreateOptions {
|
||||
|
||||
private final long botAccountId;
|
||||
private final ProxyConfig proxy;
|
||||
|
||||
public BotExtensionCreateOptions(ProxyConfig proxy) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user