actually fix tabs
This commit is contained in:
parent
af0b68eadc
commit
1cc5508506
|
@ -1,8 +1,8 @@
|
|||
<head>
|
||||
<title>noscript discord</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<title>noscript discord</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form action="/send"><input type="text" name="content" /></form>
|
||||
<div class="messages">
|
||||
<form action="/send"><input type="text" name="content" target="_blank" /></form>
|
||||
<div class="messages">
|
||||
|
|
22
server.js
22
server.js
|
@ -17,28 +17,28 @@ app.get("/send", async (req, res) => {
|
|||
});
|
||||
|
||||
app.get("/channels/:channel", async (req, res) => {
|
||||
channel = await client.channels.fetch(req.params.channel);
|
||||
resStream = res;
|
||||
channel = await client.channels.fetch(req.params.channel);
|
||||
resStream = res;
|
||||
|
||||
resStream.writeHead(200, {
|
||||
"Content-Type": "text/html",
|
||||
});
|
||||
resStream.writeHead(200, {
|
||||
"Content-Type": "text/html",
|
||||
});
|
||||
|
||||
resStream.write(readFileSync("pages/index.html"));
|
||||
resStream.write(readFileSync("pages/index.html"));
|
||||
(await channel.messages.search()).messages.reverse().each(msg => {
|
||||
resStream.write(constructMessage(msg));
|
||||
});
|
||||
});
|
||||
|
||||
function constructMessage(msg) {
|
||||
return `<div>
|
||||
<span>${msg.author.username}</span>: ${msg.content}
|
||||
</div>`;
|
||||
return `<div>
|
||||
<span>${msg.author.username}</span>: ${msg.content}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
client.on("messageCreate", (msg) => {
|
||||
if(!resStream || !channel || msg.channel.id !== channel.id) return;
|
||||
resStream.write(constructMessage(msg));
|
||||
if(!resStream || !channel || msg.channel.id !== channel.id) return;
|
||||
resStream.write(constructMessage(msg));
|
||||
});
|
||||
|
||||
app.listen(cfg.port);
|
||||
|
|
Loading…
Reference in a new issue