venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.14k forks source link

Automaticaly leave a groupchat #599

Open ghost opened 10 years ago

ghost commented 10 years ago

Hi,

Sorry for my lot of issues but i've got a question. Is it possible that if the bot will be added to a group it automatically sends a message and leaves? If this is possible could you give me a example code please?

shirioko commented 10 years ago

I don't even...

You need to stop confusing the issue tracker with StackOverflow. The functions for sending a message and leaving a group are already there. All you need to do is use them.

ghost commented 10 years ago

I know but my question is how?! I've founded the functions.

m-derevyanko commented 9 years ago
public function onGroupsParticipantsAdd($phone, $gid, $participant){
        wBot::getInstance()->debugMsg('#SMN_WAS_ADDED_TO_GROUP# ' . $phone . ' > ' . $gid . ' > ' . $participant);

        //oops, bot was added somewhere
        if(wBot::getInstance()->sender == strstr($participant, '@', true)){
            wBot::getInstance()->api->sendGroupsLeave($gid);
        }
    }