Webapp
wagtail_live.webapp.receiver.WebAppReceiver
Webapp receiver.
dispatch_event(self, event)
See base class.
Source code in wagtail_live/webapp/receiver.py
def dispatch_event(self, event):
"""See base class."""
message = event
if message["update_type"] == MESSAGE_EDITED:
self.change_message(message=message)
return
elif message["update_type"] == MESSAGE_DELETED:
self.delete_message(message=message)
return
else:
self.add_message(message=message)
get_channel_id_from_message(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_channel_id_from_message(self, message):
"""See base class."""
return message["channel"]
get_image_content(self, image)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_image_content(self, image):
"""See base class."""
return Image.objects.get(id=image["id"]).image
get_image_dimensions(self, image)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_image_dimensions(self, image):
"""See base class."""
return (image["image"]["width"], image["image"]["height"])
get_image_mimetype(self, image)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_image_mimetype(self, image):
"""See base class."""
mime_type = image["image"]["name"].split(".")[-1]
return "jpeg" if mime_type == "jpg" else mime_type
get_image_name(self, image)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_image_name(self, image):
"""See base class."""
return image["image"]["name"]
get_image_title(self, image)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_image_title(self, image):
"""See base class."""
return image["image"]["name"].split(".")[0].replace("-", " ")
get_message_files(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_message_files(self, message):
"""See base class."""
return message["images"]
get_message_files_from_edited_message(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_message_files_from_edited_message(self, message):
"""See base class."""
return self.get_message_files(message=message)
get_message_id_from_edited_message(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_message_id_from_edited_message(self, message):
"""See base class."""
return self.get_message_id_from_message(message=message)
get_message_id_from_message(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_message_id_from_message(self, message):
"""See base class."""
return message["id"]
get_message_text(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_message_text(self, message):
"""See base class."""
return message["content"]
get_message_text_from_edited_message(self, message)
See base class.
Source code in wagtail_live/webapp/receiver.py
def get_message_text_from_edited_message(self, message):
"""See base class."""
return self.get_message_text(message=message)