88} from "whatsapp-web.js" ;
99import qrcode from "qrcode-terminal" ;
1010import messageEvent from "./events/message" ;
11+ import messageEdit from "./events/edit" ;
1112import groupLeave from "./events/groups/leave" ;
1213import groupJoin from "./events/groups/join" ;
1314import reaction from "./events/reaction" ;
@@ -17,22 +18,32 @@ const client = new Client({
1718 authStrategy : new LocalAuth ( ) ,
1819} ) ;
1920
21+ client . on ( "loading_screen" , ( percent : number , message : string ) =>
22+ log . info ( "loading" , `..................... ${ percent } %` )
23+ ) ;
24+ client . on ( "authenticated" , ( ) =>
25+ log . info ( "auth" , "Client authenticated successfully." )
26+ ) ;
2027client . on ( "qr" , ( qr : string ) => {
2128 // Generate and scan this code with your phone
22- log . info ( "QR Code " , "Scan this QR code with your WhatsApp app:" ) ;
29+ log . info ( "qrcode " , "Scan this QR code with your WhatsApp app:" ) ;
2330 qrcode . generate ( qr , { small : true } ) ;
2431} ) ;
25-
2632client . on ( "ready" , async ( ) => ready ( ) ) ;
2733client . on ( "message_reaction" , async ( react : Reaction ) =>
2834 reaction ( client , react )
2935) ;
30- client . on ( "group_join" , async ( notif : GroupNotification ) => groupJoin ( notif ) ) ;
31- client . on ( "group_leave" , async ( notif : GroupNotification ) => groupLeave ( notif ) ) ;
3236// client.on("message", (msg) => messageEvent(msg));
3337client . on ( "message_create" , async ( msg : Message ) => messageEvent ( msg ) ) ;
38+ client . on (
39+ "message_edit" ,
40+ async ( msg : Message , newBody : String , prevBody : String ) =>
41+ messageEdit ( msg , newBody , prevBody )
42+ ) ;
43+ client . on ( "group_join" , async ( notif : GroupNotification ) => groupJoin ( notif ) ) ;
44+ client . on ( "group_leave" , async ( notif : GroupNotification ) => groupLeave ( notif ) ) ;
3445client . on ( "auth_failure" , ( msg : String ) =>
35- log . error ( "Auth " , "Authentication failed. Please try again." )
46+ log . error ( "auth " , "Authentication failed. Please try again." )
3647) ;
3748
3849client . initialize ( ) ;
0 commit comments