update nodejs
This commit is contained in:
parent
e98c36b270
commit
b3974987a1
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,7 +1,5 @@
|
|||||||
__pycache__
|
|
||||||
*.pyc
|
|
||||||
venv/
|
|
||||||
.env
|
.env
|
||||||
*.log
|
.vscode/
|
||||||
*.log.*
|
node_modules/
|
||||||
.vscode/
|
package-lock.json
|
||||||
|
config.json
|
24
src/bot.js
Normal file
24
src/bot.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
const discord = require("discord.js");
|
||||||
|
const fileSystem = require("fs");
|
||||||
|
|
||||||
|
// const { GatewayIntentBits } = require("discord.js");
|
||||||
|
|
||||||
|
const client = new discord.Client({
|
||||||
|
intents: []
|
||||||
|
});
|
||||||
|
|
||||||
|
const config = require("./config/config.json");
|
||||||
|
client.config = config;
|
||||||
|
|
||||||
|
fileSystem.readdir("./events/", (error, files) => {
|
||||||
|
if (error) { return console.error(error); }
|
||||||
|
files.forEach(file => {
|
||||||
|
const event = require (`./events/${file}`);
|
||||||
|
const eventName = file.split(".")[0];
|
||||||
|
client.on(eventName, event.bind(null, client));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login(config.token);
|
||||||
|
|
||||||
|
exports.client = client;
|
18
src/events/ready.js
Normal file
18
src/events/ready.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
const chalk = require("chalk");
|
||||||
|
const config = require("../config/config.json")
|
||||||
|
const discord = require("../bot");
|
||||||
|
|
||||||
|
module.exports = client => {
|
||||||
|
console.clear();
|
||||||
|
|
||||||
|
console.log(chalk.bold.green("Launched Successfully...\n"));
|
||||||
|
console.log(chalk.magenta("Version:"), chalk.cyan("-"));
|
||||||
|
console.log(chalk.magenta("Made by"), chalk.cyan("Corbz"));
|
||||||
|
console.log(chalk.magenta("Prefix:"), chalk.cyan(`${config.prefix}\n`));
|
||||||
|
|
||||||
|
if (client.user) {
|
||||||
|
console.log(chalk.green(chalk.bold(client.user.username), "is online!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(chalk.green("website:", chalk.underline(`http://localhost:${config.port}`)));
|
||||||
|
};
|
46
src/index.js
Normal file
46
src/index.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
const discord = require("./bot");
|
||||||
|
const express = require("express");
|
||||||
|
const session = require("express-session");
|
||||||
|
const flash = require("connect-flash");
|
||||||
|
const fileUpload = require("express-fileupload");
|
||||||
|
const config = require("./config/config.json");
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const http = require("http").Server(app);
|
||||||
|
const io = require("socket.io")(http);
|
||||||
|
|
||||||
|
port = config.port;
|
||||||
|
|
||||||
|
app.use(express.static("./public"));
|
||||||
|
app.use(express.static("./themes"));
|
||||||
|
app.set("view engine", "ejs");
|
||||||
|
app.use(express.urlencoded({ extended: true, limit: "5mb" }));
|
||||||
|
app.use(fileUpload());
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
session({
|
||||||
|
secret: "test",
|
||||||
|
resave: true,
|
||||||
|
saveUninitialized: true
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
app.use(flash());
|
||||||
|
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
res.locals.success = req.flash("success"),
|
||||||
|
res.locals.error = req.flash("error");
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
// app.use("/", require("./routes/home.js"));
|
||||||
|
|
||||||
|
http.listen(port);
|
||||||
|
|
||||||
|
// io.sockets.on("connection", sockets => {
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
app.use((req, res) => {
|
||||||
|
res.status(404).render("error_pages/404");
|
||||||
|
});
|
26
src/package.json
Normal file
26
src/package.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "pyrss-ng",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitea.cor.bz/corbz/pyrss-ng.git"
|
||||||
|
},
|
||||||
|
"license": "ISC",
|
||||||
|
"author": "",
|
||||||
|
"type": "commonjs",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"connect-flash": "^0.1.1",
|
||||||
|
"discord.js": "^14.17.3",
|
||||||
|
"ejs": "^3.1.10",
|
||||||
|
"express": "^4.21.2",
|
||||||
|
"express-fileupload": "^1.5.1",
|
||||||
|
"express-session": "^1.18.1",
|
||||||
|
"lolcatjs": "^2.4.3",
|
||||||
|
"socket.io": "^4.8.1"
|
||||||
|
}
|
||||||
|
}
|
0
src/routes/home.js
Normal file
0
src/routes/home.js
Normal file
0
src/themes/default.css
Normal file
0
src/themes/default.css
Normal file
0
src/views/error_pages/404.ejs
Normal file
0
src/views/error_pages/404.ejs
Normal file
0
src/views/home/home.ejs
Normal file
0
src/views/home/home.ejs
Normal file
0
web/index.css
Normal file
0
web/index.css
Normal file
0
web/index.html
Normal file
0
web/index.html
Normal file
Loading…
x
Reference in New Issue
Block a user