-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (30 loc) · 1.31 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
//Constants must be declared for the bot to work
const Discord = require("discord.js");
const client = new Discord.Client();
const express = require( 'express' );
let app = express(),
Discordie = require( 'discordie' ),
Events = Discordie.Events;
//config.json is the file with your bot's token
const config = require("./config.js");
Client = new Discordie( { autoReconnect : true } );
//Your bot's status
client.on('ready', () => {
console.log(`${client.user.tag} is Online!`) //Console Logs "Name of your bot" is Online
client.user.setActivity(`YOUR TEXT`, { type: 'LISTENING' }) //types can be "LISTENING", "PLAYING", "WATCHING", and "STREAMING" (Streaming however is more advanced)
});
//Maintains port connection
try {
app.listen( config.port, () => {
console.log( 'Express server listening on port ', config.port ); //Console Logs the port number
Client.connect( {
token : config.token
} );
} );
} catch ( e ) {
console.log( JSON.stringify( e ) );
}
// If you need to expand into more files copy the line below and add the name of your file instead of the example.js file in the new line
require('./main.js')(client);
//require('./newfilename.js')(client); <---- replace "newfilename" with your files name and remove the //
client.login(config.token);