File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import { MessageEmbed } from 'discord.js' ;
22import got from 'got' ;
3+ import { Logger } from 'pino' ;
34
45import { Cron , findTextChannelByName } from '../framework' ;
56
@@ -19,7 +20,7 @@ export default new Cron({
1920 'Vérifie tous les jours à 17h00 (Paris) si Epic Games offre un jeu (promotion gratuite) et alerte dans #jeux' ,
2021 schedule : '0 17 * * *' ,
2122 async handle ( context ) {
22- const games = await getOfferedGames ( context . date ) ;
23+ const games = await getOfferedGames ( context . date , context . logger ) ;
2324 if ( ! games ) {
2425 return ;
2526 }
@@ -142,7 +143,10 @@ const oneDay = 1000 * 60 * 60 * 24;
142143 * were offered between the previous and current cron execution, returns them.
143144 * @param now - Current date. Comes from cron schedule.
144145 */
145- async function getOfferedGames ( now : Date ) : Promise < Game [ ] | null > {
146+ async function getOfferedGames (
147+ now : Date ,
148+ logger : Logger ,
149+ ) : Promise < Game [ ] | null > {
146150 const { body } = await got < EpicGamesProducts > (
147151 'https://www.epicgames.com/graphql' ,
148152 {
@@ -158,6 +162,9 @@ async function getOfferedGames(now: Date): Promise<Game[] | null> {
158162 responseType : 'json' ,
159163 } ,
160164 ) ;
165+
166+ logger . info ( { data : body . data } , 'Offered games GraphQL response' ) ;
167+
161168 const catalog = body . data . Catalog . searchStore ;
162169
163170 if ( catalog . paging . total === 0 ) {
You can’t perform that action at this time.
0 commit comments