noticeUwuzu/scripts/follow/unfollow.ts

35 lines
912 B
TypeScript

import config from "../../config.js";
import { meApi } from "types/types.js";
export default async function unFollowBack() {
const profile: meApi = await
(await fetch(`https://${config.uwuzu.host}/api/me/`, {
method: "POST",
body: JSON.stringify({
token: config.uwuzu.apiToken,
})
})).json();
for (let i = 0; i < profile.followee.length; i++) {
const followUser = profile.followee[i];
if (
profile.follower.indexOf(followUser) === -1
) {
setTimeout(async () => {
const req = await fetch(`https://${config.uwuzu.host}/api/users/unfollow/`, {
method: "POST",
body: JSON.stringify({
token: config.uwuzu.apiToken,
userId: followUser,
}),
});
const res = await req.text();
console.log(`フォロー解除: ${res}`)
}, 100);
}
}
}