-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (42 loc) · 1.51 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
const commando = require('discord.js-commando');
const discord = require('discord.js');
const config = require('./config.json');
const path = require('path');
const bot = new commando.Client({
owner: config.owner,
commandPrefix: 'xd//'
});
bot.on("ready", () => {
bot.user.setPresence({
status: "online",
game: {
name: "developing myself",
type: "LISTENING"
}
});
console.log(`**Bot ready. ${bot.guilds.size} servers, ${bot.channels.size} channels, ${bot.users.size} users.**`);
});
bot.on("error", (e) => console.error(e));
bot.on("warn", (e) => console.warn(e));
// bot.on("debug", (e) => console.info(e));
bot.registry.registerGroups([
['useful', 'Useful'],
['random', 'Random'],
['xendric', 'Xendric']
]).registerDefaults().registerCommandsIn(path.join(__dirname, 'commands'));
bot.on("messageUpdate", async(oldMsg, newMsg) =>{
if(oldMsg.content === newMsg.content) return;
let logEmbed = new discord.RichEmbed();
logEmbed.setAuthor(oldMsg.author.tag, oldMsg.author.avatarUrl);
logEmbed.setThumbnail(oldMsg.author.avatarUrl);
logEmbed.setColor(0x007fed);
logEmbed.setDescription("Message from a user was updated.");
logEmbed.addField("Before", oldMsg.content, true);
logEmbed.addField("After", newMsg.content, true);
logEmbed.setTimestamp();
logEmbed.setFooter("Embed for message updates");
let loggingChannel = newMsg.guild.channels.find(ch => ch.name === "dev-bot-testing");
if(!loggingChannel) return;
loggingChannel.send(logEmbed);
});
bot.login(config.token);