Closed x23piracy closed 8 years ago
Check src/utils/media_sender.py. It is simple as that:
image_sender = ImageSender(interface_layer)
image_sender.send_by_path(jid=<userjid>, path="/absolute/path/img.png", caption="optional caption")
Hi, how can i use this within: super_views.py?
i added in imports: ImageSender
and for class superviews: self.image_sender = ImageSender(self.interface_layer)
def info(self, message=None, match=None, to=None):
image_sender = ImageSender(interface_layer)
image_sender.send_by_path(jid=message.getFrom(), path="/tmp/katze.png", caption="optional caption")
return TextMessageProtocolEntity(ABOUT_TEXT, to=message.getFrom())
Does not work:
File "/opt/whatsapp-bot-seed-master/src/router.py", line 78, in handle_callback data = callback(message, match) File "/opt/whatsapp-bot-seed-master/src/views/super_views.py", line 59, in info image_sender = ImageSender(interface_layer) NameError: global name 'interface_layer' is not defined
I am pretty new with python and my programming knowledge isn't the best, is it possible that you give me an example of the usage within super_views.py please?
Regards X23
Hi,
after more study i could make it work, thank you for the assistance.
Regards X23
@x23piracy
Hi, I am getting the same error, can you please share the code, how u solved it !
Hi,
i would like to send an image before sending the text answer: return TextMessageProtocolEntity("text", to=message.getFrom())
How can i do this?
Regards X23