mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 新增#清理data垃圾,清除云崽产生的垃圾
This commit is contained in:
parent
cc2b80682a
commit
fa23cd27f1
@ -29,15 +29,15 @@ export class tools extends plugin {
|
||||
fnc: "trans",
|
||||
},
|
||||
{
|
||||
reg: "(.*)(v.douyin.com)",
|
||||
reg: "(v.douyin.com)",
|
||||
fnc: "douyin",
|
||||
},
|
||||
{
|
||||
reg: "(.*)(www.tiktok.com)|(vt.tiktok.com)|(vm.tiktok.com)",
|
||||
reg: "(www.tiktok.com)|(vt.tiktok.com)|(vm.tiktok.com)",
|
||||
fnc: "tiktok",
|
||||
},
|
||||
{
|
||||
reg: "(.*)(bilibili.com|b23.tv|t.bilibili.com)",
|
||||
reg: "(bilibili.com|b23.tv|t.bilibili.com)",
|
||||
fnc: "bili",
|
||||
},
|
||||
{
|
||||
@ -53,7 +53,7 @@ export class tools extends plugin {
|
||||
fnc: "tx",
|
||||
},
|
||||
{
|
||||
reg: "(.*)(acfun.cn)",
|
||||
reg: "(acfun.cn)",
|
||||
fnc: "acfun",
|
||||
},
|
||||
{
|
||||
@ -61,9 +61,14 @@ export class tools extends plugin {
|
||||
fnc: "redbook",
|
||||
},
|
||||
{
|
||||
reg: "(.*)(doi.org)",
|
||||
reg: "(doi.org)",
|
||||
fnc: "literature",
|
||||
},
|
||||
{
|
||||
reg: "^#清理data垃圾$",
|
||||
fnc: "clearTrash",
|
||||
permission: "master",
|
||||
}
|
||||
],
|
||||
});
|
||||
// http://api.tuwei.space/girl
|
||||
@ -616,6 +621,25 @@ export class tools extends plugin {
|
||||
});
|
||||
}
|
||||
|
||||
// 清理垃圾文件
|
||||
async clearTrash(e) {
|
||||
const directory = './data/';
|
||||
try {
|
||||
fs.readdir(directory, (err, files) => {
|
||||
for (const file of files) {
|
||||
// 如果文件名符合规则,执行删除操作
|
||||
if (/^[0-9a-f]{32}$/.test(file)) {
|
||||
fs.unlinkSync(directory + file);
|
||||
}
|
||||
}
|
||||
});
|
||||
await e.reply(`清理完成!`);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
e.reply("清理失败,重试或者自动清理即可")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 哔哩哔哩下载
|
||||
* @param title
|
||||
|
Loading…
x
Reference in New Issue
Block a user