11const Command = require ( '../../base/Command.js' ) ;
22const { EmbedBuilder } = require ( 'discord.js' ) ;
33const fetch = require ( 'node-superfetch' ) ;
4- const moment = require ( 'moment' ) ;
54
65class Github extends Command {
76 constructor ( client ) {
@@ -44,6 +43,9 @@ class Github extends Command {
4443 . get ( `https://api.github.com/repos/${ author } /${ repository } ` )
4544 . set ( { Authorization : `token ${ this . client . config . github } ` } ) ;
4645
46+ const createdAt = Math . floor ( new Date ( body . created_at ) . getTime ( ) / 1000 ) ;
47+ const updatedAt = Math . floor ( new Date ( body . updated_at ) . getTime ( ) / 1000 ) ;
48+
4749 const embed = new EmbedBuilder ( )
4850 . setColor ( msg . settings . embedColor )
4951 . setAuthor ( { name : 'GitHub' , iconURL : 'https://i.imgur.com/e4HunUm.png' , url : 'https://github.com/' } )
@@ -59,8 +61,8 @@ class Github extends Command {
5961 { name : 'License' , value : body . license ? body . license . name : 'None' , inline : true } ,
6062 { name : 'Archived' , value : body . archived ? 'Yes' : 'No' , inline : true } ,
6163 { name : 'Size' , value : `${ ( body . size / 1000 ) . toLocaleString ( ) } MB` , inline : true } ,
62- { name : 'Creation Date' , value : moment . utc ( body . created_at ) . format ( 'MM/DD/YYYY h:mm A' ) , inline : true } ,
63- { name : 'Modification Date' , value : moment . utc ( body . updated_at ) . format ( 'MM/DD/YYYY h:mm A' ) , inline : true } ,
64+ { name : 'Creation Date' , value : `<t: ${ createdAt } :s>` , inline : true } ,
65+ { name : 'Modification Date' , value : `<t: ${ updatedAt } :s>` , inline : true } ,
6466 ] ) ;
6567
6668 return msg . channel . send ( { embeds : [ embed ] } ) ;
0 commit comments