generated from nhcarrigan/template
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import http from "http";
|
|
|
|
import express from "express";
|
|
|
|
import { ExtendedClient } from "../interface/ExtendedClient";
|
|
|
|
/**
|
|
* Instantiates the web server for listening to webhook payloads.
|
|
*
|
|
* TODO: Delete this entirely once all trello things are done.
|
|
*
|
|
* @param {ExtendedClient} bot The bot's Discord instance.
|
|
*/
|
|
export const serve = async (bot: ExtendedClient) => {
|
|
const app = express();
|
|
app.use(express.json());
|
|
|
|
app.get("/", (_req, res) => {
|
|
res.header("Content-Type", "text/html");
|
|
res.status(200).send(`
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Art 4 Palestine Bot</title>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta name="description" content="A bot to facilitate our initiative to raise funds for Palestine relief charities by rewarding donors with art." />
|
|
<script src="https://cdn.nhcarrigan.com/headers/index.js" async defer></script>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>Art 4 Palestine Bot</h1>
|
|
<section>
|
|
<p>A bot to facilitate our initiative to raise funds for Palestine relief charities by rewarding donors with art.</p>
|
|
</section>
|
|
<section>
|
|
<h2>Links</h2>
|
|
<p>
|
|
<a href="https://codeberg.org/nhcarrigan/a4p-bot">
|
|
<i class="fa-solid fa-code"></i> Source Code
|
|
</a>
|
|
</p>
|
|
<p>
|
|
<a href="https://docs.nhcarrigan.com">
|
|
<i class="fa-solid fa-book"></i> Documentation
|
|
</a>
|
|
</p>
|
|
<p>
|
|
<a href="https://chat.nhcarrigan.com">
|
|
<i class="fa-solid fa-circle-info"></i> Support
|
|
</a>
|
|
</p>
|
|
</section>
|
|
</main>
|
|
</html>`);
|
|
});
|
|
|
|
const httpServer = http.createServer(app);
|
|
|
|
httpServer.listen(10080, async () => {
|
|
await bot.debug.send("http server listening on port 10080");
|
|
});
|
|
};
|