This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* シートに記載された人をアンフォロー | |
*/ | |
function unFollowFromSheet () { | |
const ignoreUserIds = ['123456789','987654321']; | |
// 1列目に書かれたIDからユーザー情報を取得する | |
const userIds = TwitterClient.getUserIdsFromSheet('シート1'); | |
// indexOf()とspliceを使う方法 | |
for (let i in userIds) { | |
// ignoreUserIds に取得したuserIdが含まれていたらuserIdsから除外する | |
if (ignoreUserIds.indexOf(userIds[i].toString()) !== -1) { | |
userIds.splice(i, 1); | |
} | |
} | |
// // この方法でもOK | |
// // このeditUserIdsを destroyFollowに入れる | |
// const editUserIds = []; | |
// for (let i in userIds) { | |
// // チェックしてOKだったものを入れる | |
// if (ignoreUserIds.indexOf(userIds[i].toString()) === -1) { | |
// editUserIds.push(userIds[i]); | |
// } | |
// } | |
// // こんな方法もある | |
// // ※ editUserIdsを destroyFollowに入れる | |
// const editUserIds = userIds.filter(function(userId){ | |
// return ignoreUserIds.indexOf(userId.toString()) === -1 | |
// }); | |
client.destroyFollow(userIds) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment