diff options
Diffstat (limited to 'src/lib/AniList')
| -rw-r--r-- | src/lib/AniList/wrapped.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/AniList/wrapped.ts b/src/lib/AniList/wrapped.ts index 5190dfdf..72c81cd8 100644 --- a/src/lib/AniList/wrapped.ts +++ b/src/lib/AniList/wrapped.ts @@ -48,8 +48,9 @@ export interface Wrapped { const profileActivities = async ( user: AniListAuthorisation, identity: UserIdentity, - now = Date.now() + date = new Date() ) => { + const now = date.getTime(); const get = async (page: number) => await ( await fetch('https://graphql.anilist.co', { @@ -62,7 +63,11 @@ const profileActivities = async ( body: JSON.stringify({ query: `{ Page(page: ${page}) { - activities(userId: ${identity.id}, type_in: [ TEXT, MESSAGE ]) { + activities(userId: ${identity.id}, type_in: [ TEXT, MESSAGE ], createdAt_greater: ${Math.floor( + new Date(date.getFullYear(), 0, 1).getTime() / 1000 + )}, createdAt_lesser: ${Math.floor( + new Date(date.getFullYear(), 7, 1).getTime() / 1000 + )}) { ... on TextActivity { type createdAt @@ -163,7 +168,7 @@ export const wrapped = async ( const { statusCount, messageCount } = await profileActivities( anilistAuthorisation, identity, - new Date(year, 11, 31).getTime() + new Date(year, 11, 31) ); statusCountActivities = statusCount; |