Greasy Fork is available in English.

抽奖动态删除&取关

删除所有抽奖动态并自动取关

< Commentaires sur 抽奖动态删除&取关

Avis: Bon - le script fonctionne correctement

§
Posté le: 2022-06-08

脚本一切正常,希望能添加删除两个月之前的动态的选项。因为抽奖动态超过两个月时间就过期了

mscststsAuteur
§
Posté le: 2022-06-09

interesting

§
Posté le: 2023-11-28

// 在循环中处理动态的地方
for (let card of data.cards) {
offset = card.desc.dynamic_id_str;

// 获取动态的创建时间戳
let createTimeStamp = card.desc.timestamp;

// 计算当前时间和动态创建时间的差距,以天为单位
let daysAgo = Math.floor((Date.now() - createTimeStamp * 1000) / (24 * 60 * 60 * 1000));

// 判断动态是否在60天之前
if (daysAgo > 60) {
// 以下是原有的删除动态的逻辑
try {
let content = JSON.parse(card.card);
if (content.origin_extension && content.origin_extension.lott && content.origin_extension.lott.indexOf("lottery_id") >= 0) {
// 是互动抽奖
// 删除动态
let rm = await api.rm_dynamic(card.desc.dynamic_id_str);
if (rm.code === 0) {
// 删除成功
deleteCount++;
} else {
throw new Error("删除出错");
}
await mscststs.sleep(50); // 延时
log(`已删除 ${deleteCount} 条`);
}
} catch (e) {
console.log(e);
break;
}
}
}

Poster une réponse

Connectez-vous pour poster une réponse.