This repository has been archived by the owner on Oct 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.js
54 lines (50 loc) · 1.48 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
const Discord = require('discord.js');
const botsettings = require('./botsettings.json');
const bot = new Discord.Client({
disableMentions: 'everyone',
ws: {
intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILD_PRESENCES'],
},
fetchAllMembers: true,
});
bot.commands = new Discord.Collection();
bot.aliases = new Discord.Collection();
bot.snipes = new Map();
bot.esnipes = new Map();
['command', 'event'].forEach(handler => {
require(`./handlers/${handler}`)(bot);
});
bot.on('messageDelete', function(message) {
if (message.author.bot) return;
const snipes = message.client.snipes.get(message.channel.id) || [];
snipes.unshift({
content: message.content,
author: message.author,
image: message.attachments.first() ?
message.attachments.first().proxyURL : null,
date: new Date().toLocaleString('en-IN', {
timeZone: 'Asia/Kolkata',
format: 'lll',
}),
});
snipes.splice(10);
message.client.snipes.set(message.channel.id, snipes);
});
bot.on('messageUpdate', function(message) {
if (message.author.bot) return;
const esnipes = message.client.esnipes.get(message.channel.id) || [];
esnipes.unshift({
content: message.content,
author: message.author,
url: message.url,
image: message.attachments.first() ?
message.attachments.first().proxyURL : null,
date: new Date().toLocaleString('en-IN', {
timeZone: 'Asia/Kolkata',
format: 'lll',
}),
});
esnipes.splice(10);
message.client.esnipes.set(message.channel.id, esnipes);
});
bot.login(botsettings.token);