Skip to content

Commit b92222f

Browse files
committed
feat: has_economy config
1 parent cbf0dc2 commit b92222f

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## 1.3.2 (23/03/17)
22

33
1. fix: depends on mirai-economy-core
4+
2. fix: MiraiOpenAiTokens register
5+
3. feat: has_economy config
46

57
## 1.3.1 (23/03/16)
68

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ OpenAI 目前对注册有一定要求,请先阅读 [注册](#注册), 然后
6363
* `has_permission` 权限检查, 为 `true` 时开启
6464
* `at_once` 立刻开始聊天/问答(即不会发送 `聊天/问答将开始`, 而是直接接着指令开始聊天) 默认 `false`
6565
* `keep_prefix_check` 保持前缀检查(即一定要附带前缀/`@`才会触发对话),默认 `false`
66+
* `has_economy` 经济系统, 为 `true` 时开启 @see <https://github.com/cssxsh/mirai-economy-core>
6667

6768
`completion.yml` 自定义模型详细配置
6869

src/main/kotlin/xyz/cssxsh/mirai/openai/config/MiraiOpenAiConfig.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,8 @@ internal object MiraiOpenAiConfig : ReadOnlyPluginConfig("openai"), OpenAiClient
8989
@ValueName("has_permission")
9090
@ValueDescription("权限检查")
9191
val permission: Boolean by value(false)
92+
93+
@ValueName("has_economy")
94+
@ValueDescription("接入经济系统")
95+
val economy: Boolean by value(true)
9296
}

src/main/kotlin/xyz/cssxsh/mirai/openai/data/MiraiOpenAiTokensData.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package xyz.cssxsh.mirai.openai.data
33
import net.mamoe.mirai.contact.*
44
import xyz.cssxsh.mirai.economy.*
55
import xyz.cssxsh.mirai.openai.*
6+
import xyz.cssxsh.mirai.openai.config.*
67

78
public object MiraiOpenAiTokensData {
89

910
@PublishedApi
1011
internal val economy: Boolean by lazy {
11-
try {
12+
MiraiOpenAiConfig.economy && try {
1213
EconomyService.register(MiraiOpenAiTokens)
1314
true
1415
} catch (_: Throwable) {

0 commit comments

Comments
 (0)