Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta497 #503

Merged
merged 53 commits into from
Oct 13, 2024
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a6ebe57
beta447
Hoshinonyaruko Jun 29, 2024
1d63fae
beta448
Hoshinonyaruko Jul 1, 2024
cd34627
beta449
Hoshinonyaruko Jul 4, 2024
b790b29
beta450
Hoshinonyaruko Jul 4, 2024
7a9b56a
beta451
Hoshinonyaruko Jul 4, 2024
e17d0d4
beta452
Hoshinonyaruko Jul 4, 2024
1318175
beta453
Hoshinonyaruko Jul 4, 2024
b7f291c
beta454
Hoshinonyaruko Jul 4, 2024
f921895
beta455
Hoshinonyaruko Jul 9, 2024
24108c6
btea455
Hoshinonyaruko Jul 9, 2024
7cdc968
beta456
Hoshinonyaruko Jul 9, 2024
b5d784e
beta457
Hoshinonyaruko Jul 9, 2024
61e4001
beta458
Hoshinonyaruko Jul 9, 2024
6d4116a
beta460
Hoshinonyaruko Jul 9, 2024
2c1f1b7
beta460
Hoshinonyaruko Jul 11, 2024
5c312cd
beta461
Hoshinonyaruko Jul 12, 2024
58304eb
beta462
Hoshinonyaruko Jul 13, 2024
7e7c9f3
beta463
Hoshinonyaruko Jul 15, 2024
188f250
beta464
Hoshinonyaruko Jul 15, 2024
af0296d
beta465
Hoshinonyaruko Jul 18, 2024
500135c
beta467
Hoshinonyaruko Jul 21, 2024
c1a588c
beta468
Hoshinonyaruko Jul 21, 2024
1df8e15
beta469
Hoshinonyaruko Jul 21, 2024
f57ab7b
beta470
Hoshinonyaruko Jul 26, 2024
cd21ad9
beta471
Hoshinonyaruko Aug 1, 2024
6039272
beta472
Hoshinonyaruko Aug 1, 2024
c45b450
beta473
Hoshinonyaruko Aug 1, 2024
f89d6c5
beta473
Hoshinonyaruko Aug 3, 2024
b54fdee
beta475
Hoshinonyaruko Aug 5, 2024
a30a697
beta476
Hoshinonyaruko Aug 8, 2024
ab805cc
beta478
Hoshinonyaruko Aug 8, 2024
6debefd
beta479
Hoshinonyaruko Aug 17, 2024
9cc7e5d
beta479
Hoshinonyaruko Aug 17, 2024
c0fe93c
beta480
Hoshinonyaruko Aug 18, 2024
91cf223
beta481
Hoshinonyaruko Aug 18, 2024
a3aa6c1
beta482
Hoshinonyaruko Aug 18, 2024
0917e56
beta483
Hoshinonyaruko Aug 19, 2024
dd1f774
beta484
Hoshinonyaruko Aug 19, 2024
1c87d61
beta485
Hoshinonyaruko Aug 20, 2024
aac474a
beta486
Hoshinonyaruko Aug 20, 2024
2604eb7
beta486
Hoshinonyaruko Aug 20, 2024
76377be
beta487
Hoshinonyaruko Aug 20, 2024
cb095ec
beta487
Hoshinonyaruko Aug 20, 2024
34c92ae
beta489
Hoshinonyaruko Aug 21, 2024
288cf7a
beta490
Hoshinonyaruko Aug 22, 2024
d3a6eb8
beta491
Hoshinonyaruko Aug 22, 2024
b2de7c5
beta492
Hoshinonyaruko Oct 13, 2024
ec68fb1
beta492-1
Hoshinonyaruko Oct 13, 2024
f4d9229
beta494
Hoshinonyaruko Oct 13, 2024
def45ca
beta495
Hoshinonyaruko Oct 13, 2024
6eb3027
beta496
Hoshinonyaruko Oct 13, 2024
81f3aed
beta497
Hoshinonyaruko Oct 13, 2024
9802144
Merge branch 'main' into beta497
Hoshinonyaruko Oct 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/cross_compile.yml
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ jobs:
go build -ldflags="-s -w" -o output/gensokyo-${{ matrix.os }}-${{ matrix.goarch }}
fi

- name: Compress executable files with UPX (except for gensokyo-android-arm64 and macOS)
- name: Compress executable files with UPX (except for gensokyo-android-arm64 and darwin)
run: |
sudo apt-get update
sudo apt-get install -y upx
@@ -109,7 +109,7 @@ jobs:
else
FILENAME="output/gensokyo-${{ matrix.os }}-${{ matrix.goarch }}"
fi
if [[ "${{ matrix.os }}" == "android" && "${{ matrix.goarch }}" == "arm64" ]] || [[ "${{ matrix.os }}" == "macos" ]]; then
if [[ "${{ matrix.os }}" == "android" && "${{ matrix.goarch }}" == "arm64" ]] || [[ "${{ matrix.os }}" == "darwin" ]]; then
echo "Skipping UPX compression for $FILENAME"
else
upx --best --lzma "$FILENAME"
@@ -126,7 +126,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: output

