-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
52 lines (43 loc) · 1.46 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
50
51
52
const fs = require('fs');
const Discord = require('discord.js');
require('dotenv').config();
const token = process.env.TOKEN;
const client = new Discord.Client();
client.commands = new Discord.Collection();
module.exports = {
client: client,
};
//Commands section
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
//Events section
fs.readdir('./events', (err, files) => {
if (err) return console.log(err);
let jsFiles = files.filter(file => file.split('.').pop() === 'js');
jsFiles.forEach(file => {
const prop = require(`./events/${file}`);
client.on(prop.help.event, prop);
});
});
client.once('ready', () => {
require('http').createServer((req, res) => res.end('Bot is alive')).listen(3000)
console.log('Ready!');
console.log('Logged in as ' + client.user.tag)
client.user.setStatus('available')
client.channels.cache.get(process.env.GUILD_INIT).send(process.env.GUILD_INIT_MSG)
client.user.setPresence({
activity: {
name: process.env.ACTIVITY_STATUS,
url: process.env.URL
}
});
});
//c=member.guild.channels.resolve('755495364697784392');
//c.setName('Member Count: ' + member.guild.memberCount);
//c=member.guild.channels.resolve('755495394338799698');
//usercount = member.guild.memberCount - 11;
//c.setName('User Count: ' + usercount);
client.login(token);