-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修复在反向ws模式下,由于重新设置wrapper时的作用域问题导致无法获取好友列表的问题 (#97)
* fix: 🐛 修复反向ws,bot重新连接时,由于wrapper impl设置错误导致无法获取新bot的bug feat: ✨ 为OneBot库添加测试时日志支持 * fix: 🐛 修复测试api引入错误问题 * build: ➖ 将logback挪到testImpl
- Loading branch information
Showing
7 changed files
with
93 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="debug"> | ||
<appender-ref ref="STDOUT"/> | ||
</root> | ||
<logger name="org.eclipse.jetty" level="INFO"/> | ||
<logger name="io.netty" level="INFO"/> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import kotlinx.coroutines.runBlocking | ||
import net.mamoe.mirai.event.events.GroupMessageEvent | ||
import net.mamoe.mirai.event.syncFromEvent | ||
import org.junit.jupiter.api.Test | ||
import top.mrxiaom.overflow.BotBuilder | ||
|
||
class OverFlowTest { | ||
@Test | ||
fun `should be reconnect successfully`(): Unit = runBlocking { | ||
val builder = BotBuilder.reversed(3001) | ||
|
||
while (true) { | ||
println("等待连接中...") | ||
val bot = builder.connect() | ||
if (bot !== null) { | ||
println("新bot加入连接:${bot}") | ||
//确保重新连接后event可以正常接收 | ||
//这里建议使用GlobalEventChannel避免重复注册的问题 | ||
bot.eventChannel.subscribeAlways<GroupMessageEvent> { | ||
println(it) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters