Skip to content

Commit

Permalink
删掉推送功能
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Apr 13, 2024
1 parent fba909b commit b45b9d3
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 153 deletions.
27 changes: 1 addition & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# th-bingo

![](https://img.shields.io/github/languages/top/CuteReimu/th-bingo "语言")
![](https://img.shields.io/badge/java%20version-17-informational "Java 17")
[![](https://img.shields.io/github/actions/workflow/status/CuteReimu/th-bingo/build.yml?branch=master)](https://github.com/CuteReimu/th-bingo/actions/workflows/build.yml "代码分析")
[![](https://img.shields.io/github/contributors/CuteReimu/th-bingo)](https://github.com/CuteReimu/th-bingo/graphs/contributors "贡献者")
[![](https://img.shields.io/github/license/CuteReimu/th-bingo)](https://github.com/CuteReimu/th-bingo/blob/master/LICENSE "许可协议")

## 使用

需要提前安装Java环境(建议Java 17)

```shell
./gradlew run
```
Expand Down Expand Up @@ -41,27 +40,3 @@
协议与`org.tfcc.bingo.message`下的类(`Dispatcher.kt``Handler.kt``Message.kt`除外)一一对应。

例如`"name": "error_sc"`对应ErrorSc

## 把比赛推送到QQ群

通过 [mirai-http-api](https://github.com/project-mirai/mirai-api-http)
**Http Adapter** 将比赛内容推送到QQ群。因此需要首先自行使用 [mirai](https://github.com/mamoe/mirai) 登录QQ。

第一次运行会生成配置文件 `application.properties`,修改后重启即可

```properties
# 推送至少间隔时间(分)
push_interval=10
# 是否开启推送功能
enable_push=true
# bingo比赛的房间url
self_room_addr=http://127.0.0.1:9961/room
# 机器人的QQ号
robot_qq=12345678
# 要推送到的QQ群号
push_qq_groups=12345678,12345678
# mirai-http-api监听的http端口
mirai_http_url=http://127.0.0.1:8080
# mirai-http-api的verifyKey
mirai_verify_key=XXXXXXXX
```
121 changes: 0 additions & 121 deletions src/main/kotlin/MiraiPusher.kt

This file was deleted.

1 change: 0 additions & 1 deletion src/main/kotlin/Room.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Room(
val score = intArrayOf(0, 0) // 比分
var games: Array<String> = arrayOf("6", "7", "8", "10", "11", "12", "13", "14", "15", "16", "17", "18")
var ranks: Array<String>? = null
var isPrivate: Boolean = false
var locked = false // 连续多局就需要锁上
var needWin: Int = 0 // 需要赢几局才算赢
var cdTime = 30
Expand Down
3 changes: 0 additions & 3 deletions src/main/kotlin/message/RoomConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class RoomConfig(
val ranks: Array<String>?,
val needWin: Int?,
val difficulty: Int?,
val isPrivate: Boolean?,
val cdTime: Int?, // 选卡cd,收卡后要多少秒才能选下一张卡
val reservedType: Int?, // 纯客户端用的一个类型字段
) {
Expand Down Expand Up @@ -41,7 +40,6 @@ class RoomConfig(
ranks?.let { room.ranks = it }
needWin?.let { room.needWin = it.coerceAtLeast(1) }
difficulty?.let { room.difficulty = it }
isPrivate?.let { room.isPrivate = it }
cdTime?.let { room.cdTime = it }
reservedType?.let { room.reservedType = it }
}
Expand All @@ -54,7 +52,6 @@ class RoomConfig(
ranks = room.ranks,
needWin = room.needWin,
difficulty = room.difficulty,
isPrivate = room.isPrivate,
cdTime = room.cdTime,
reservedType = room.reservedType,
)
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/message/StartGameCs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,5 @@ class StartGameCs : Handler {
)
)
)
if (!room.isPrivate && !room.players.contains(Store.robotPlayer.token)) // 单人练习模式不推送
MiraiPusher.push(room)
}
}

0 comments on commit b45b9d3

Please sign in to comment.