First Setup
This commit is contained in:
commit
900a4f65da
11 files changed
+2244
No files matched your search
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -0,0 +1,20 @@
|
||||
// Create discord.js client
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildPresences,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.GuildMessageTyping,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
|
||||
]
|
||||
});
|
||||
// Set intents
|
||||
client.on('ready', () => {
|
||||
console.log('Bot is ready!');
|
||||
});
|
||||
// Login
|
||||
client.login(process.env.BOT_TOKEN);
|
||||
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
|
||||
"bot": {
|
||||
"token": "OTM0MDg3NTIzNjQ5NjA5NzY4.GV-g1-.Eggw57JNtsrLPbakg-_yr8fn8oBAbh0nKfK-lk"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Load Bot and website
|
||||
const bot = require('./bot');
|
||||
const website = require('./website');
|
||||
// Import config and export
|
||||
const config = require('./config');
|
||||
// Connect to mongoDB
|
||||
try {
|
||||
mongoose.connect(config.mongoDB.url);
|
||||
} catch (err) {
|
||||
console.log('Error connecting to mongoDB');
|
||||
process.exit(1);
|
||||
}
|
||||
//export config
|
||||
module.exports.config = config;
|
||||
module.exports.mongoose = mongoose;
|
||||
Generated
+2110
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "botscord",
|
||||
"version": "0.0.1",
|
||||
"description": "BotsCord",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/CorwinDev/BotsCord.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Discord",
|
||||
"Bots",
|
||||
"BotsCord",
|
||||
"BotList",
|
||||
"ServerList"
|
||||
],
|
||||
"author": "CorwinDev",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/CorwinDev/BotsCord/issues"
|
||||
},
|
||||
"homepage": "https://github.com/CorwinDev/BotsCord#readme",
|
||||
"dependencies": {
|
||||
"discord.js": "^14.1.1",
|
||||
"express": "^4.18.1",
|
||||
"express-session": "^1.17.3",
|
||||
"mongoose": "^6.5.0",
|
||||
"passport": "^0.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const mongoose = require('mongoose');
|
||||
const session = require('express-session');
|
||||
const passport = require('passport');
|
||||
// set up session
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
resave: false,
|
||||
saveUninitialized: false
|
||||
}));
|
||||
// Import routers
|
||||
var bot = require('./routers/bot');
|
||||
app.use('/bot', bot);
|
||||
var admin = require('./routers/admin');
|
||||
app.use('/admin', admin);
|
||||
var auth = require('./routers/auth');
|
||||
app.use('/auth', auth);
|
||||
|
||||
// use passport for authentication
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
// set up static files
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
// set up view engine
|
||||
app.set('view engine', 'ejs');
|
||||
// set up routes
|
||||
app.get('/', (req, res) => {
|
||||
res.render('index');
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log('Your app is listening on port ' + listener.address().port);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
var express = require('express'),
|
||||
router = express.Router();
|
||||
|
||||
router.get('/', function () {
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,7 @@
|
||||
var express = require('express'),
|
||||
router = express.Router();
|
||||
|
||||
router.get('/', function () {
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,7 @@
|
||||
var express = require('express'),
|
||||
router = express.Router();
|
||||
|
||||
router.get('/', function () {
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
Whitespace-only changes.
Reference in new issue
Block a user