@irfanshadikrishad/anilist 1.0.0-forbidden.0 → 1.0.0-forbidden.2

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.
@@ -84,13 +84,7 @@ declare enum MALMangaStatus {
84
84
  interface AnimeList {
85
85
  data?: {
86
86
  MediaListCollection: {
87
- lists: {
88
- name: string;
89
- entries: {
90
- id: number;
91
- progress: number;
92
- }[];
93
- }[];
87
+ lists: MediaList[];
94
88
  };
95
89
  };
96
90
  errors?: {
@@ -108,4 +102,306 @@ interface MediaWithProgress {
108
102
  romaji?: string;
109
103
  };
110
104
  }
111
- export { AniListMediaStatus, AnimeList, DeleteMangaResponse, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaWithProgress, saveAnimeWithProgressResponse, };
105
+ interface MediaTitle {
106
+ english?: string;
107
+ romaji?: string;
108
+ native?: string;
109
+ userPreferred?: string;
110
+ }
111
+ interface Media {
112
+ id: number;
113
+ idMal?: number;
114
+ title: MediaTitle;
115
+ chapters?: number;
116
+ }
117
+ interface MediaEntry {
118
+ media: Media;
119
+ private: boolean;
120
+ progress: number;
121
+ status: string;
122
+ hiddenFromStatusLists: boolean;
123
+ }
124
+ interface List {
125
+ name: string;
126
+ entries: MediaEntry[];
127
+ }
128
+ interface MediaList {
129
+ id(id: number | string): string;
130
+ title: {
131
+ english?: string;
132
+ romaji?: string;
133
+ };
134
+ name: string;
135
+ entries: MediaListEntry[];
136
+ }
137
+ interface Myself {
138
+ data?: {
139
+ Viewer: {
140
+ id: number;
141
+ name: string;
142
+ siteUrl: string;
143
+ options: {
144
+ profileColor: string;
145
+ timezone: string;
146
+ activityMergeTime: string;
147
+ };
148
+ donatorTier: string;
149
+ donatorBadge: string;
150
+ unreadNotificationCount: number;
151
+ createdAt: number;
152
+ updatedAt: number;
153
+ statistics: {
154
+ anime: {
155
+ count: number;
156
+ meanScore: string;
157
+ minutesWatched: string;
158
+ episodesWatched: number;
159
+ };
160
+ manga: {
161
+ count: number;
162
+ meanScore: string;
163
+ chaptersRead: number;
164
+ volumesRead: number;
165
+ };
166
+ };
167
+ };
168
+ };
169
+ errors?: {
170
+ message: string;
171
+ }[];
172
+ }
173
+ interface DateMonthYear {
174
+ day?: number;
175
+ month?: number;
176
+ year?: number;
177
+ }
178
+ interface AnimeDetails {
179
+ data?: {
180
+ Media: {
181
+ id: number;
182
+ title: MediaTitle;
183
+ description: string;
184
+ duration: string;
185
+ startDate: DateMonthYear;
186
+ endDate: DateMonthYear;
187
+ countryOfOrigin: string;
188
+ isAdult: boolean;
189
+ status: string;
190
+ season: string;
191
+ format: string;
192
+ genres: [string];
193
+ siteUrl: string;
194
+ };
195
+ };
196
+ errors?: {
197
+ message: string;
198
+ }[];
199
+ }
200
+ interface MediaListEntry {
201
+ id?: number;
202
+ media: {
203
+ id?: number;
204
+ idMal?: number;
205
+ title?: MediaTitle;
206
+ episodes?: number;
207
+ siteUrl?: string;
208
+ chapters?: number;
209
+ };
210
+ progress?: number;
211
+ status?: string;
212
+ hiddenFromStatusLists?: boolean;
213
+ private?: boolean;
214
+ }
215
+ interface TheActivity {
216
+ type: string;
217
+ id: number;
218
+ message?: string;
219
+ createdAt: number;
220
+ recipient?: {
221
+ id: number;
222
+ name: string;
223
+ };
224
+ isLiked?: boolean;
225
+ user?: {
226
+ id?: number;
227
+ name?: string;
228
+ };
229
+ messenger?: {
230
+ name: string;
231
+ };
232
+ media?: {
233
+ title?: {
234
+ userPreferred: string;
235
+ };
236
+ };
237
+ progress?: string | null;
238
+ status?: string;
239
+ }
240
+ type UserActivitiesResponse = {
241
+ data?: {
242
+ Page: {
243
+ activities: {
244
+ status: string;
245
+ progress: number;
246
+ createdAt: number;
247
+ media: {
248
+ title: MediaTitle;
249
+ };
250
+ }[];
251
+ };
252
+ };
253
+ errors?: {
254
+ message: string;
255
+ }[];
256
+ };
257
+ type UserResponse = {
258
+ data?: {
259
+ User: {
260
+ id: number;
261
+ name: string;
262
+ siteUrl: string;
263
+ donatorTier: string;
264
+ donatorBadge: string;
265
+ createdAt: number;
266
+ updatedAt: number;
267
+ isBlocked: boolean;
268
+ isFollower: boolean;
269
+ isFollowing: boolean;
270
+ options: {
271
+ profileColor: string;
272
+ timezone: string;
273
+ };
274
+ statistics: {
275
+ anime: {
276
+ count: number;
277
+ episodesWatched: number;
278
+ minutesWatched: number;
279
+ };
280
+ manga: {
281
+ count: number;
282
+ chaptersRead: number;
283
+ volumesRead: number;
284
+ };
285
+ };
286
+ };
287
+ };
288
+ errors?: {
289
+ message: string;
290
+ }[];
291
+ };
292
+ type UserFollower = {
293
+ data?: {
294
+ Page: {
295
+ pageInfo: {
296
+ total: number;
297
+ perPage: number;
298
+ currentPage: number;
299
+ lastPage: number;
300
+ hasNextPage: boolean;
301
+ };
302
+ followers: {
303
+ id: number;
304
+ name: string;
305
+ avatar: {
306
+ large: string;
307
+ medium: string;
308
+ };
309
+ bannerImage: string;
310
+ }[];
311
+ };
312
+ };
313
+ errors?: {
314
+ message: string;
315
+ }[];
316
+ };
317
+ type User = {
318
+ id: number;
319
+ name: string;
320
+ avatar: {
321
+ large: string;
322
+ medium: string;
323
+ };
324
+ bannerImage: string;
325
+ };
326
+ type UserFollowing = {
327
+ data?: {
328
+ Page: {
329
+ pageInfo: {
330
+ total: number;
331
+ perPage: number;
332
+ currentPage: number;
333
+ lastPage: number;
334
+ hasNextPage: boolean;
335
+ };
336
+ following: User[];
337
+ };
338
+ };
339
+ errors?: {
340
+ message: string;
341
+ }[];
342
+ };
343
+ type AnimeSearchResponse = {
344
+ data?: {
345
+ Page: {
346
+ media: {
347
+ id: number;
348
+ title: MediaTitle;
349
+ startDate: DateMonthYear;
350
+ episodes: number;
351
+ status: string;
352
+ description: string;
353
+ }[];
354
+ };
355
+ };
356
+ errors?: {
357
+ message: string;
358
+ }[];
359
+ };
360
+ type LikeActivityResponse = {
361
+ data?: {
362
+ ToggleLike: {
363
+ id: number;
364
+ };
365
+ };
366
+ errors?: {
367
+ message: string;
368
+ }[];
369
+ };
370
+ type SpecificUserActivitiesResponse = {
371
+ data?: {
372
+ Page: {
373
+ pageInfo: {
374
+ total: number;
375
+ perPage: number;
376
+ currentPage: number;
377
+ lastPage: number;
378
+ hasNextPage: boolean;
379
+ };
380
+ activities: TheActivity[];
381
+ };
382
+ };
383
+ errors?: {
384
+ message: string;
385
+ }[];
386
+ };
387
+ type SaveTextActivityResponse = {
388
+ data?: {
389
+ SaveTextActivity: {
390
+ id: number;
391
+ };
392
+ };
393
+ errors?: {
394
+ message: string;
395
+ }[];
396
+ };
397
+ type DeleteActivityResponse = {
398
+ data?: {
399
+ DeleteMediaListEntry: {
400
+ deleted: boolean;
401
+ };
402
+ };
403
+ errors?: {
404
+ message: string;
405
+ }[];
406
+ };
407
+ export { AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteActivityResponse, DeleteMangaResponse, LikeActivityResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaEntry, MediaList, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveTextActivityResponse, SpecificUserActivitiesResponse, TheActivity, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
@@ -1,4 +1,4 @@
1
- import { MALAnimeStatus, MALMangaStatus, MediaWithProgress } from "./types.js";
1
+ import { MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity } from "./types.js";
2
2
  declare const aniListEndpoint = "https://graphql.anilist.co";
3
3
  declare const redirectUri = "https://anilist.co/api/v2/oauth/pin";
4
4
  declare function getTitle(title: {
@@ -6,9 +6,9 @@ declare function getTitle(title: {
6
6
  romaji?: string;
7
7
  }): string;
8
8
  declare function formatDateObject(dateObj: {
9
- day?: string;
10
- month?: string;
11
- year?: string;
9
+ day?: number;
10
+ month?: number;
11
+ year?: number;
12
12
  } | null): string;
13
13
  declare function getNextSeasonAndYear(): {
14
14
  nextSeason: string;
@@ -34,4 +34,8 @@ declare function createAnimeXML(malId: number, progress: number, status: MALAnim
34
34
  declare function createMangaXML(malId: number, progress: number, status: MALMangaStatus, chapters: number, title: string): string;
35
35
  declare function createAnimeListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
36
36
  declare function createMangaListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
37
- export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
37
+ declare function getCurrentPackageVersion(): string | null;
38
+ declare function timestampToTimeAgo(timestamp: number): string;
39
+ declare function activityBy(activity: TheActivity): string;
40
+ declare const anidbToanilistMapper: (romanjiName: string, year: number, englishName?: string) => Promise<number | null>;
41
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
@@ -11,12 +11,15 @@ import fs from "fs";
11
11
  import { readdir, writeFile } from "fs/promises";
12
12
  import inquirer from "inquirer";
13
13
  import { parse } from "json2csv";
14
+ import { createRequire } from "module";
14
15
  import open from "open";
15
16
  import { homedir } from "os";
16
17
  import { join } from "path";
17
18
  import process from "process";
18
19
  import { Auth } from "./auth.js";
19
- import { MALAnimeStatus, MALMangaStatus } from "./types.js";
20
+ import { fetcher } from "./fetcher.js";
21
+ import { animeSearchQuery } from "./queries.js";
22
+ import { MALAnimeStatus, MALMangaStatus, } from "./types.js";
20
23
  const aniListEndpoint = `https://graphql.anilist.co`;
21
24
  const redirectUri = "https://anilist.co/api/v2/oauth/pin";
22
25
  function getTitle(title) {
@@ -140,9 +143,10 @@ function selectFile(fileType) {
140
143
  return __awaiter(this, void 0, void 0, function* () {
141
144
  try {
142
145
  const files = yield listFilesInDownloadFolder();
146
+ console.log(getDownloadFolderPath());
143
147
  // Filter to include only files, not directories, with the specified extension
144
148
  const onlyFiles = files.filter((file) => {
145
- const filePath = `./downloads/${file}`; // Adjust this to the correct path
149
+ const filePath = `${getDownloadFolderPath()}/${file}`; // Adjust this to the correct path
146
150
  const isFile = fs.lstatSync(filePath).isFile(); // Check if it's a file
147
151
  return isFile && file.endsWith(fileType);
148
152
  });
@@ -168,49 +172,49 @@ function selectFile(fileType) {
168
172
  });
169
173
  }
170
174
  function createAnimeXML(malId, progress, status, episodes, title) {
171
- return `
172
- <anime>
173
- <series_animedb_id>${malId}</series_animedb_id>
174
- <series_title><![CDATA[${title}]]></series_title>
175
- <series_type>""</series_type>
176
- <series_episodes>${episodes}</series_episodes>
177
- <my_id>0</my_id>
178
- <my_watched_episodes>${progress}</my_watched_episodes>
179
- <my_start_date>0000-00-00</my_start_date>
180
- <my_finish_date>0000-00-00</my_finish_date>
181
- <my_score>0</my_score>
182
- <my_storage_value>0.00</my_storage_value>
183
- <my_status>${status}</my_status>
184
- <my_comments><![CDATA[]]></my_comments>
185
- <my_times_watched>0</my_times_watched>
186
- <my_rewatch_value></my_rewatch_value>
187
- <my_priority>LOW</my_priority>
188
- <my_tags><![CDATA[]]></my_tags>
189
- <my_rewatching>0</my_rewatching>
190
- <my_rewatching_ep>0</my_rewatching_ep>
191
- <my_discuss>0</my_discuss>
192
- <my_sns>default</my_sns>
193
- <update_on_import>1</update_on_import>
175
+ return `
176
+ <anime>
177
+ <series_animedb_id>${malId}</series_animedb_id>
178
+ <series_title><![CDATA[${title}]]></series_title>
179
+ <series_type>""</series_type>
180
+ <series_episodes>${episodes}</series_episodes>
181
+ <my_id>0</my_id>
182
+ <my_watched_episodes>${progress}</my_watched_episodes>
183
+ <my_start_date>0000-00-00</my_start_date>
184
+ <my_finish_date>0000-00-00</my_finish_date>
185
+ <my_score>0</my_score>
186
+ <my_storage_value>0.00</my_storage_value>
187
+ <my_status>${status}</my_status>
188
+ <my_comments><![CDATA[]]></my_comments>
189
+ <my_times_watched>0</my_times_watched>
190
+ <my_rewatch_value></my_rewatch_value>
191
+ <my_priority>LOW</my_priority>
192
+ <my_tags><![CDATA[]]></my_tags>
193
+ <my_rewatching>0</my_rewatching>
194
+ <my_rewatching_ep>0</my_rewatching_ep>
195
+ <my_discuss>0</my_discuss>
196
+ <my_sns>default</my_sns>
197
+ <update_on_import>1</update_on_import>
194
198
  </anime>`;
195
199
  }
196
200
  function createMangaXML(malId, progress, status, chapters, title) {
197
- return `
198
- <manga>
199
- <manga_mangadb_id>${malId}</manga_mangadb_id>
200
- <manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
201
- <manga_volumes>0</manga_volumes>
202
- <manga_chapters>${chapters ? chapters : 0}</manga_chapters>
203
- <my_id>0</my_id>
204
- <my_read_chapters>${progress}</my_read_chapters>
205
- <my_start_date>0000-00-00</my_start_date>
206
- <my_finish_date>0000-00-00</my_finish_date>
207
- <my_score>0</my_score>
208
- <my_status>${status}</my_status>
209
- <my_reread_value></my_reread_value>
210
- <my_priority>LOW</my_priority>
211
- <my_rereading>0</my_rereading>
212
- <my_discuss>0</my_discuss>
213
- <update_on_import>1</update_on_import>
201
+ return `
202
+ <manga>
203
+ <manga_mangadb_id>${malId}</manga_mangadb_id>
204
+ <manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
205
+ <manga_volumes>0</manga_volumes>
206
+ <manga_chapters>${chapters ? chapters : 0}</manga_chapters>
207
+ <my_id>0</my_id>
208
+ <my_read_chapters>${progress}</my_read_chapters>
209
+ <my_start_date>0000-00-00</my_start_date>
210
+ <my_finish_date>0000-00-00</my_finish_date>
211
+ <my_score>0</my_score>
212
+ <my_status>${status}</my_status>
213
+ <my_reread_value></my_reread_value>
214
+ <my_priority>LOW</my_priority>
215
+ <my_rereading>0</my_rereading>
216
+ <my_discuss>0</my_discuss>
217
+ <update_on_import>1</update_on_import>
214
218
  </manga>`;
215
219
  }
216
220
  function createAnimeListXML(mediaWithProgress) {
@@ -230,19 +234,19 @@ function createAnimeListXML(mediaWithProgress) {
230
234
  const status = statusMap[anime.status];
231
235
  return createAnimeXML(malId, progress, status, episodes, title);
232
236
  });
233
- return `<myanimelist>
234
- <myinfo>
235
- <user_id/>
236
- <user_name>${yield Auth.MyUserName()}</user_name>
237
- <user_export_type>1</user_export_type>
238
- <user_total_anime>0</user_total_anime>
239
- <user_total_watching>0</user_total_watching>
240
- <user_total_completed>0</user_total_completed>
241
- <user_total_onhold>0</user_total_onhold>
242
- <user_total_dropped>0</user_total_dropped>
243
- <user_total_plantowatch>0</user_total_plantowatch>
244
- </myinfo>
245
- \n${xmlEntries.join("\n")}\n
237
+ return `<myanimelist>
238
+ <myinfo>
239
+ <user_id/>
240
+ <user_name>${yield Auth.MyUserName()}</user_name>
241
+ <user_export_type>1</user_export_type>
242
+ <user_total_anime>0</user_total_anime>
243
+ <user_total_watching>0</user_total_watching>
244
+ <user_total_completed>0</user_total_completed>
245
+ <user_total_onhold>0</user_total_onhold>
246
+ <user_total_dropped>0</user_total_dropped>
247
+ <user_total_plantowatch>0</user_total_plantowatch>
248
+ </myinfo>
249
+ \n${xmlEntries.join("\n")}\n
246
250
  </myanimelist>`;
247
251
  });
248
252
  }
@@ -263,20 +267,102 @@ function createMangaListXML(mediaWithProgress) {
263
267
  const status = statusMap[manga.status];
264
268
  return createMangaXML(malId, progress, status, chapters, title);
265
269
  });
266
- return `<myanimelist>
267
- <myinfo>
268
- <user_id/>
269
- <user_name>${yield Auth.MyUserName()}</user_name>
270
- <user_export_type>2</user_export_type>
271
- <user_total_manga>5</user_total_manga>
272
- <user_total_reading>1</user_total_reading>
273
- <user_total_completed>1</user_total_completed>
274
- <user_total_onhold>1</user_total_onhold>
275
- <user_total_dropped>1</user_total_dropped>
276
- <user_total_plantoread>1</user_total_plantoread>
277
- </myinfo>
278
- \n${xmlEntries.join("\n")}\n
270
+ return `<myanimelist>
271
+ <myinfo>
272
+ <user_id/>
273
+ <user_name>${yield Auth.MyUserName()}</user_name>
274
+ <user_export_type>2</user_export_type>
275
+ <user_total_manga>5</user_total_manga>
276
+ <user_total_reading>1</user_total_reading>
277
+ <user_total_completed>1</user_total_completed>
278
+ <user_total_onhold>1</user_total_onhold>
279
+ <user_total_dropped>1</user_total_dropped>
280
+ <user_total_plantoread>1</user_total_plantoread>
281
+ </myinfo>
282
+ \n${xmlEntries.join("\n")}\n
279
283
  </myanimelist>`;
280
284
  });
281
285
  }
282
- export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
286
+ function getCurrentPackageVersion() {
287
+ const require = createRequire(import.meta.url);
288
+ const packageJson = require("../../package.json");
289
+ const version = packageJson.version;
290
+ return version || null;
291
+ }
292
+ function timestampToTimeAgo(timestamp) {
293
+ const now = Math.floor(Date.now() / 1000);
294
+ const elapsed = now - timestamp;
295
+ if (elapsed < 60) {
296
+ return `${elapsed} second${elapsed === 1 ? "" : "s"} ago`;
297
+ }
298
+ else if (elapsed < 3600) {
299
+ const minutes = Math.floor(elapsed / 60);
300
+ return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
301
+ }
302
+ else if (elapsed < 86400) {
303
+ const hours = Math.floor(elapsed / 3600);
304
+ return `${hours} hour${hours === 1 ? "" : "s"} ago`;
305
+ }
306
+ else if (elapsed < 2592000) {
307
+ const days = Math.floor(elapsed / 86400);
308
+ return `${days} day${days === 1 ? "" : "s"} ago`;
309
+ }
310
+ else if (elapsed < 31536000) {
311
+ const months = Math.floor(elapsed / 2592000);
312
+ return `${months} month${months === 1 ? "" : "s"} ago`;
313
+ }
314
+ else {
315
+ const years = Math.floor(elapsed / 31536000);
316
+ return `${years} year${years === 1 ? "" : "s"} ago`;
317
+ }
318
+ }
319
+ function activityBy(activity) {
320
+ var _a, _b, _c, _d;
321
+ if ((_a = activity === null || activity === void 0 ? void 0 : activity.messenger) === null || _a === void 0 ? void 0 : _a.name) {
322
+ return `[${activity.id}]\t${activity.messenger.name} messaged ${activity.recipient.name}`;
323
+ }
324
+ else if ((_c = (_b = activity === null || activity === void 0 ? void 0 : activity.media) === null || _b === void 0 ? void 0 : _b.title) === null || _c === void 0 ? void 0 : _c.userPreferred) {
325
+ if (activity.progress) {
326
+ return `[${activity.id}]\t${activity.user.name} ${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
327
+ }
328
+ else {
329
+ return `[${activity.id}]\t${activity.user.name} ${activity.status} ${activity.media.title.userPreferred}`;
330
+ }
331
+ }
332
+ else if ((_d = activity === null || activity === void 0 ? void 0 : activity.user) === null || _d === void 0 ? void 0 : _d.name) {
333
+ return `[${activity.id}]\t${activity.user.name}`;
334
+ }
335
+ else {
336
+ return `[${activity === null || activity === void 0 ? void 0 : activity.id}] ???`;
337
+ }
338
+ }
339
+ const anidbToanilistMapper = (romanjiName, year, englishName) => __awaiter(void 0, void 0, void 0, function* () {
340
+ const fetchAnime = (search) => __awaiter(void 0, void 0, void 0, function* () {
341
+ var _a;
342
+ try {
343
+ const response = yield fetcher(animeSearchQuery, {
344
+ search,
345
+ perPage: 50,
346
+ });
347
+ return ((_a = response.data) === null || _a === void 0 ? void 0 : _a.Page.media) || [];
348
+ }
349
+ catch (error) {
350
+ console.error("Error fetching AniList data:", error);
351
+ return [];
352
+ }
353
+ });
354
+ // Search using romanjiName first
355
+ let results = yield fetchAnime(romanjiName);
356
+ // If no results, fallback to englishName
357
+ if (!results.length && englishName) {
358
+ results = yield fetchAnime(englishName);
359
+ }
360
+ // Match using year
361
+ for (const anime of results) {
362
+ if (anime.startDate.year === year) {
363
+ return anime.id;
364
+ }
365
+ }
366
+ return null;
367
+ });
368
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
package/bin/index.js CHANGED
@@ -12,11 +12,12 @@ import { Command } from "commander";
12
12
  import process from "process";
13
13
  import { Auth } from "./helpers/auth.js";
14
14
  import { AniList } from "./helpers/lists.js";
15
+ import { getCurrentPackageVersion } from "./helpers/workers.js";
15
16
  const cli = new Command();
16
17
  cli
17
18
  .name("anilist")
18
19
  .description("Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts.")
19
- .version("1.0.0-forbidden.0");
20
+ .version(getCurrentPackageVersion());
20
21
  cli
21
22
  .command("login")
22
23
  .description("Login with AniList")
@@ -31,7 +32,7 @@ cli
31
32
  }
32
33
  }));
33
34
  cli
34
- .command("me")
35
+ .command("whoami")
35
36
  .description("Get details of the logged in user")
36
37
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
37
38
  yield Auth.Myself();
@@ -87,7 +88,7 @@ cli
87
88
  .description("Delete entire collections of anime or manga")
88
89
  .option("-a, --anime", "For anime list of authenticated user", false)
89
90
  .option("-m, --manga", "For manga list of authenticated user", false)
90
- .option("-ac, --activity", "For activity of authenticated user", false)
91
+ .option("-s, --activity", "For activity of authenticated user", false)
91
92
  .action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga, activity }) {
92
93
  const selectedOptions = [anime, manga, activity].filter(Boolean).length;
93
94
  if (selectedOptions === 0) {
@@ -205,8 +206,15 @@ cli
205
206
  cli
206
207
  .command("autolike")
207
208
  .alias("al")
209
+ .option("-2, --v2", "Like the activities", false)
210
+ .option("-c, --count <number>", "Number of activities to like", "25")
208
211
  .description("Autolike following or global activities.")
209
- .action(() => __awaiter(void 0, void 0, void 0, function* () {
210
- yield Auth.AutoLike();
212
+ .action((_a) => __awaiter(void 0, [_a], void 0, function* ({ v2, count }) {
213
+ if (v2) {
214
+ yield Auth.LikeFollowingActivityV2(count);
215
+ }
216
+ else {
217
+ yield Auth.AutoLike();
218
+ }
211
219
  }));
212
220
  cli.parse(process.argv);