diff --git a/data/embeds/ufora.py b/data/embeds/ufora.py index 9d1d13c..c02cbff 100644 --- a/data/embeds/ufora.py +++ b/data/embeds/ufora.py @@ -26,6 +26,9 @@ class UforaNotification: return embed + def get_id(self): + return int(self._notif_id) if self._notif_id is not None else self._content["id"] + def _create_url(self): if self._notif_id is None or self._course_id is None: return self._content["link"] @@ -52,11 +55,27 @@ class UforaNotification: def _clean_content(self, text: str): html_table = { + # CHARACTERS: "&": '&', """: '"', "apos;": "'", ">": ">", - "<": "<" + "<": "<", + # MARKDOWN SUPPORT: + "": "**", + "": "**", + "": "**", + "": "**", + "": "*", + "": "*", + "": "*", + "": "*", + "": "~~", + "": "~~", + "": "__", + "": "__", + # Represent paragraphs with newlines + "

": "\n" } # Unescape HTML diff --git a/functions/ufora_notifications.py b/functions/ufora_notifications.py index 11b9f53..ecb8a1c 100644 --- a/functions/ufora_notifications.py +++ b/functions/ufora_notifications.py @@ -41,9 +41,10 @@ def run(): if feed: for item in feed: - notifications[course].append(item["id"]) + notification = UforaNotification(item, course) + new_notifications.append(notification) - new_notifications.append(UforaNotification(item, course)) + notifications[course].append(notification.get_id()) # Update list of notifications if new_notifications: