danielcardeenas / whatsapp-framework

⚗️Whatsapp python api
1.16k stars 363 forks source link

Add contact(s) on the fly #245

Open binooetomo opened 5 years ago

binooetomo commented 5 years ago

Dear All.

Actualy I have 2 question, but I post it different issue. This is the second

I learn run.py. In MacStack.init , there is : self.stack.setProp(MacLayer.PROP_CONTACTS, list(config.contacts.keys()))

I think that part is work based on what in config.contacts. def rebuildcontacts(self): self.stack.setProp(MacLayer.PROP_CONTACTS, list(config.contacts.keys()))

My module is :

  1. add number:name to config.contacts ... currently it's success, but I remember I failed before 'NameError: name 'config' is not defined'. I did not change anything but it work.

  2. call c.rebuidcontacts : this one get 'NameError: name 'c' is not defined'

Looks like everything defined in run.py is not available to modules.

sincerely -bino-

taufikterdidik commented 5 years ago

I think you can create thread in run.py that reload saved contacts periodically, so it not run on modules. look some example from here: https://github.com/danielcardeenas/whatsapp-framework/issues/129#issuecomment-383620073