@irfanshadikrishad/anilist 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -575,11 +575,12 @@ class Social {
575
575
  */
576
576
  static follow() {
577
577
  return __awaiter(this, void 0, void 0, function* () {
578
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
578
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
579
579
  try {
580
580
  let pager = 1;
581
581
  let hasNextPage = true;
582
582
  let allFollowerUsers = [];
583
+ let followedBack = 0;
583
584
  spinner.start("Fetching all the followers...");
584
585
  while (hasNextPage) {
585
586
  const followerUsers = yield fetcher(userFollowersQuery, {
@@ -612,12 +613,16 @@ class Social {
612
613
  console.log(`${String(`[${nf.id}]`).padEnd(maxIdLength)}` +
613
614
  `\t${String(`[${(_k = (_j = follow === null || follow === void 0 ? void 0 : follow.data) === null || _j === void 0 ? void 0 : _j.ToggleFollow) === null || _k === void 0 ? void 0 : _k.name}]`).padEnd(maxNameLength)}` +
614
615
  `\t${((_m = (_l = follow === null || follow === void 0 ? void 0 : follow.data) === null || _l === void 0 ? void 0 : _l.ToggleFollow) === null || _m === void 0 ? void 0 : _m.id) ? "āœ…" : "🈵"}`);
616
+ // Count the followed back users
617
+ if ((_p = (_o = follow === null || follow === void 0 ? void 0 : follow.data) === null || _o === void 0 ? void 0 : _o.ToggleFollow) === null || _p === void 0 ? void 0 : _p.id) {
618
+ followedBack++;
619
+ }
615
620
  }
616
621
  catch (error) {
617
622
  console.log(`automate_follow_toggle_follow: ${error.message}`);
618
623
  }
619
624
  }
620
- console.log(`\nāœ… Followed back ${notFollowing.length} users.`);
625
+ console.log(`\nāœ… Followed back ${followedBack} users.`);
621
626
  }
622
627
  catch (error) {
623
628
  console.log(`\nautomate_follow ${error.message}`);
@@ -629,18 +634,19 @@ class Social {
629
634
  */
630
635
  static unfollow() {
631
636
  return __awaiter(this, void 0, void 0, function* () {
632
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
637
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
633
638
  try {
634
639
  let pager = 1;
635
640
  let hasNextPage = true;
636
641
  let allFollowingUsers = [];
642
+ let unfollowedUsers = 0;
637
643
  spinner.start("Fetching all following users...");
638
644
  while (hasNextPage) {
639
645
  const followingUsers = yield fetcher(userFollowingQuery, {
640
646
  userId: yield Auth.MyUserId(),
641
647
  page: pager,
642
648
  });
643
- spinner.update(`Fetched page ${pager} of ${(_c = (_b = (_a = followingUsers === null || followingUsers === void 0 ? void 0 : followingUsers.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.pageInfo) === null || _c === void 0 ? void 0 : _c.lastPage} ...`);
649
+ spinner.update(`Fetched page ${pager} of ${(_c = (_b = (_a = followingUsers === null || followingUsers === void 0 ? void 0 : followingUsers.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.pageInfo) === null || _c === void 0 ? void 0 : _c.lastPage}...`);
644
650
  if (!((_f = (_e = (_d = followingUsers === null || followingUsers === void 0 ? void 0 : followingUsers.data) === null || _d === void 0 ? void 0 : _d.Page) === null || _e === void 0 ? void 0 : _e.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage)) {
645
651
  hasNextPage = false;
646
652
  }
@@ -653,8 +659,7 @@ class Social {
653
659
  .filter((user) => !user.isFollower)
654
660
  .map((u3r) => ({ id: u3r.id, name: u3r.name }));
655
661
  if (notFollowingMe.length <= 0) {
656
- console.warn(`\nNot following list is empty!`);
657
- spinner.stop(`No users to unfollow. Aborting process...`);
662
+ spinner.stop(`No users to unfollow. Exiting operation...`);
658
663
  return;
659
664
  }
660
665
  spinner.stop(`Unfollow process activated with ${notFollowingMe.length} users.`);
@@ -667,12 +672,16 @@ class Social {
667
672
  userId: nfm.id,
668
673
  });
669
674
  console.log(`[${nfm.id}]\t[${(_k = (_j = unfollow === null || unfollow === void 0 ? void 0 : unfollow.data) === null || _j === void 0 ? void 0 : _j.ToggleFollow) === null || _k === void 0 ? void 0 : _k.name}]\t${((_m = (_l = unfollow === null || unfollow === void 0 ? void 0 : unfollow.data) === null || _l === void 0 ? void 0 : _l.ToggleFollow) === null || _m === void 0 ? void 0 : _m.id) ? "āœ…" : "🈵"}`);
675
+ // Count the unfollowed users
676
+ if ((_p = (_o = unfollow === null || unfollow === void 0 ? void 0 : unfollow.data) === null || _o === void 0 ? void 0 : _o.ToggleFollow) === null || _p === void 0 ? void 0 : _p.id) {
677
+ unfollowedUsers++;
678
+ }
670
679
  }
671
680
  catch (error) {
672
681
  console.log(`unfollow_toggle_follow. ${error.message}`);
673
682
  }
674
683
  }
675
- console.log(`\nTotal Unfollowed: ${nfmCount}`);
684
+ console.log(`\nTotal Unfollowed: ${unfollowedUsers} of ${nfmCount} users.`);
676
685
  }
677
686
  catch (error) {
678
687
  console.error(`\nautomate_unfollow: ${error.message}`);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@irfanshadikrishad/anilist",
3
3
  "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
4
  "author": "Irfan Shadik Rishad",
5
- "version": "1.2.11",
5
+ "version": "1.2.13",
6
6
  "main": "./bin/index.js",
7
7
  "type": "module",
8
8
  "types": "./bin/index.d.ts",