mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
🦄 reactor: 优化获取引用信息的方法
This commit is contained in:
parent
e43018e3fa
commit
b186eebc11
@ -9,7 +9,7 @@ import { COMMON_USER_AGENT, REDIS_YUNZAI_ISOVERSEA, REDIS_YUNZAI_SONGINFO, REDIS
|
||||
import { downloadAudio, retryAxiosReq } from "../utils/common.js";
|
||||
import { redisExistKey, redisGetKey, redisSetKey } from "../utils/redis-util.js";
|
||||
import { checkAndRemoveFile, checkFileExists, splitPaths } from "../utils/file.js";
|
||||
import { sendMusicCard, getGroupFileUrl } from "../utils/yunzai-util.js";
|
||||
import { sendMusicCard, getGroupFileUrl, getReplyMsg } from "../utils/yunzai-util.js";
|
||||
import config from "../model/config.js";
|
||||
import FormData from 'form-data';
|
||||
import NodeID3 from 'node-id3';
|
||||
@ -289,7 +289,8 @@ export class songRequest extends plugin {
|
||||
|
||||
// 上传音频文件
|
||||
async upLoad(e) {
|
||||
let msg = await e?.getReply();
|
||||
let msg = await getReplyMsg(e)
|
||||
logger.info('msglist=====', msgList)
|
||||
const musicUrlReg = /(http:|https:)\/\/music.163.com\/song\/media\/outer\/url\?id=(\d+)/;
|
||||
const musicUrlReg2 = /(http:|https:)\/\/y.music.163.com\/m\/song\?(.*)&id=(\d+)/;
|
||||
const musicUrlReg3 = /(http:|https:)\/\/music.163.com\/m\/song\/(\d+)/;
|
||||
@ -314,7 +315,7 @@ export class songRequest extends plugin {
|
||||
|
||||
// 上传云盘
|
||||
async uploadCloud(e) {
|
||||
let msg = await e?.getReply();
|
||||
let msg = await getReplyMsg(e)
|
||||
const autoSelectNeteaseApi = await this.pickApi()
|
||||
const musicUrlReg = /(http:|https:)\/\/music.163.com\/song\/media\/outer\/url\?id=(\d+)/;
|
||||
const musicUrlReg2 = /(http:|https:)\/\/y.music.163.com\/m\/song\?(.*)&id=(\d+)/;
|
||||
|
@ -109,3 +109,19 @@ export async function getGroupFileUrl(e, count = 10) {
|
||||
|
||||
return { cleanPath, file_id };
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群回复
|
||||
* @param e
|
||||
*/
|
||||
export async function getReplyMsg(e) {
|
||||
const msgList = await e.bot.sendApi("get_group_msg_history", {
|
||||
"group_id": e.group_id,
|
||||
"count": 1
|
||||
});
|
||||
let msgId = msgList.data.messages[0]?.message[0]?.data.id
|
||||
let msg = await e.bot.sendApi("get_msg",{
|
||||
"message_id" : msgId
|
||||
})
|
||||
return msg.data
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user