@irfanshadikrishad/anilist 1.2.3 → 1.3.0-forbidden.1

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.
package/README.md CHANGED
@@ -48,14 +48,14 @@ anilist login -i <client-id> -s <client-secret>
48
48
  | ------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------ |
49
49
  | **`login`** | `-i, --id` `-s, --secret` | Log in with your AniList credentials |
50
50
  | **`logout`** | _None_ | Log out from your AniList account |
51
- | **`me`** | _None_ | Display information about the logged-in user |
51
+ | **`whoami`** | _None_ | Display information about the logged-in user |
52
52
  | **`-V, --version`** | _None_ | Display the current version of the CLI |
53
53
  | **`-h, --help`** | _None_ | Display available commands and options |
54
54
  | **`trending`** <br> _(alias: `tr`)_ | `-c (default: 10)` | Fetch trending anime (default count is 10) |
55
55
  | **`popular`** <br> _(alias: `plr`)_ | `-c (default: 10)` | Fetch popular anime (default count is 10) |
56
56
  | **`user`** | `<username>` | Get information about a specific AniList user |
57
57
  | **`lists`** <br> _(alias: `ls`)_ | `-a, --anime` <br> `-m, --manga` | Fetch anime or manga lists of the logged-in user |
58
- | **`delete`** <br> _(alias: `del`)_ | `-a, --anime` <br> `-m, --manga` <br> `-ac, --activity` | Delete collections of anime, manga or activities |
58
+ | **`delete`** <br> _(alias: `del`)_ | `-a, --anime` <br> `-m, --manga` <br> `-s, --activity` | Delete collections of anime, manga or activities |
59
59
  | **`upcoming`** <br> _(alias:`up`)_ | `-c (default: 10)` | Fetch upcoming anime (default count is 10) |
60
60
  | **`anime`** | `<anime-id>` | Get anime details by Anime Id |
61
61
  | **`search`** <br> _(alias:`srch`/`find`)_ | `<query>` <br> `-a, --anime` <br> `-m, --manga` <br> `-c (default: 10)` | Get anime/manga search results |
@@ -1,23 +1,56 @@
1
+ import { MediaTitle } from "./types.js";
1
2
  declare class Auth {
2
3
  /**
3
4
  * Get access-token from user
4
5
  */
5
- static GetAccessToken(): Promise<any>;
6
+ static GetAccessToken(): Promise<string>;
6
7
  static StoreAccessToken(token: string): Promise<void>;
7
8
  static RetriveAccessToken(): Promise<string>;
8
9
  static Login(clientId: number, clientSecret: string): Promise<void>;
9
- static Myself(): Promise<any>;
10
+ static Myself(): Promise<{
11
+ id: number;
12
+ name: string;
13
+ siteUrl: string;
14
+ options: {
15
+ profileColor: string;
16
+ timezone: string;
17
+ activityMergeTime: string;
18
+ };
19
+ donatorTier: string;
20
+ donatorBadge: string;
21
+ unreadNotificationCount: number;
22
+ createdAt: number;
23
+ updatedAt: number;
24
+ statistics: {
25
+ anime: {
26
+ count: number;
27
+ meanScore: string;
28
+ minutesWatched: string;
29
+ episodesWatched: number;
30
+ };
31
+ manga: {
32
+ count: number;
33
+ meanScore: string;
34
+ chaptersRead: number;
35
+ volumesRead: number;
36
+ };
37
+ };
38
+ }>;
10
39
  static isLoggedIn(): Promise<boolean>;
11
40
  static Logout(): Promise<void>;
12
- static MyUserId(): Promise<any>;
13
- static MyUserName(): Promise<any>;
41
+ static MyUserId(): Promise<number>;
42
+ static MyUserName(): Promise<string>;
14
43
  static DeleteMyActivities(): Promise<void>;
15
44
  static DeleteMyAnimeList(): Promise<void>;
16
- static DeleteAnimeById(id: number, title?: any): Promise<void>;
45
+ static DeleteAnimeById(id: number, title?: MediaTitle): Promise<void>;
17
46
  static DeleteMyMangaList(): Promise<void>;
18
- static DeleteMangaById(id: number, title?: any): Promise<void>;
47
+ static DeleteMangaById(id: number, title?: MediaTitle): Promise<void>;
19
48
  static Write(status: string): Promise<void>;
20
49
  static callAnimeImporter(): Promise<void>;
21
50
  static callMangaImporter(): Promise<void>;
51
+ private static LikeFollowing;
52
+ private static Like;
53
+ private static LikeSpecificUser;
54
+ static AutoLike(): Promise<void>;
22
55
  }
