-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
72 lines (63 loc) · 2.48 KB
/
main.js
File metadata and controls
72 lines (63 loc) · 2.48 KB
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
/*-----------------
| NERDBOT_NG |
-----------------
This is a smol bot made in node, not very clean code but it does the job!
Contributors: Ineon (For the code for the original version (now archived)), OakBricks (Author), PurpurConcrete (Contributor)
Licensed under MIT i guess
*/
const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./config.json');
const verfile = require('./verfile.json');
const rawverfilecomparelink = (config.remoteversionfile)
const fetch = require('node-fetch');
fetch(config.motdurl)
.then(res => res.text())
.then(body => console.log(body));
client.on('ready', () => {
fetch(config.remoteversionfile)
.then(res => res.text())
.then(body => console.log(body));
console.log(`Logged in as ${client.user.tag}!`);
console.log('just a quick reminder to please use nodemon for automatic reloads and debugging!');
console.log('Some info about your config!');
console.log('bot_token: ' + config.token);
console.log('supportsite: ' + config.suppportsite);
console.log('prefix: ' + config.prefix);
console.log(' ')
console.log('if the current version and latest version are not the same it is likley you need to update (plese check github for the latest version!)');
console.log('The Current Version is ' + verfile.version + '!');
});
client.on('message', message => {
if (message.content === config.prefixdebug + 'ping') {
message.channel.send('Loading data').then (async (msg) =>{
msg.delete()
message.channel.send(`🏓Latency is ${msg.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
})
}
});
client.on('message', msg => {
if (msg.content === config.prefix + 'ping') {
msg.reply('pong');
}
});
client.on('message', msg => {
if (msg.content === config.prefix + 'help') {
msg.channel.send('Read the docs at:' + config.suppportsite);
}
});
client.on('message', msg => {
if (msg.content === config.prefix + 'why') {
msg.channel.send('joe nuts');
}
});
client.on('message', msg => {
if (msg.content === config.prefix + 'info') {
msg.channel.send('Version: ' + verfile.version);
msg.channel.send('Prefix: ' + config.prefix);
msg.channel.send('Prefix Example. ' + config.prefix + 'help');
msg.channel.send('Support Website: ' + config.suppportsite);
msg.channel.send('Version Links: ' + config['remoteversionfile-legacy'] + ' (legacy version checking), ' + config.remoteversionfile)
}
});
client.login(config.token);