62 changes: 56 additions & 6 deletions handlers/message_parser.go
Original file line number Diff line number Diff line change
@@ -571,11 +571,36 @@ func parseMessageContent(paramsMessage callapi.ParamsContent, message callapi.Ac

case "voice", "record":
fileContent, _ := segmentMap["data"].(map[string]interface{})["file"].(string)
foundItems["record"] = append(foundItems["record"], fileContent)

// 检查是否为 Base64 语音文件
if strings.HasPrefix(fileContent, "base64://") {
cleanContent := strings.TrimPrefix(fileContent, "base64://")
foundItems["base64_record"] = append(foundItems["base64_record"], cleanContent)
} else if strings.HasPrefix(fileContent, "http://") {
// HTTP 语音文件
cleanContent := strings.TrimPrefix(fileContent, "http://")
foundItems["url_record"] = append(foundItems["url_record"], cleanContent)
} else if strings.HasPrefix(fileContent, "https://") {
// HTTPS 语音文件
cleanContent := strings.TrimPrefix(fileContent, "https://")
foundItems["url_records"] = append(foundItems["url_records"], cleanContent)
} else if strings.HasPrefix(fileContent, "file://") {
// 本地文件,根据系统区分前缀
var cleanContent string
if runtime.GOOS == "windows" {
cleanContent = strings.TrimPrefix(fileContent, "file:///")
} else {
cleanContent = strings.TrimPrefix(fileContent, "file://")
}
foundItems["local_record"] = append(foundItems["local_record"], cleanContent)
} else {
// 无法识别的类型,直接存储
foundItems["unknown_record"] = append(foundItems["unknown_record"], fileContent)
}

case "at":
qqNumber, _ := segmentMap["data"].(map[string]interface{})["qq"].(string)
foundItems["at"] = append(foundItems["at"], qqNumber)
messageText += "[CQ:at,qq=" + qqNumber + "]"

case "avatar":
qqNumber, _ := segmentMap["data"].(map[string]interface{})["qq"].(string)
@@ -585,7 +610,7 @@ func parseMessageContent(paramsMessage callapi.ParamsContent, message callapi.Ac
} else {
avatarCQCode, _ = GetAvatarCQCode(paramsMessage.GroupID.(string), qqNumber)
}
foundItems["avatar"] = append(foundItems["avatar"], avatarCQCode)
messageText += avatarCQCode

case "markdown":
mdContent, ok := segmentMap["data"].(map[string]interface{})["data"]
@@ -678,11 +703,36 @@ func parseMessageContent(paramsMessage callapi.ParamsContent, message callapi.Ac

case "voice", "record":
fileContent, _ := message["data"].(map[string]interface{})["file"].(string)
foundItems["record"] = append(foundItems["record"], fileContent)

// 检查是否为 Base64 语音文件
if strings.HasPrefix(fileContent, "base64://") {
cleanContent := strings.TrimPrefix(fileContent, "base64://")
foundItems["base64_record"] = append(foundItems["base64_record"], cleanContent)
} else if strings.HasPrefix(fileContent, "http://") {
// HTTP 语音文件
cleanContent := strings.TrimPrefix(fileContent, "http://")
foundItems["url_record"] = append(foundItems["url_record"], cleanContent)
} else if strings.HasPrefix(fileContent, "https://") {
// HTTPS 语音文件
cleanContent := strings.TrimPrefix(fileContent, "https://")
foundItems["url_records"] = append(foundItems["url_records"], cleanContent)
} else if strings.HasPrefix(fileContent, "file://") {
// 本地文件,根据系统区分前缀
var cleanContent string
if runtime.GOOS == "windows" {
cleanContent = strings.TrimPrefix(fileContent, "file:///")
} else {
cleanContent = strings.TrimPrefix(fileContent, "file://")
}
foundItems["local_record"] = append(foundItems["local_record"], cleanContent)
} else {
// 无法识别的类型,直接存储
foundItems["unknown_record"] = append(foundItems["unknown_record"], fileContent)
}

case "at":
qqNumber, _ := message["data"].(map[string]interface{})["qq"].(string)
foundItems["at"] = append(foundItems["at"], qqNumber)
messageText += "[CQ:at,qq=" + qqNumber + "]"

case "avatar":
qqNumber, _ := message["data"].(map[string]interface{})["qq"].(string)
@@ -692,7 +742,7 @@ func parseMessageContent(paramsMessage callapi.ParamsContent, message callapi.Ac
} else {
avatarCQCode, _ = GetAvatarCQCode(paramsMessage.GroupID.(string), qqNumber)
}
foundItems["avatar"] = append(foundItems["avatar"], avatarCQCode)
messageText += avatarCQCode

case "markdown":
mdContent, ok := message["data"].(map[string]interface{})["data"]
Loading