23
56
  export { Auth };
@@ -15,9 +15,9 @@ import os from "os";
15
15
  import path from "path";
16
16
  import { fetcher } from "./fetcher.js";
17
17
  import { AniList, MyAnimeList } from "./lists.js";
18
- import { deleteActivityMutation, saveTextActivityMutation, } from "./mutations.js";
19
- import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, userActivityQuery, } from "./queries.js";
20
- import { aniListEndpoint, getTitle, redirectUri } from "./workers.js";
18
+ import { deleteActivityMutation, likeActivityMutation, saveTextActivityMutation, } from "./mutations.js";
19
+ import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, specificUserActivitiesQuery, userActivityQuery, userQuery, } from "./queries.js";
20
+ import { activityBy, aniListEndpoint, getTitle, redirectUri, timestampToTimeAgo, } from "./workers.js";
21
21
  const home_dir = os.homedir();
22
22
  const save_path = path.join(home_dir, ".anilist_token");
23
23
  class Auth {
@@ -109,7 +109,7 @@ class Auth {
109
109
  }
110
110
  static Myself() {
111
111
  return __awaiter(this, void 0, void 0, function* () {
112
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
112
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
113
113
  try {
114
114
  if (yield Auth.isLoggedIn()) {
115
115
  const headers = {
@@ -147,16 +147,18 @@ Statistics (Anime):
147
147
  Count: ${(_g = (_f = user === null || user === void 0 ? void 0 : user.statistics) === null || _f === void 0 ? void 0 : _f.anime) === null || _g === void 0 ? void 0 : _g.count}
148
148
  Mean Score: ${(_j = (_h = user === null || user === void 0 ? void 0 : user.statistics) === null || _h === void 0 ? void 0 : _h.anime) === null || _j === void 0 ? void 0 : _j.meanScore}
149
149
  Minutes Watched: ${(_l = (_k = user === null || user === void 0 ? void 0 : user.statistics) === null || _k === void 0 ? void 0 : _k.anime) === null || _l === void 0 ? void 0 : _l.minutesWatched}
150
+ Episodes Watched: ${(_o = (_m = user === null || user === void 0 ? void 0 : user.statistics) === null || _m === void 0 ? void 0 : _m.anime) === null || _o === void 0 ? void 0 : _o.episodesWatched}
150
151
 
151
152
  Statistics (Manga):
152
- Count: ${(_o = (_m = user === null || user === void 0 ? void 0 : user.statistics) === null || _m === void 0 ? void 0 : _m.manga) === null || _o === void 0 ? void 0 : _o.count}
153
- Chapters Read: ${(_q = (_p = user === null || user === void 0 ? void 0 : user.statistics) === null || _p === void 0 ? void 0 : _p.manga) === null || _q === void 0 ? void 0 : _q.chaptersRead}
154
- Volumes Read: ${(_s = (_r = user === null || user === void 0 ? void 0 : user.statistics) === null || _r === void 0 ? void 0 : _r.manga) === null || _s === void 0 ? void 0 : _s.volumesRead}
153
+ Count: ${(_q = (_p = user === null || user === void 0 ? void 0 : user.statistics) === null || _p === void 0 ? void 0 : _p.manga) === null || _q === void 0 ? void 0 : _q.count}
154
+ Mean Score: ${(_s = (_r = user === null || user === void 0 ? void 0 : user.statistics) === null || _r === void 0 ? void 0 : _r.manga) === null || _s === void 0 ? void 0 : _s.meanScore}
155
+ Chapters Read: ${(_u = (_t = user === null || user === void 0 ? void 0 : user.statistics) === null || _t === void 0 ? void 0 : _t.manga) === null || _u === void 0 ? void 0 : _u.chaptersRead}
156
+ Volumes Read: ${(_w = (_v = user === null || user === void 0 ? void 0 : user.statistics) === null || _v === void 0 ? void 0 : _v.manga) === null || _w === void 0 ? void 0 : _w.volumesRead}
155
157
  `);
156
158
  console.log(`\nRecent Activities:`);
157
159
  if (activities.length > 0) {
158
- activities.map(({ status, progress, media }) => {
159
- console.log(`${status} ${progress ? `${progress} of ` : ""}${getTitle(media === null || media === void 0 ? void 0 : media.title)}`);
160
+ activities.map(({ status, progress, media, createdAt }) => {
161
+ console.log(`${timestampToTimeAgo(createdAt)}\t${status} ${progress ? `${progress} of ` : ""}${getTitle(media === null || media === void 0 ? void 0 : media.title)}`);
160
162
  });
161
163
  }
162
164
  return user;
@@ -217,7 +219,7 @@ Statistics (Manga):
217
219
  return __awaiter(this, void 0, void 0, function* () {
218
220
  var _a, _b;
219
221
  if (!(yield Auth.isLoggedIn())) {
220
- console.log(`\nUser not logged in.`);
222
+ console.warn(`\nUser not logged in.`);
221
223
  return null;
222
224
  }
223
225
  const token = yield Auth.RetriveAccessToken();
@@ -281,8 +283,6 @@ Statistics (Manga):
281
283
  ],
282
284
  },
283
285
  ]);
284
- const userId = yield Auth.MyUserId();
285
- const variables = { page: 1, perPage: 100, userId };
286
286
  const queryMap = {
287
287
  0: activityAllQuery,
288
288
  1: activityTextQuery,
@@ -293,6 +293,7 @@ Statistics (Manga):
293
293
  };
294
294
  const query = queryMap[activityType];
295
295
  let hasMoreActivities = true;
296
+ let totalCount = 0;
296
297
  while (hasMoreActivities) {
297
298
  const response = yield fetcher(query, {
298
299
  page: 1,
@@ -315,7 +316,8 @@ Statistics (Manga):
315
316
  });
316
317
  const isDeleted = (_f = (_e = deleteResponse === null || deleteResponse === void 0 ? void 0 : deleteResponse.data) === null || _e === void 0 ? void 0 : _e.DeleteActivity) === null || _f === void 0 ? void 0 : _f.deleted;
317
318
  count++;
318
- console.log(`[${count}/${activities.length}] ${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? "✅" : "❌"}`);
319
+ totalCount++;
320
+ console.log(`[${count}/${activities.length}/${totalCount}]\t${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? "✅" : "❌"}`);
319
321
  // Avoiding rate-limit
320
322
  yield new Promise((resolve) => setTimeout(resolve, 1100));
321
323
  }
@@ -360,7 +362,7 @@ Statistics (Manga):
360
362
  const selectedEntries = lists.find((list) => list.name === selectedList);
361
363
  if (selectedEntries) {
362
364
  console.log(`\nDeleting entries of '${selectedEntries.name}':`);
363
- for (const [_, entry] of selectedEntries.entries.entries()) {
365
+ for (const [, entry] of selectedEntries.entries.entries()) {
364
366
  if (entry === null || entry === void 0 ? void 0 : entry.id) {
365
367
  yield Auth.DeleteAnimeById(entry === null || entry === void 0 ? void 0 : entry.id, (_c = entry === null || entry === void 0 ? void 0 : entry.media) === null || _c === void 0 ? void 0 : _c.title);
366
368
  yield new Promise((resolve) => setTimeout(resolve, 1100));
@@ -396,19 +398,8 @@ Statistics (Manga):
396
398
  return __awaiter(this, void 0, void 0, function* () {
397
399
  var _a, _b, _c;
398
400
  try {
399
- const request = yield fetch(aniListEndpoint, {
400
- method: "POST",
401
- headers: {
402
- "content-type": "application/json",
403
- "Authorization": `Bearer ${yield Auth.RetriveAccessToken()}`,
404
- },
405
- body: JSON.stringify({
406
- query: deleteMediaEntryMutation,
407
- variables: { id },
408
- }),
409
- });
410
- const response = yield request.json();
411
- if (request.status === 200) {
401
+ const response = yield fetcher(deleteMediaEntryMutation, { id: id });
402
+ if (response === null || response === void 0 ? void 0 : response.data) {
412
403
  const deleted = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.DeleteMediaListEntry) === null || _b === void 0 ? void 0 : _b.deleted;
413
404
  console.log(`del ${title ? getTitle(title) : ""} ${deleted ? "✅" : "❌"}`);
414
405
  }
@@ -445,7 +436,7 @@ Statistics (Manga):
445
436
  const selectedEntries = lists.find((list) => list.name === selectedList);
446
437
  if (selectedEntries) {
447
438
  console.log(`\nDeleting entries of '${selectedEntries.name}':`);
448
- for (const [_, entry] of selectedEntries.entries.entries()) {
439
+ for (const [, entry] of selectedEntries.entries.entries()) {
449
440
  if (entry === null || entry === void 0 ? void 0 : entry.id) {
450
441
  yield Auth.DeleteMangaById(entry === null || entry === void 0 ? void 0 : entry.id, (_c = entry === null || entry === void 0 ? void 0 : entry.media) === null || _c === void 0 ? void 0 : _c.title);
451
442
  yield new Promise((resolve) => setTimeout(resolve, 1100));
@@ -477,33 +468,22 @@ Statistics (Manga):
477
468
  }
478
469
  }
479
470
  catch (error) {
480
- console.error(`\nError deleting manga.`);
471
+ console.error(`\nError deleting manga. ${error.message}`);
481
472
  }
482
473
  });
483
474
  }
484
475
  static DeleteMangaById(id, title) {
485
476
  return __awaiter(this, void 0, void 0, function* () {
486
- var _a, _b;
477
+ var _a, _b, _c, _d;
487
478
  try {
488
- const request = yield fetch(aniListEndpoint, {
489
- method: "POST",
490
- headers: {
491
- "Content-Type": "application/json",
492
- "Authorization": `Bearer ${yield Auth.RetriveAccessToken()}`,
493
- },
494
- body: JSON.stringify({
495
- query: deleteMangaEntryMutation,
496
- variables: { id },
497
- }),
498
- });
499
- const { data, errors } = yield request.json();
479
+ const response = yield fetcher(deleteMangaEntryMutation, { id });
500
480
  const statusMessage = title ? getTitle(title) : "";
501
- if (request.ok) {
502
- const deleted = (_a = data === null || data === void 0 ? void 0 : data.DeleteMediaListEntry) === null || _a === void 0 ? void 0 : _a.deleted;
481
+ if (response === null || response === void 0 ? void 0 : response.data) {
482
+ const deleted = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.DeleteMediaListEntry) === null || _b === void 0 ? void 0 : _b.deleted;
503
483
  console.log(`del ${statusMessage} ${deleted ? "✅" : "❌"}`);
504
484
  }
505
485
  else {
506
- console.error(`Error deleting manga. ${(_b = errors === null || errors === void 0 ? void 0 : errors[0]) === null || _b === void 0 ? void 0 : _b.message}`);
486
+ console.error(`Error deleting manga. ${(_d = (_c = response === null || response === void 0 ? void 0 : response.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.message}`);
507
487
  }
508
488
  }
509
489
  catch (error) {
@@ -519,12 +499,10 @@ Statistics (Manga):
519
499
  console.error(`\nPlease login to use this feature.`);
520
500
  return;
521
501
  }
522
- const query = saveTextActivityMutation;
523
- const variables = {
502
+ const data = yield fetcher(saveTextActivityMutation, {
524
503
  status: status +
525
504
  `<br><br><br><br>*Written using [@irfanshadikrishad/anilist](https://www.npmjs.com/package/@irfanshadikrishad/anilist).*`,
526
- };
527
- const data = yield fetcher(query, variables);
505
+ });
528
506
  if (!data) {
529
507
  console.error(`\nSomething went wrong. ${data}.`);
530
508
  return;
@@ -603,5 +581,215 @@ Statistics (Manga):
603
581
  }
604
582
  });
605
583
  }
584
+ static LikeFollowing() {
585
+ return __awaiter(this, void 0, void 0, function* () {
586
+ var _a, _b, _c, _d;
587
+ try {
588
+ let page = 1;
589
+ let hasMoreActivities = true;
590
+ let retryCount = 0;
591
+ const maxRetries = 5;
592
+ while (hasMoreActivities) {
593
+ const activities = yield fetcher(followingActivitiesQuery, {
594
+ page,
595
+ perPage: 50,
596
+ });
597
+ if (activities && ((_b = (_a = activities === null || activities === void 0 ? void 0 : activities.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities.length) > 0) {
598
+ retryCount = 0; // Reset retry count on successful fetch
599
+ const activiti = (_d = (_c = activities === null || activities === void 0 ? void 0 : activities.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
600
+ for (let activ of activiti) {
601
+ if (!activ.isLiked && activ.id) {
602
+ try {
603
+ const like = yield fetcher(likeActivityMutation, {
604
+ activityId: activ.id,
605
+ });
606
+ console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
607
+ }
608
+ catch (error) {
609
+ console.error(`Activity possibly deleted. ${error.message}`);
610
+ }
611
+ }
612
+ else {
613
+ console.log(`${activityBy(activ)} 🔵`);
614
+ }
615
+ // avoiding rate-limit
616
+ yield new Promise((resolve) => {
617
+ setTimeout(resolve, 2000);
618
+ });
619
+ }
620
+ page++;
621
+ }
622
+ else {
623
+ if (retryCount < maxRetries) {
624
+ retryCount++;
625
+ console.warn(`Empty activities returned. Retrying... (${retryCount}/${maxRetries})`);
626
+ yield new Promise((resolve) => setTimeout(resolve, 3000));
627
+ }
628
+ else {
629
+ console.log(`\nProbably the end of activities after ${maxRetries} retries.`);
630
+ console.info(activities);
631
+ hasMoreActivities = false;
632
+ }
633
+ }
634
+ }
635
+ }
636
+ catch (error) {
637
+ console.error(`\nError from likeFollowing. ${error.message}`);
638
+ }
639
+ });
640
+ }
641
+ static Like(type) {
642
+ return __awaiter(this, void 0, void 0, function* () {
643
+ var _a, _b, _c, _d;
644
+ try {
645
+ let page = 1;
646
+ let hasMoreActivities = true;
647
+ let activity = type === 0
648
+ ? followingActivitiesQuery
649
+ : type === 1
650
+ ? globalActivitiesQuery
651
+ : followingActivitiesQuery;
652
+ while (hasMoreActivities) {
653
+ const activities = yield fetcher(activity, {
654
+ page,
655
+ perPage: 50,
656
+ });
657
+ if (activities && ((_b = (_a = activities === null || activities === void 0 ? void 0 : activities.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities.length) > 0) {
658
+ const activiti = (_d = (_c = activities === null || activities === void 0 ? void 0 : activities.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
659
+ for (let activ of activiti) {
660
+ if (!activ.isLiked && activ.id) {
661
+ try {
662
+ const like = yield fetcher(likeActivityMutation, {
663
+ activityId: activ.id,
664
+ });
665
+ // const ToggleLike = like?.data?.ToggleLike
666
+ console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
667
+ }
668
+ catch (error) {
669
+ console.error(`Activity possibly deleted. ${error.message}`);
670
+ }
671
+ }
672
+ else {
673
+ console.log(`${activityBy(activ)} 🔵`);
674
+ }
675
+ // avoiding rate-limit
676
+ yield new Promise((resolve) => {
677
+ setTimeout(resolve, 1500);
678
+ });
679
+ }
680
+ page++;
681
+ }
682
+ else {
683
+ // No more activities to like
684
+ console.log(`\nProbably the end of activities.`);
685
+ console.info(activities);
686
+ hasMoreActivities = false;
687
+ }
688
+ }
689
+ }
690
+ catch (error) {
691
+ console.error(`\nError from likeFollowing. ${error.message}`);
692
+ }
693
+ });
694
+ }
695
+ static LikeSpecificUser() {
696
+ return __awaiter(this, void 0, void 0, function* () {
697
+ var _a, _b, _c, _d;
698
+ try {
699
+ const { username } = yield inquirer.prompt([
700
+ {
701
+ type: "input",
702
+ name: "username",
703
+ message: "Username of the user:",
704
+ },
705
+ ]);
706
+ const userDetails = yield fetcher(userQuery, { username: username });
707
+ if (userDetails) {
708
+ let page = 1;
709
+ const perPage = 50;
710
+ const userId = (_b = (_a = userDetails === null || userDetails === void 0 ? void 0 : userDetails.data) === null || _a === void 0 ? void 0 : _a.User) === null || _b === void 0 ? void 0 : _b.id;
711
+ if (userId) {
712
+ while (true) {
713
+ const activities = yield fetcher(specificUserActivitiesQuery, {
714
+ page,
715
+ perPage,
716
+ userId,
717
+ });
718
+ const activiti = (_d = (_c = activities === null || activities === void 0 ? void 0 : activities.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
719
+ // Break the loop if no more activities are found
720
+ if (!activiti || activiti.length === 0) {
721
+ console.log("No more activities found.");
722
+ break;
723
+ }
724
+ for (let activ of activiti) {
725
+ if (!activ.isLiked && activ.id) {
726
+ try {
727
+ const like = yield fetcher(likeActivityMutation, {
728
+ activityId: activ.id,
729
+ });
730
+ console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
731
+ }
732
+ catch (error) {
733
+ console.error(`Activity possibly deleted. ${error.message}`);
734
+ }
735
+ }
736
+ else {
737
+ console.log(`${activityBy(activ)} 🔵`);
738
+ }
739
+ // Avoiding rate limit
740
+ yield new Promise((resolve) => {
741
+ setTimeout(resolve, 1500);
742
+ });
743
+ }
744
+ // Go to the next page
745
+ page += 1;
746
+ }
747
+ }
748
+ }
749
+ }
750
+ catch (error) {
751
+ console.error(`\nError from LikeSpecificUser. ${error.message}`);
752
+ }
753
+ });
754
+ }
755
+ static AutoLike() {
756
+ return __awaiter(this, void 0, void 0, function* () {
757
+ try {
758
+ if (!(yield Auth.isLoggedIn())) {
759
+ console.error(`\nPlease login to use this feature.`);
760
+ return;
761
+ }
762
+ const { activityType } = yield inquirer.prompt([
763
+ {
764
+ type: "list",
765
+ name: "activityType",
766
+ message: "Select activity type:",
767
+ choices: [
768
+ { name: "Following", value: 1 },
769
+ { name: "Global", value: 2 },
770
+ { name: "Specific User", value: 3 },
771
+ ],
772
+ pageSize: 10,
773
+ },
774
+ ]);
775
+ switch (activityType) {
776
+ case 1:
777
+ yield this.LikeFollowing();
778
+ break;
779
+ case 2:
780
+ yield this.Like(1);
781
+ break;
782
+ case 3:
783
+ yield this.LikeSpecificUser();
784
+ break;
785
+ default:
786
+ console.error(`\nInvalid choice. (${activityType})`);
787
+ }
788
+ }
789
+ catch (error) {
790
+ console.error(`\nError from autolike. ${error.message}`);
791
+ }
792
+ });
793
+ }
606
794
  }
607
795
  export { Auth };
@@ -9,5 +9,5 @@
9
9
  * @param {object} variables - An object containing the variables for the query.
10
10
  * @returns {Promise<object|null>} The response from the API as a JSON object if successful; otherwise, null.
11
11
  */
12
- declare function fetcher(query: string, variables: object): Promise<any>;
12
+ declare function fetcher(query: string, variables: object): Promise<object | null>;
13
13
  export { fetcher };
@@ -5,7 +5,7 @@ declare class AniList {
5
5
  static exportManga(): Promise<void>;
6
6
  static MyAnime(): Promise<void>;
7
7
  static MyManga(): Promise<void>;
8
- static getTrendingAnime(count: number): Promise<any>;
8
+ static getTrendingAnime(count: number): Promise<void>;
9
9
  static getPopularAnime(count: number): Promise<void>;
10
10
  static getUpcomingAnime(count: number): Promise<void>;
11
11
  static getUserByUsername(username: string): Promise<void>;