This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
80 lines (66 loc) · 2.42 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
76
77
78
79
'use strict';
//Check if the node version is 10.0.0+
if (Number(process.version.slice(1).split('.')[0]) < 10) throw new Error('NodeJS 10.0.0 or higher is required. Re-run this with NodeJS 10.0.0+');
if (process.env.PREBOOT) eval(process.env.PREBOOT);
//Define NPM modules
const Discord = require('discord.js');
const Enmap = require('enmap');
const CleverBotAPI = require('cleverbot.io');
const NekosLifeAPI = require('nekos.life');
const LolisLifeAPI = require('lolis.life');
//Define client
const client = new Discord.Client({
disableEveryone: true,
disabledEvents: ['TYPING_START']
});
//Define time of Startup
client.starttime = new Date().getTime();
//Define Databases/Objects
client.items = new Enmap({name: 'glptmitems'});
client.money = new Enmap({name: 'glptm'});
client.profiles = new Enmap({name: 'profiles'});
client.logins = new Enmap({name: 'logins'});
client.spotify = new Enmap({name: 'spotify'});
client.settings = new Enmap({name: 'settings'});
client.notes = new Enmap({name: 'notes'});
client.bugs = new Enmap({name: 'bugreports'});
client.starboard = new Enmap({name: 'starboardmid'});
client.warns = new Enmap({name: 'warns'});
client.tags = new Enmap({name: 'tags'});
client.uses = new Enmap({name: 'commandpop'});
client.minecooldown = new Discord.Collection();
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
client.liusers = new Discord.Collection();
client.music = {};
client.levelCache = {};
//Define Nekos.life API
client.nekoslife = new NekosLifeAPI();
//Define Lolis.life API
client.lolislife = new LolisLifeAPI();
//Define CleverBot API
client.cleverbot = new CleverBotAPI(process.env.CLEVERBOT_USER_KEY, process.env.CLEVERBOT_API_KEY);
client.cleverbot.setNick('CytrusBot');
//Generate Session secret
process.env.SESSION_SECRET = '';
for (let i = 0; i <= 1500; i++)
process.env.SESSION_SECRET += Math.random()
.toString(16)
.slice(2, 8)
.toUpperCase()
.slice(-6) + i;
//Import files
client.logger = require('./modules/Logger');
client.config = require('./cnf');
require('./modules/commands')(client);
require('./modules/events')(client);
require('./modules/_functions')(client);
//Cache the permissions
for (let i = 0; i < client.config.permLevels.length; i++) {
let currentlevel = client.config.permLevels[i];
client.levelCache[currentlevel.name] = currentlevel.level;
}
//Login to discord
client.login(process.env.BOT_TOKEN);
//Export the client
module.exports = client;