-
Notifications
You must be signed in to change notification settings - Fork 0
/
TheraneaticBot.js
105 lines (92 loc) · 3.22 KB
/
TheraneaticBot.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
var Discord = require("discord.js");
var bot = new Discord.Client();
const now = require('performance-now')
var information = require('./information.json');
bot.on('ready', (g,m) => {
console.log('Bot online. Developed by Theraneatic for personal use. V0.0.2.');
});
bot.on("message", function (message) {
if (message.author.id === information.id) {
if (message.content === "x|perms") {
message.channel.sendMessage("This is what you can do:\n" +
JSON.stringify(message.channel.permissionsFor(message.author).serialize(), null, 4));
}
}
});
bot.on("message", function (message) {
if (message.author.id === information.id) {
if (message.content ==="x|ping") {
var startTime = now();
message.channel.sendMessage("Checking ping...")
.then(message => {
var endTime = now();
return message.edit(`Pong! ${(endTime - startTime).toFixed(3)} milliseconds have passed.`);
}).catch(console.error);
}
}});
bot.on("message", function (message) {
if (message.author.id == information.id) {
if (message.content === "x|restart") {
message.channel.sendMessage("Restarting...");
bot.destroy();
bot.login(information.token);
}
}
});
bot.on("message", function (message) {
if (message.author.id == information.id) {
if (message.content === "x|shutdown") {
message.channel.sendMessage("Shutting down...");
bot.destroy();
}
}
});
bot.on("message", message => {
if (message.author.id === information.id)
if (message.content === "x|myinfo") {
message.channel.sendMessage(`Here is your info:
My ID: ${message.author.id}
Joined: ${message.member.joinedAt}
Join Timestamp: ${message.member.joinedTimestamp}
Avatar: ${message.author.avatarURL}
Account Creation Time: ${message.author.createdAt}
Display Name: ${message.member.displayName}
Highest Role: ${message.member.highestRole}`)
}
});
bot.on ('message', message => {
if (message.author.id === information.id) {
if (message.content === 'x|coinflip') {
let randnum = ((Boolean(Math.floor(Math.random()*10) > 5)));
if (randnum === true) {
message.channel.sendMessage('Heads!');
}
if (randnum === false) {
message.channel.sendMessage('Tails!');
}
}
}
});
bot.on ('message', message => {
if (message.content === 'x|gennum') {
if (message.author.id === information.id) {
let numgen = ((Math.floor(Math.random()*10000)));
message.channel.sendMessage('The number you generated was ' + numgen + '!');
}
}
});
bot.on ('message', message => {
if (message.author.id === information.id) {
if (message.content === "x|help") {
message.channel.sendMessage(`Here are my commands:
x|coinflip: Flips a coin.
x|gennum: Generates a random number.
x|myinfo
x|shutdown
x|restart
x|ping
x|perms`)
}
}
});
bot.login(information.token)