🦄 reactor: 优化触发词

This commit is contained in:
秋刀鱼 2024-11-13 16:34:16 +08:00
parent 9962676498
commit 40ea2c01ea

View File

@ -57,7 +57,7 @@ export class songRequest extends plugin {
permission: 'master' permission: 'master'
}, },
{ {
reg: '^#?获取群文件$', reg: '^#?群文件上传云盘$|#rngu|#RNGU',
fnc: 'getLatestDocument', fnc: 'getLatestDocument',
permission: 'master' permission: 'master'
} }
@ -411,17 +411,15 @@ export class songRequest extends plugin {
async getLatestDocument(e) { async getLatestDocument(e) {
const autoSelectNeteaseApi = await this.pickApi() const autoSelectNeteaseApi = await this.pickApi()
const cleanPath = await getGroupFileUrl(e) const cleanPath = await getGroupFileUrl(e)
logger.info(cleanPath)
// 拓展名 // 拓展名
const extension = cleanPath.match(/\.\w+$/); const extension = cleanPath.match(/\.\w+$/);
// 获取文件路径 // 获取文件路径
const dirPath = cleanPath.substring(0, cleanPath.lastIndexOf('/')); const dirPath = cleanPath.substring(0, cleanPath.lastIndexOf('/'));
// 获取文件名 // 获取文件名
const fileName = cleanPath.split('/').pop().replace(/\.\w+$/, ''); const fileName = cleanPath.split('/').pop().replace(/\.\w+$/, '');
logger.info(fileName) // 进行文件名拆解
const parts = fileName.trim().match(/^([\s\S]+)\s*-\s*([\s\S]+)$/); const parts = fileName.trim().match(/^([\s\S]+)\s*-\s*([\s\S]+)$/);
logger.info(parts) const newFileName = dirPath + '/' + parts[2].replace(/^\s+|\s+$/g, '') + extension
const newFileName = dirPath + '/' + parts[2].trim() + extension
// 进行元数据编辑 // 进行元数据编辑
if (parts) { if (parts) {
const tags = { const tags = {