summaryrefslogtreecommitdiff
path: root/scripts/chat.js
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-10-26 22:32:49 +0500
committerilotterytea <iltsu@alright.party>2025-10-26 22:32:49 +0500
commit94e74ac79e775253b56384748c619a764d31e091 (patch)
tree403969aba0a764a2dad89da47d3d4764654c6873 /scripts/chat.js
parent051ec346e7e0f2581d15ffd8a696caa195c989e4 (diff)
feat: fetch recent messages
Diffstat (limited to 'scripts/chat.js')
-rw-r--r--scripts/chat.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/chat.js b/scripts/chat.js
index 8f7e31f..e6c9e81 100644
--- a/scripts/chat.js
+++ b/scripts/chat.js
@@ -182,4 +182,19 @@ function connectToChat(host, nick, password, room) {
clearInterval(membershipInterval);
setTimeout(() => connectToChat(host, nick, password, room), 5000);
});
+}
+
+function getRecentMessages(room) {
+ fetch(`https://recent-messages.robotty.de/api/v2/recent-messages/${room}`)
+ .then((r) => r.json())
+ .then((json) => {
+ if (json["error"] != null) {
+ addSystemMessage(`${json["error"]} (Recent messages)`);
+ return;
+ }
+
+ for (const message of json["messages"]) {
+ addMessage(parseIRCMessage(message));
+ }
+ });
} \ No newline at end of file