Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.8 kB
3
Indexable
    if (event.logMessageData.addedParticipants)
        {
        const thread = await api.getThreadInfo(event.threadID);
        const memcount = thread.userInfo.length;
        const participant = event.logMessageData.addedParticipants.shift();
        const newmem = participant.fullName;
        const userId = participant.userFbId;

            if(userId == me){
            var msgss = {
               body: "Hi I am JhayBot🤖\nThank you for adding me as the "+memcount+ " member of "+ thread.threadName +".\nPlease Respect me as your bot and friend. Thank you!\n\nYour Group Bot: JhayBot🤖\n***DO NOT REPLY!***\nTo Learn more Just enter " +"'"+"~help"+"'"+" To show all available commands and features",              
               attachment: fs.createReadStream('./cache/joinGif/added.gif')
               }
           api.sendMessage(msgss, event.threadID , event.messageID);
           api.changeNickname("JhayBot🤖", event.threadID, me, (err) => {
        if(err) return console.error(err);
    });
           console.log(event.logMessageData);
    
        }else{

           var msgss = {
               body: "Welcome @"+newmem+" as the "+memcount+ " member of "+ thread.threadName +".\nPlease Respect all members and Admins and also Follow the Group Rules. Thank you!\n\nYour Group Bot: JhayBot🤖\n***DO NOT REPLY!***\n\nTo Learn more Just enter " +"'"+"~help"+"'"+" To show all available commands and features",
               mentions: [
     {id: userId, tag: `@${newmem}`}
   ],
               attachment: fs.createReadStream('./cache/joinGif/hi.gif')
               }
           api.sendMessage(msgss, event.threadID , event.messageID);
           console.log(event.logMessageData);
    }
}