Merge pull request #48 from nikoyoke1/master

🐞 fix: 修复解析后发送语音错误
This commit is contained in:
Zhiyu 2024-11-08 21:04:11 +08:00 committed by GitHub
commit b287cfa535
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 157 additions and 157 deletions

View File

@ -19,7 +19,7 @@ export class songRequest extends plugin {
priority: 300, priority: 300,
rule: [ rule: [
{ {
reg: '^#?点歌|#?听[1-9][0-9]*|#?听[1-9]*$', reg: '^#点歌|#?听[1-9][0-9]*|#?听[1-9]*$',
fnc: 'pickSong' fnc: 'pickSong'
}, },
{ {
@ -362,12 +362,12 @@ export class songRequest extends plugin {
} }
// 发送群文件 // 发送群文件
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
// 删除文件
await checkAndRemoveFile(path);
// 发送语音 // 发送语音
if (musicExt != 'mp4' && this.isSendVocal) { if (musicExt != 'mp4' && this.isSendVocal) {
await e.reply(segment.record(path)); await e.reply(segment.record(path));
} }
// 删除文件
await checkAndRemoveFile(path);
} }
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${err}`); logger.error(`下载音乐失败,错误信息为: ${err}`);

View File

@ -1841,12 +1841,12 @@ export class tools extends plugin {
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => { downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => {
// 发送群文件 // 发送群文件
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
// 删除文件
await checkAndRemoveFile(path);
// 发送语音 // 发送语音
if (musicExt != 'mp4' && this.isSendVocal) { if (musicExt != 'mp4' && this.isSendVocal) {
await e.reply(segment.record(path)); await e.reply(segment.record(path));
} }
// 删除文件
await checkAndRemoveFile(path);
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${err}`); logger.error(`下载音乐失败,错误信息为: ${err}`);
}); });