-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
49 lines (40 loc) · 1.62 KB
/
index.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
const keepAlive = require( './functions/server.js' );
const initDatabase = require( './functions/database.js' );
const fs = require( 'fs' );
const { Client, GatewayIntentBits, Partials, Collection } = require( 'discord.js' );
const config = require( './config.json' );
require( 'dotenv' ).config();
initDatabase();
const client = new Client( {
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
],
partials: [ Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction ]
} );
/* -------------------- COLLECTIONS -------------------- */
client.aliases = new Collection();
client.commands = new Collection();
client.groups = new Collection();
client.events = new Collection();
client.prefix = config.prefix;
client.slashCommands = new Collection();
/* ------------------ STATIC COMMANDS ------------------ */
var staticCmds = [];
if ( config.staticCmds ) { staticCmds.concat( config.staticCmds ); }
staticCmds.push( 'admin' );
client.groups.set( 'staticCmds', staticCmds );
client.ownerId = ( config.botOwnerId || process.env.OWNER_ID );
module.exports = client;
fs.readdirSync( './handlers' ).forEach( ( handler ) => {
require( `./handlers/${handler}` )( client );
} );
client.login( process.env.token )
.then( async loggedIn => { console.log( 'Successfully connected!' ); } )
.catch( errLogin => { console.error( 'There was an error logging in:\n%s', errLogin.stack ); } );
keepAlive();