joaoricardo000 / whatsapp-bot-seed

A small python framework to create a whatsapp bot, with regex-callback message routing.
728 stars 244 forks source link

How to set status and profile picture #59

Open nauramutiara opened 8 years ago

nauramutiara commented 8 years ago

Hello. this is a great bot. and I want to ask how to set status like "/help for information" also set a profile picture for the bot on config.py maybe?? Thank You

ghost commented 8 years ago

You can do that using Yowsup CLI: sudo yowsup-cli demos -l YourRegisteredPhoneNumber:YourPassword --yowsup

relima commented 8 years ago

I use: def status(message, match): return SetStatusIqProtocolEntity(match.group("profile_status"))

joaoricardo000 commented 8 years ago

It would be nice if there is a configuration on config.py, and set profile pic and status on every startup...

relima commented 8 years ago

@joaoricardo000 I actually have something around those lines too:

def ImagemProfile(self, message, match): 
    for status in ["ServerOn", "ServerOff"]:
        try: 
            match.group(status)
            break
        except: pass

    src = Image.open("/home/***/.memegen/"+status+".jpg")
    pictureData = src.resize((640, 640)).tobytes("jpeg", "RGB")
    picturePreview = src.resize((96, 96)).tobytes("jpeg", "RGB")
    return SetPictureIqProtocolEntity("***@s.whatsapp.net", picturePreview, pictureData)
ghost commented 8 years ago

I'll make a PR

ghost commented 8 years ago

60