File tree 4 files changed +731
-6
lines changed
4 files changed +731
-6
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,13 +8,22 @@ module.exports.handleResponse = async (res) => {
8
8
const resourceType = await req . resourceType ( ) ;
9
9
const resourceURL = await req . url ( ) ;
10
10
11
- if ( resourceType === "xhr" && resourceURL === "https://www.facebook.com/api/graphql/" ) {
11
+ if (
12
+ resourceType === "xhr" &&
13
+ resourceURL === "https://www.facebook.com/api/graphql/"
14
+ ) {
12
15
const json = JSON . parse ( ( await res . buffer ( ) ) . toString ( ) ) ;
16
+ console . log ( "json:" , json ) ;
13
17
14
18
if ( json . data . hasOwnProperty ( "node" ) ) {
15
19
let edges = json . data . node . new_members . edges ;
20
+ console . log ( "edges:" , edges ) ;
16
21
edges = edges . map ( ( edge ) => {
17
- return { id : edge . node . id , name : edge . node . name , me : `https://www.messenger.com/t/${ edge . node . id } ` } ;
22
+ return {
23
+ id : edge . node . id ,
24
+ name : edge . node . name ,
25
+ me : `https://www.messenger.com/t/${ edge . node . id } ` ,
26
+ } ;
18
27
} ) ;
19
28
20
29
for ( const edge of edges ) {
Original file line number Diff line number Diff line change 2
2
require ( "dotenv" ) . config ( ) ;
3
3
4
4
// User Imports
5
- const { launchBrowser, launchPage, sendMessage } = require ( "../handlers/puppeteerHelper" ) ;
5
+ const {
6
+ launchBrowser,
7
+ launchPage,
8
+ sendMessage,
9
+ } = require ( "../handlers/puppeteerHelper" ) ;
6
10
const { getRandomInt } = require ( "../handlers/generalHandler" ) ;
7
11
const { findAll } = require ( "../handlers/databaseHandler" ) ;
8
12
@@ -31,7 +35,7 @@ const INDIVIDUAL_SENT = "https://m.me/110035443798530";
31
35
for ( doc of docs ) {
32
36
console . log ( `[✨] Sending Message To ${ doc . name } ` ) ;
33
37
await page . goto ( doc . me , { waitUntil : "networkidle0" } ) ;
34
- await sendMessage ( page , MESSAGE_TO_SENT ) ;
38
+ await sendMessage ( page , Message ( doc . name ) ) ;
35
39
await page . waitFor ( getRandomInt ( 10000 , 20001 ) ) ;
36
40
}
37
41
} else {
@@ -43,3 +47,9 @@ const INDIVIDUAL_SENT = "https://m.me/110035443798530";
43
47
await page . waitFor ( getRandomInt ( 10000 , 20001 ) ) ;
44
48
await browser . close ( ) ;
45
49
} ) ( ) ;
50
+
51
+ const Message = ( fullName ) => {
52
+ const firstname = fullName . split ( " " ) [ 0 ] ;
53
+ console . log ( "firstname:" , firstname ) ;
54
+ return `Hi ${ firstname } , are you good` ;
55
+ } ;
You can’t perform that action at this time.
0 commit comments