// This sucks but works. function getRandomLine(file) { return fetch(file) .then(res => res.text()) .then(text => { const lines = text.trim().split('\n'); const randomIndex = Math.floor(Math.random() * lines.length); return lines[randomIndex]; }); } getRandomLine("/assets/messages.txt").then(line => { document.getElementById("qotd").innerHTML = line; });