-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
69 lines (64 loc) · 1.97 KB
/
Copy pathbot.js
File metadata and controls
69 lines (64 loc) · 1.97 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
const discord = require("discord.js");
const config = require("./config.json");
const SteamAPI = require("steamapi");
const steam = new SteamAPI(config.steamToken);
const client = new discord.Client();
const numeral = require("numeral");
const fs = require("fs");
client.commands = new discord.Collection();
let deletedMsg = new Array();
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);
}
client.on("messageDelete", (message) => {
deletedMsg.push({
msg: message.content,
author: message.author.username,
channel: message.channel.name,
date:
message.createdAt.toDateString() +
" " +
message.createdAt.toTimeString().slice(0, 8),
});
if (deletedMsg.length == 50) {
deletedMsg.shift();
}
});
client.on("message", (message) => {
if (!message.content.startsWith(config.prefix) || message.author.bot) {
return;
}
const arg = message.content.slice(config.prefix.length).split(" ");
const command = arg.shift().toLowerCase();
if (command == "featured") {
client.commands.get("featured").execute(message, steam, numeral);
}
if (command == "reveal") {
const Reveal = new discord.RichEmbed().setTitle("Deleted messages");
for (const deleted of deletedMsg) {
Reveal.addField(
deleted.author + " " + deleted.date + " at " + deleted.channel,
deleted.msg
);
}
message.channel.send(Reveal);
deletedMsg = [];
}
if (command.startsWith("game")) {
client.commands.get("game").execute(message, arg, steam, discord);
}
if (command == "char") {
client.commands.get("char").execute(arg[0].toLowerCase(), discord, message);
}
if (command == "download") {
client.commands.get("download").execute(message, arg.toString(), discord);
}
if (command == "leave") {
client.destroy();
}
});
client.login(config.token);