initial commit
This commit is contained in:
commit
d938f48724
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
package-lock.json
|
||||||
|
node_modules
|
||||||
|
config.json
|
4
TEMPLATE-config.json
Normal file
4
TEMPLATE-config.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"token": "your token",
|
||||||
|
"port": 8080
|
||||||
|
}
|
5
assets/style.css
Normal file
5
assets/style.css
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.messages {
|
||||||
|
background: #333333;
|
||||||
|
color: white;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
17
package.json
Normal file
17
package.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "poc",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "server.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node server.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"discord.js-selfbot-v13": "^3.1.4",
|
||||||
|
"express": "^4.18.2"
|
||||||
|
}
|
||||||
|
}
|
6
pages/index.html
Normal file
6
pages/index.html
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<head>
|
||||||
|
<title>noscript discord</title>
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="messages">
|
37
server.js
Normal file
37
server.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
const express = require("express")
|
||||||
|
const { Client } = require("discord.js-selfbot-v13");
|
||||||
|
const { readFileSync } = require("node:fs");
|
||||||
|
const cfg = require("./config.json");
|
||||||
|
|
||||||
|
const client = new Client();
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
let resStream;
|
||||||
|
let channel;
|
||||||
|
|
||||||
|
app.use(express.static("assets"));
|
||||||
|
|
||||||
|
app.get("/channels/:channel", (req, res) => {
|
||||||
|
channel = req.params.channel;
|
||||||
|
resStream = res;
|
||||||
|
|
||||||
|
resStream.writeHead(200, {
|
||||||
|
"Content-Type": "text/html",
|
||||||
|
});
|
||||||
|
|
||||||
|
resStream.write(readFileSync("pages/index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
|
function constructMessage(msg) {
|
||||||
|
return `<div>
|
||||||
|
<span>${msg.author.username}</span>: ${msg.content}
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.on("messageCreate", (msg) => {
|
||||||
|
if(!resStream || !channel || msg.channel.id !== channel) return;
|
||||||
|
resStream.write(constructMessage(msg));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(cfg.port);
|
||||||
|
client.login(cfg.token);
|
Loading…
Reference in a new issue