This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
75 lines (58 loc) · 2.12 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require('fs');
const {Client,Collection} = require('discord.js');
const {
TOKEN,PREFIX,OAuth2_URL,PERM_CODE,SCOPE,CLIENT_ID,CLIENT_SECRET,REDIRECT_URL,
MY_SQL_HOST,MY_SQL_DATA,MY_SQL_PASS,MY_SQL_USER,MONGODB_DATA,MONGODB_HOST,MONGODB_PASS,MONGODB_USER
} = require('./config');
client.queue = new Map(); //For Music Queue List
client.commands = new Collection();
client.aliases = new Collection();
client.categories = fs.readdirSync("./commands/");
client.event = new Collection();
["command"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.on('ready', () => {
console.log(`Logged In As ${client.user.username}`)
client.user.setActivity("n! | narusejun.xyz", {type: "STREAMING", url: "https://twitch.tv/mrjanggo858"})
});
client.on('message', async(message) => {
let prefix = PREFIX;
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(prefix)) return;
if (!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
let command = client.commands.get(cmd);
if (!command) command = client.commands.get(client.aliases.get(cmd));
if (command)
command.run(client, message, args);
})
client.login(TOKEN);
const express = require('express');
const app = express();
let port = 3000;
app.set('port', port);
const session = require('express-session');
app.set('view engine', 'ejs');
app.use(express.static('public'));
app.use(session({
secret: '48738924783748273742398747238',
resave: false,
saveUninitialized: false,
expires: 604800000,
}));
require('./router')(app);
app.listen(port, () => console.info(`Listening on port ${port}`));
const mysql = require('mysql');
const mongoose = require('mongoose');
// set up the mysql account info
const con = mysql.createConnection({
host: MY_SQL_HOST,
user: MY_SQL_USER,
password: MY_SQL_PASS
});