feat: support av code parse and use regex to match bv and av code instead of string split

This commit is contained in:
2024-10-07 12:16:51 +08:00
parent 2b725ab71e
commit ed85575e14
3 files changed
+48 -21

No files matched your search

@@ -59,6 +59,7 @@ class FancyBot : OneBotListener {
ReverseGIFCommand.callback(message)
AsciiArtCommand.callback(message)
ScanQRCodeCommand.callback(message)
BVParseCommand.parse(this, message)
if (message.rawMessage.toList().any { it in arrayListOf('*', '-', '/', '+', '=') }) {
val calculateResult = CalculateCommand.parse(message.rawMessage)
@@ -80,12 +81,6 @@ class FancyBot : OneBotListener {
GitHubParseCommand.parse(message, user, repo)
}
if (message.rawMessage.startsWith("BV") ||
message.rawMessage.startsWith("https://www.bilibili.com") ||
message.rawMessage.contains("https://b23.tv/") ||
message.message.find { it.type == ArrayMessageType.json } != null
) BVParseCommand.parse(this, message)
coroutineScope.launch {
message.message.forEach {
if (it.type == ArrayMessageType.image) {