Feature: Remove torrent

master
masterhc 9 months ago
parent b4836b36ae
commit b152eedffc

@ -478,7 +478,6 @@ exports.torrent = (bot)=>
{ {
collector.stop(); collector.stop();
m.deferUpdate(); m.deferUpdate();
if(m.customId === 'Remove'+random) return m.message.delete();
let cookie = await fetch('https://utorrent.wordfights.com/api/v2/auth/login', let cookie = await fetch('https://utorrent.wordfights.com/api/v2/auth/login',
{ {
"headers": "headers":
@ -503,11 +502,28 @@ exports.torrent = (bot)=>
} }
} }
if(!cookie) return if(!cookie) return
if(m.customId === 'Remove'+random)
{
await fetch("https://utorrent.wordfights.com/api/v2/torrents/delete", {
"headers": {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"cookie":cookie,
},
"referrerPolicy": "same-origin",
"body": `hashes=${req.params.id}&deleteFiles=false`,
"method": "POST",
"mode": "cors",
"credentials": "include"
});
return m.message.delete();
}
await fetch("https://utorrent.wordfights.com/api/v2/torrents/setForceStart", { await fetch("https://utorrent.wordfights.com/api/v2/torrents/setForceStart", {
"headers": { "headers": {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8", "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"cookie": `${cookie}`, "cookie": cookie,
}, },
"body": `value=true&hashes=${req.params.id}`, "body": `value=true&hashes=${req.params.id}`,
"method": "POST" "method": "POST"

Loading…
Cancel
Save