diff options
Diffstat (limited to 'scripts/chat.js')
| -rw-r--r-- | scripts/chat.js | 15 |
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 |
