-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
64 lines (44 loc) · 1.96 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
53
54
55
56
57
58
59
60
61
62
63
64
const Discord = require('discord.js');
const os = require('os');
const moment = require('moment');
require('moment-duration-format');
const bot = new Discord.Client();
const config = require('./assets/json/config.json');
bot.on('ready', () => {
console.log(`${bot.user.tag} is UP and RUNNING.`);
bot.user.setActivity('over', { type: 'WATCHING' });
});
bot.color = 0x36393e;
bot.footerText = 'Specter Bot produced by Specter Team.';
bot.prefix = 's.';
bot.nodeID = '';
bot.on('message', async (message) => {
if (!message.member) return;
if (!message.author.bot && message.channel.type !== 'text') {
const embed = new Discord.MessageEmbed()
.setColor(bot.color)
.setTitle('Sorry, this bot only runs in servers!')
.setFooter(client.footerText)
message.channel.send(embed).catch(err => console.log(err));
}
if (!message.guild.me.hasPermission('ADMINISTRATOR') && message.content.startsWith(bot.prefix)) {
const embed = new Discord.MessageEmbed()
.setColor(bot.color)
.setFooter('Sorry, to ensure all active servers get the best possible speed, all servers where the bot does not have Administrator are disabled. If you don\'t feel comfortable with this you may download and host the bot yourself at our GitHub repo.')
message.channel.send(embed).catch(err => console.log(err));
} else if (!message.guild.me.hasPermission('ADMINISTRATOR')) return;
if (message.author.bot) return;
// Variables
let args = message.content.slice(bot.prefix.length).trim().split(" "),
cmd = args.shift().toLowerCase();
if (cmd !== 'limits' && !args[0] && bot.isNode) return;
if (!message.content.startsWith(bot.prefix)) return;
// Run Commands
try {
let commandFile = require(`./commands/${cmd}.js`);
commandFile.run(bot, message, args, bot.tools);
} catch (e) {
console.log(e.stack);
}
});
bot.login(config.bot.TOKEN);