File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ *
3+ * Author: Muhammad Saad
4+ * GitHub: msaaddev
5+ * Twitter: https://twitter.com/msaaddev
6+ */
7+
8+ const io = require ( "console-read-write" ) ;
9+ const { cyan } = require ( "chalk" ) ;
10+ const box = require ( "./box" ) ;
11+ const axios = require ( "axios" ) ;
12+
13+ module . exports = async ( ) => {
14+ console . log ( "------------------------------------------" ) ;
15+ // getting data from terminal
16+ io . write ( cyan ( "> Enter GitHub Username" ) ) ;
17+ const URL = await io . read ( ) ;
18+ await axios
19+ . get ( `https://api.github.com/users/${ URL } /events/public` )
20+ . then ( ( res ) => {
21+ for ( let i = 0 ; i < res . data . length ; i ++ ) {
22+ if ( res . data [ i ] . type === "PushEvent" ) {
23+ const name = "✉️ Email" ;
24+ box ( name , res . data [ i ] . payload . commits [ 0 ] . author . email ) ;
25+ break ;
26+ }
27+ if ( i === res . data . length - 1 ) {
28+ const name = "⚠️ WARNING" ;
29+ const msg = "No Email Found!!" ;
30+ box ( name , msg ) ;
31+ }
32+ }
33+ } )
34+ . catch ( ( err ) => {
35+ const name = "⚠️ WARNING" ;
36+ const msg = "Cannot Access Email!!" ;
37+ box ( name , msg ) ;
38+ } ) ;
39+ } ;
You can’t perform that action at this time.
0 commit comments