v6.5(LTS)をリリース
This commit is contained in:
+20
-18
@@ -7,36 +7,38 @@ export default async function followBack() {
|
||||
|
||||
// フォロワーを取得
|
||||
const resMe = await fetch(
|
||||
`https://${config.uwuzu.host}/api/me?token=${config.uwuzu.apiToken}`,
|
||||
`https://${config.uwuzu.host}/api/me/`,
|
||||
{
|
||||
method: "GET",
|
||||
// uwuzu v1.5.4で/api/meのPOSTが死んでいるため簡易的にGET
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
token: config.uwuzu.apiToken,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const meData: types.meApi = await resMe.json();
|
||||
|
||||
console.log(`BOTプロフィール:${JSON.stringify(meData)}`);
|
||||
|
||||
const followers: Array<string> = meData.follower;
|
||||
const followers = meData.follower;
|
||||
|
||||
// フォロー
|
||||
for (let i = 0; i < followers.length; i++) {
|
||||
const followerItem = followers[i];
|
||||
|
||||
const resFollow = await fetch(
|
||||
`https://${config.uwuzu.host}/api/users/follow`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
token: config.uwuzu.apiToken,
|
||||
userid: followerItem,
|
||||
}),
|
||||
},
|
||||
);
|
||||
setTimeout(async () => {
|
||||
const resFollow = await fetch(
|
||||
`https://${config.uwuzu.host}/api/users/follow/`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
token: config.uwuzu.apiToken,
|
||||
userid: followerItem,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const followData: types.followApi = await resFollow.json();
|
||||
const followData: types.followApi = await resFollow.json();
|
||||
|
||||
console.log(`フォロー:${JSON.stringify(followData)}`);
|
||||
console.log(`フォロー:${JSON.stringify(followData)}`);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-12
@@ -3,25 +3,32 @@ import { meApi } from "types/types.js";
|
||||
|
||||
export default async function unFollowBack() {
|
||||
const profile: meApi = await
|
||||
(await fetch(`https://${config.uwuzu.host}/api/me`, {
|
||||
(await fetch(`https://${config.uwuzu.host}/api/me/`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
token: config.uwuzu.apiToken,
|
||||
})
|
||||
})).json();
|
||||
|
||||
profile.followee.forEach(async (followUser: string) => {
|
||||
for (let i = 0; i < profile.followee.length; i++) {
|
||||
const followUser = profile.followee[i];
|
||||
|
||||
if (
|
||||
profile.follower[followUser] === undefined ||
|
||||
profile.follower[followUser] === null
|
||||
profile.follower.indexOf(followUser) === -1
|
||||
) {
|
||||
await fetch(`https://${config.uwuzu.host}/api/users/unfollow`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
token: config.uwuzu.apiToken,
|
||||
userId: followUser,
|
||||
}),
|
||||
})
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user