INNER CODE UNIT · TypeScript
onImageLiked
mifi/instauto · src/index.ts:335
async function onImageLiked({ username, href }: { username: string; href: string }) {
await addLikedPhoto({ username, href, time: Date.now() });
}
function getNumFollowedUsersThisTimeUnit(timeUnit: number) {
const now = Date.now();
return getPrevFollowedUsers().filter((u) => now - u.time < timeUnit).length
+ getPrevUnfollowedUsers().filter((u) => !u.noActionTaken && now - u.time < timeUnit).length;
}
async function checkReachedFollowedUserDayLimit() {
if (getNumFollowedUsersThisTimeUnit(dayMs) >= maxFollowsPerDay) {
logger.log('Have reached daily follow/unfollow limit, waiting 10 min');
await sleep(10 * 60 * 1000);
}
}